Tcl Source Code

Check-in [8aa6e6e51b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix stack computations for lmap
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mistake
Files: files | file ages | folders
SHA1: 8aa6e6e51be9f4c4b7aa0adbc310af827167abf7
User & Date: mig 2013-12-10 11:55:06
Context
2013-12-10
11:55
fix INST_LMAP_COLLECT from trunk Closed-Leaf check-in: fab4f64b61 user: mig tags: mistake
11:55
fix stack computations for lmap check-in: 8aa6e6e51b user: mig tags: mistake
11:38
new INST_LMAP_COLLECT, speeds up lmap and eliminates the need for a temp var check-in: 58ebb29700 user: mig tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclCompCmds.c.

2664
2665
2666
2667
2668
2669
2670



2671
2672
2673
2674
2675
2676
2677
    /*
     * The command's result is an empty string if not collecting. If
     * collecting, it is automatically left on stack after FOREACH_END.
     */

    if (collect != TCL_EACH_COLLECT) {
	PushStringLiteral(envPtr, "");



    }
    
    done:
    for (loopIndex = 0;  loopIndex < numLists;  loopIndex++) {
	if (varvList[loopIndex] != NULL) {
	    ckfree(varvList[loopIndex]);
	}







>
>
>







2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
    /*
     * The command's result is an empty string if not collecting. If
     * collecting, it is automatically left on stack after FOREACH_END.
     */

    if (collect != TCL_EACH_COLLECT) {
	PushStringLiteral(envPtr, "");
    } else {
	/* fix the stack computation to allow for lmap's result */
	TclAdjustStackDepth(1, envPtr);
    }
    
    done:
    for (loopIndex = 0;  loopIndex < numLists;  loopIndex++) {
	if (varvList[loopIndex] != NULL) {
	    ckfree(varvList[loopIndex]);
	}

Changes to generic/tclCompile.c.

549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
    {"foreach_start",	  5,   +2,          1,	{OPERAND_AUX4}},
	/* Initialize execution of a foreach loop. Operand is aux data index
	 * of the ForeachInfo structure for the foreach command. It pushes 2
	 * elements which hold runtime params for foreach_step, they are later
	 * dropped by foreach_end together with the value lists. */ 
    {"foreach_step",	  1,    0,         0,	{OPERAND_NONE}},
	/* "Step" or begin next iteration of foreach loop. */
    {"foreach_end",	  1,    0,         0,	{OPERAND_NONE}},
    {"lmap_collect",	  1,    0,         0,	{OPERAND_NONE}},

    {NULL, 0, 0, 0, {OPERAND_NONE}}
};

/*
 * Prototypes for procedures defined later in this file:
 */







|
|







549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
    {"foreach_start",	  5,   +2,          1,	{OPERAND_AUX4}},
	/* Initialize execution of a foreach loop. Operand is aux data index
	 * of the ForeachInfo structure for the foreach command. It pushes 2
	 * elements which hold runtime params for foreach_step, they are later
	 * dropped by foreach_end together with the value lists. */ 
    {"foreach_step",	  1,    0,         0,	{OPERAND_NONE}},
	/* "Step" or begin next iteration of foreach loop. */
    {"foreach_end",	  1,     0,         0,	{OPERAND_NONE}},
    {"lmap_collect",	  1,    -1,         0,	{OPERAND_NONE}},

    {NULL, 0, 0, 0, {OPERAND_NONE}}
};

/*
 * Prototypes for procedures defined later in this file:
 */