diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2007-04-11 03:01:44 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2007-04-11 03:01:44 (GMT) |
commit | 313e91a69ea14da7bb0994d3a3e5cc7ce1f54a71 (patch) | |
tree | 5a19598e25338336aae725507933721be433ccdd | |
parent | 1f70d29a9eab0d6dd8b1942730691446b89b4fe0 (diff) | |
download | tcl-313e91a69ea14da7bb0994d3a3e5cc7ce1f54a71.zip tcl-313e91a69ea14da7bb0994d3a3e5cc7ce1f54a71.tar.gz tcl-313e91a69ea14da7bb0994d3a3e5cc7ce1f54a71.tar.bz2 |
* generic/tclCompCmds.c: moved all exceptDepth management to the
macros - the decreasing half was managed by hand.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 26 |
2 files changed, 20 insertions, 11 deletions
@@ -1,3 +1,8 @@ +2007-04-11 Miguel Sofer <msofer@users.sf.net> + + * generic/tclCompCmds.c: moved all exceptDepth management to the + macros - the decreasing half was managed by hand. + 2007-04-10 Donal K. Fellows <donal.k.fellows@man.ac.uk> * generic/tclInt.h (TclNewLiteralStringObj): New macro to make diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 91344a5..4036ed0 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.105 2007/04/03 01:34:36 msofer Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.106 2007/04/11 03:01:44 msofer Exp $ */ #include "tclInt.h" @@ -105,6 +105,15 @@ ((envPtr)->codeNext - (envPtr)->codeStart) /* + */ + +/* + * Note: the exceptDepth is a bit of a misnomer: TEBC only needs the + * maximal depth of nested CATCH ranges in order to alloc runtime + * memory. These macros should compute precisely that? OTOH, the nesting depth + * of LOOP ranges is an interesting datum for debugging purposes, and that is + * what we compute now. + * * static int DeclareExceptionRange(CompileEnv *envPtr, int type); * static int ExceptionRangeStarts(CompileEnv *envPtr, int index); * static void ExceptionRangeEnds(CompileEnv *envPtr, int index); @@ -112,15 +121,16 @@ */ #define DeclareExceptionRange(envPtr, type) \ + (TclCreateExceptRange((type), (envPtr))) +#define ExceptionRangeStarts(envPtr, index) \ (((envPtr)->exceptDepth++), \ ((envPtr)->maxExceptDepth = \ TclMax((envPtr)->exceptDepth, (envPtr)->maxExceptDepth)), \ - (TclCreateExceptRange((type), (envPtr)))) -#define ExceptionRangeStarts(envPtr, index) \ - ((envPtr)->exceptArrayPtr[(index)].codeOffset = CurrentOffset(envPtr)) + ((envPtr)->exceptArrayPtr[(index)].codeOffset = CurrentOffset(envPtr))) #define ExceptionRangeEnds(envPtr, index) \ + (((envPtr)->exceptDepth--), \ ((envPtr)->exceptArrayPtr[(index)].numCodeBytes = \ - CurrentOffset(envPtr) - (envPtr)->exceptArrayPtr[(index)].codeOffset) + CurrentOffset(envPtr) - (envPtr)->exceptArrayPtr[(index)].codeOffset)) #define ExceptionRangeTarget(envPtr, index, targetType) \ ((envPtr)->exceptArrayPtr[(index)].targetType = CurrentOffset(envPtr)) @@ -523,7 +533,6 @@ TclCompileCatchCmd( TclEmitOpcode(INST_END_CATCH, envPtr); envPtr->currStackDepth = savedStackDepth + 1; - envPtr->exceptDepth--; return TCL_OK; } @@ -903,7 +912,6 @@ TclCompileDictCmd( TclUpdateInstInt4AtPc(INST_JUMP4, jumpDisplacement, envPtr->codeStart + endTargetOffset); PushLiteral(envPtr, "", 0); - envPtr->exceptDepth -= 2; return TCL_OK; } else if (size==6 && strncmp(cmd, "update", 6)==0) { const char *name; @@ -993,7 +1001,6 @@ TclCompileDictCmd( TclEmitOpcode( INST_PUSH_RETURN_OPTIONS, envPtr); TclEmitOpcode( INST_PUSH_RESULT, envPtr); TclEmitOpcode( INST_END_CATCH, envPtr); - envPtr->exceptDepth--; TclEmitInstInt4( INST_LOAD_SCALAR4, keyTmpIndex, envPtr); @@ -1345,7 +1352,6 @@ TclCompileForCmd( envPtr->currStackDepth = savedStackDepth; PushLiteral(envPtr, "", 0); - envPtr->exceptDepth--; return TCL_OK; } @@ -1664,7 +1670,6 @@ TclCompileForeachCmd( } TclStackFree(interp); /* varvList */ TclStackFree(interp); /* varcList */ - envPtr->exceptDepth--; return code; } @@ -4460,7 +4465,6 @@ TclCompileWhileCmd( pushResult: envPtr->currStackDepth = savedStackDepth; PushLiteral(envPtr, "", 0); - envPtr->exceptDepth--; return TCL_OK; } |