summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.h
diff options
context:
space:
mode:
authormig <mig>2013-12-23 11:28:12 (GMT)
committermig <mig>2013-12-23 11:28:12 (GMT)
commit3b06f70775be10c7547c05c27e55d4ef0a65ee0c (patch)
tree24228faa92eef9ebab05dc24c7c6a8bd63aeb9ae /generic/tclCompile.h
parent4c7d267ddb333ab1d5b6caddfdd8803def611dd0 (diff)
downloadtcl-3b06f70775be10c7547c05c27e55d4ef0a65ee0c.zip
tcl-3b06f70775be10c7547c05c27e55d4ef0a65ee0c.tar.gz
tcl-3b06f70775be10c7547c05c27e55d4ef0a65ee0c.tar.bz2
Added new tools for managing and verifying the stack depth during compilation. Used it in some spots in the compiler and in TclCompileCatchCommand.
Diffstat (limited to 'generic/tclCompile.h')
-rw-r--r--generic/tclCompile.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 287ab1d..b3c8442 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1169,6 +1169,21 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
(envPtr)->currStackDepth += (delta); \
} while (0)
+#define TclGetStackDepth(envPtr) \
+ ((envPtr)->currStackDepth)
+
+#define TclSetStackDepth(depth, envPtr) \
+ (envPtr)->currStackDepth = (depth)
+
+#define TclCheckStackDepth(depth, envPtr) \
+ do { \
+ int dd = (depth); \
+ if (dd != (envPtr)->currStackDepth) { \
+ Tcl_Panic("bad stack depth computations: is %i, should be %i", \
+ (envPtr)->currStackDepth, dd); \
+ } \
+ } while (0)
+
/*
* Macro used to update the stack requirements. It is called by the macros
* TclEmitOpCode, TclEmitInst1 and TclEmitInst4.