summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-06-11 21:40:51 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-06-11 21:40:51 (GMT)
commitb3c4e60c817c71a12c34fe76fe885d7da894f7bf (patch)
treeb5d9794484df9b70530db129748b9d7fd44041ee /generic/tclCompile.c
parent6d413075c9b687f662acd3d1f4fcef7e34f386e7 (diff)
parent9ca9c6da3a55c6358a221f006c6cc846bd8d9922 (diff)
downloadtcl-b3c4e60c817c71a12c34fe76fe885d7da894f7bf.zip
tcl-b3c4e60c817c71a12c34fe76fe885d7da894f7bf.tar.gz
tcl-b3c4e60c817c71a12c34fe76fe885d7da894f7bf.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index f93bbad..da0e63e 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1214,7 +1214,12 @@ CompileSubstObj(
codePtr->localCachePtr = iPtr->varFramePtr->localCachePtr;
codePtr->localCachePtr->refCount++;
}
- /* TODO: Debug printing? */
+#ifdef TCL_COMPILE_DEBUG
+ if (tclTraceCompile >= 2) {
+ TclPrintByteCodeObj(interp, objPtr);
+ fflush(stdout);
+ }
+#endif /* TCL_COMPILE_DEBUG */
}
return codePtr;
}
@@ -1986,8 +1991,7 @@ TclCompileScript(
#ifdef TCL_COMPILE_DEBUG
int diff = envPtr->currStackDepth-startStackDepth;
- if (diff != 1 && (diff != 0 ||
- *(envPtr->codeNext-1) != INST_DONE)) {
+ if (diff != 1) {
Tcl_Panic("bad stack adjustment when compiling"
" %.*s (was %d instead of 1)",
parsePtr->tokenPtr->size,
@@ -2605,12 +2609,10 @@ TclCompileNoOp(
{
Tcl_Token *tokenPtr;
int i;
- int savedStackDepth = envPtr->currStackDepth;
tokenPtr = parsePtr->tokenPtr;
for (i = 1; i < parsePtr->numWords; i++) {
tokenPtr = tokenPtr + tokenPtr->numComponents + 1;
- envPtr->currStackDepth = savedStackDepth;
if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents,
@@ -2618,7 +2620,6 @@ TclCompileNoOp(
TclEmitOpcode(INST_POP, envPtr);
}
}
- envPtr->currStackDepth = savedStackDepth;
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
return TCL_OK;
}
@@ -3416,6 +3417,7 @@ TclCleanupStackForBreakContinue(
CompileEnv *envPtr,
ExceptionAux *auxPtr)
{
+ int savedStackDepth = envPtr->currStackDepth;
int toPop = envPtr->expandCount - auxPtr->expandTarget;
if (toPop > 0) {
@@ -3423,20 +3425,21 @@ TclCleanupStackForBreakContinue(
TclEmitOpcode(INST_EXPAND_DROP, envPtr);
toPop--;
}
+ TclAdjustStackDepth(auxPtr->expandTargetDepth - envPtr->currStackDepth,
+ envPtr);
toPop = auxPtr->expandTargetDepth - auxPtr->stackDepth;
while (toPop > 0) {
TclEmitOpcode(INST_POP, envPtr);
- TclAdjustStackDepth(1, envPtr);
toPop--;
}
} else {
toPop = envPtr->currStackDepth - auxPtr->stackDepth;
while (toPop > 0) {
TclEmitOpcode(INST_POP, envPtr);
- TclAdjustStackDepth(1, envPtr);
toPop--;
}
}
+ envPtr->currStackDepth = savedStackDepth;
}
/*