diff options
author | dgp <dgp@users.sourceforge.net> | 2013-06-05 11:59:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-06-05 11:59:30 (GMT) |
commit | a3bcf14641a499784548f9628f4482d238b3591b (patch) | |
tree | 0bbd99c9ea9075132267414b81e7921a13770ac7 /generic/tclCompCmds.c | |
parent | 28a8614f5b276169297b7e32ebdbbd429ee6773d (diff) | |
parent | 4265e044139d2dd3217a93741524cd31d7d4fa84 (diff) | |
download | tcl-a3bcf14641a499784548f9628f4482d238b3591b.zip tcl-a3bcf14641a499784548f9628f4482d238b3591b.tar.gz tcl-a3bcf14641a499784548f9628f4482d238b3591b.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r-- | generic/tclCompCmds.c | 70 |
1 files changed, 22 insertions, 48 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 304802f..1c09acb 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -513,37 +513,24 @@ TclCompileBreakCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_BREAK, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - auxPtr->stackDepth; - /* - * Pop off the extra stack frames. + * Found the target! No need for a nasty INST_BREAK here. */ - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); - toPop--; - } - - if (envPtr->expandCount == auxPtr->expandTarget) { - /* - * Found the target! Also, no built-up expansion stack. No need - * for a nasty INST_BREAK here. - */ + TclCleanupStackForBreakContinue(envPtr, auxPtr); + TclAddLoopBreakFixup(envPtr, auxPtr); + } else { + /* + * Emit a real break. + */ - TclAddLoopBreakFixup(envPtr, auxPtr); - goto done; - } + PushStringLiteral(envPtr, ""); + TclEmitOpcode(INST_DUP, envPtr); + TclEmitInstInt4(INST_RETURN_IMM, TCL_BREAK, envPtr); + TclEmitInt4(0, envPtr); } /* - * Emit a break instruction. - */ - - TclEmitOpcode(INST_BREAK, envPtr); - - done: - /* * Instructions that raise exceptions don't really have to follow the * usual stack management rules, but the cleanup code does. */ @@ -864,37 +851,24 @@ TclCompileContinueCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_CONTINUE, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - auxPtr->stackDepth; - /* - * Pop off the extra stack frames. + * Found the target! No need for a nasty INST_CONTINUE here. */ - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); - toPop--; - } - - if (envPtr->expandCount == auxPtr->expandTarget) { - /* - * Found the target! Also, no built-up expansion stack. No need - * for a nasty INST_CONTINUE here. - */ + TclCleanupStackForBreakContinue(envPtr, auxPtr); + TclAddLoopContinueFixup(envPtr, auxPtr); + } else { + /* + * Emit a real continue. + */ - TclAddLoopContinueFixup(envPtr, auxPtr); - goto done; - } + PushStringLiteral(envPtr, ""); + TclEmitOpcode(INST_DUP, envPtr); + TclEmitInstInt4(INST_RETURN_IMM, TCL_CONTINUE, envPtr); + TclEmitInt4(0, envPtr); } /* - * Emit a continue instruction. - */ - - TclEmitOpcode(INST_CONTINUE, envPtr); - - done: - /* * Instructions that raise exceptions don't really have to follow the * usual stack management rules, but the cleanup code does. */ |