summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-04-11 03:01:44 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-04-11 03:01:44 (GMT)
commit313e91a69ea14da7bb0994d3a3e5cc7ce1f54a71 (patch)
tree5a19598e25338336aae725507933721be433ccdd /generic
parent1f70d29a9eab0d6dd8b1942730691446b89b4fe0 (diff)
downloadtcl-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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c26
1 files changed, 15 insertions, 11 deletions
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;
}