Tcl Source Code

Check-in [378998b647]
Login

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

Overview
Comment:merge to pre-conflict
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-refactor
Files: files | file ages | folders
SHA1:378998b647579e20e7c170ed9be5e37382c68839
User & Date: dgp 2013-12-27 20:22:12
Context
2013-12-27
21:00
merge trunk check-in: 4eca9283c9 user: dgp tags: dgp-refactor
20:22
merge to pre-conflict check-in: 378998b647 user: dgp tags: dgp-refactor
20:16
resolve conflict in merge check-in: 0df9a9850e user: dgp tags: dgp-refactor
2013-12-22
14:11
remove unnecessary messing around INST_CONTINUE and INST_BREAK: local continue/break are already con... check-in: 6e3a672696 user: mig tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclCompCmds.c.

485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502

503
504
505
506
507
508
509
...
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
...
604
605
606
607
608
609
610

611
612
613
614
615
616
617
...
622
623
624
625
626
627
628
629
630




631
632
633
634
635
636
637
...
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743

744
745
746
747
748
749
750
    if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
	/*
	 * Found the target! No need for a nasty INST_BREAK here.
	 */

	TclCleanupStackForBreakContinue(envPtr, auxPtr);
	TclAddLoopBreakFixup(envPtr, auxPtr);
	TclAdjustStackDepth(1, envPtr);
    } else {
	/*
	 * Emit a real break.
	 */

	PushStringLiteral(envPtr, "");
	TclEmitOpcode(INST_DUP, envPtr);
	TclEmitInstInt4(INST_RETURN_IMM, TCL_BREAK, envPtr);
	TclEmitInt4(0, envPtr);
    }


    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
				 * created by Tcl_ParseCommand. */
    Command *cmdPtr,		/* Points to defintion of command being
				 * compiled. */
    CompileEnv *envPtr)		/* Holds resulting instructions. */
{
    JumpFixup jumpFixup;
    Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
    int resultIndex, optsIndex, range;
    DefineLineInformation;	/* TIP #280 */

    /*
     * If syntax does not match what we expect for [catch], do not compile.
     * Let runtime checks determine if syntax has changed.
     */

................................................................................
	SetLineInformation(1);
	CompileTokens(envPtr, cmdTokenPtr, interp);
	TclEmitInstInt4(	INST_BEGIN_CATCH4, range,	envPtr);
	ExceptionRangeStarts(envPtr, range);
	TclEmitOpcode(		INST_DUP,			envPtr);
	TclEmitInvoke(envPtr,	INST_EVAL_STK);
	/* drop the script */

	TclEmitInstInt4(	INST_REVERSE, 2,		envPtr);
	TclEmitOpcode(		INST_POP,			envPtr);
    }
    ExceptionRangeEnds(envPtr, range);

    /*
     * Emit the "no errors" epilogue: push "0" (TCL_OK) as the catch result,
................................................................................
    TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup);

    /* 
     * Emit the "error case" epilogue. Push the interpreter result and the
     * return code.
     */

    TclAdjustStackDepth(-2, envPtr);
    ExceptionRangeTarget(envPtr, range, catchOffset);




    /* Stack at this point is empty */
    TclEmitOpcode(		INST_PUSH_RESULT,		envPtr);
    TclEmitOpcode(		INST_PUSH_RETURN_CODE,		envPtr);

    /* Stack at this point on both branches: result returnCode */

    if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
................................................................................
    if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
	/*
	 * Found the target! No need for a nasty INST_CONTINUE here.
	 */

	TclCleanupStackForBreakContinue(envPtr, auxPtr);
	TclAddLoopContinueFixup(envPtr, auxPtr);
	TclAdjustStackDepth(1, envPtr);
    } else {
	/*
	 * Emit a real continue.
	 */

	PushStringLiteral(envPtr, "");
	TclEmitOpcode(INST_DUP, envPtr);
	TclEmitInstInt4(INST_RETURN_IMM, TCL_CONTINUE, envPtr);
	TclEmitInt4(0, envPtr);
    }


    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *







<





<
|
<
<

>







 







|







 







>







 







|

>
>
>
>







 







<





<
|
<
<

>







485
486
487
488
489
490
491

492
493
494
495
496

497


498
499
500
501
502
503
504
505
506
...
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
...
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
...
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
...
728
729
730
731
732
733
734

735
736
737
738
739

740


741
742
743
744
745
746
747
748
749
    if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
	/*
	 * Found the target! No need for a nasty INST_BREAK here.
	 */

	TclCleanupStackForBreakContinue(envPtr, auxPtr);
	TclAddLoopBreakFixup(envPtr, auxPtr);

    } else {
	/*
	 * Emit a real break.
	 */


	TclEmitOpcode(INST_BREAK, envPtr);


    }
    TclAdjustStackDepth(1, envPtr);

    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
				 * created by Tcl_ParseCommand. */
    Command *cmdPtr,		/* Points to defintion of command being
				 * compiled. */
    CompileEnv *envPtr)		/* Holds resulting instructions. */
{
    JumpFixup jumpFixup;
    Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
    int resultIndex, optsIndex, range, dropScript = 0;
    DefineLineInformation;	/* TIP #280 */

    /*
     * If syntax does not match what we expect for [catch], do not compile.
     * Let runtime checks determine if syntax has changed.
     */

................................................................................
	SetLineInformation(1);
	CompileTokens(envPtr, cmdTokenPtr, interp);
	TclEmitInstInt4(	INST_BEGIN_CATCH4, range,	envPtr);
	ExceptionRangeStarts(envPtr, range);
	TclEmitOpcode(		INST_DUP,			envPtr);
	TclEmitInvoke(envPtr,	INST_EVAL_STK);
	/* drop the script */
	dropScript = 1;
	TclEmitInstInt4(	INST_REVERSE, 2,		envPtr);
	TclEmitOpcode(		INST_POP,			envPtr);
    }
    ExceptionRangeEnds(envPtr, range);

    /*
     * Emit the "no errors" epilogue: push "0" (TCL_OK) as the catch result,
................................................................................
    TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup);

    /* 
     * Emit the "error case" epilogue. Push the interpreter result and the
     * return code.
     */

    TclAdjustStackDepth(-2 + dropScript, envPtr);
    ExceptionRangeTarget(envPtr, range, catchOffset);
    if (dropScript) {
	TclEmitOpcode(		INST_POP,			envPtr);
    }

    /* Stack at this point is empty */
    TclEmitOpcode(		INST_PUSH_RESULT,		envPtr);
    TclEmitOpcode(		INST_PUSH_RETURN_CODE,		envPtr);

    /* Stack at this point on both branches: result returnCode */

    if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
................................................................................
    if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) {
	/*
	 * Found the target! No need for a nasty INST_CONTINUE here.
	 */

	TclCleanupStackForBreakContinue(envPtr, auxPtr);
	TclAddLoopContinueFixup(envPtr, auxPtr);

    } else {
	/*
	 * Emit a real continue.
	 */


	TclEmitOpcode(INST_CONTINUE, envPtr);


    }
    TclAdjustStackDepth(1, envPtr);

    return TCL_OK;
}
 
/*
 *----------------------------------------------------------------------
 *