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)
commit724d7b20d49b89df2f76ef22181cca990e691478 (patch)
tree24228faa92eef9ebab05dc24c7c6a8bd63aeb9ae /generic/tclCompile.h
parentc339e592051bb83c9890a27b6709e3929489889b (diff)
downloadtcl-724d7b20d49b89df2f76ef22181cca990e691478.zip
tcl-724d7b20d49b89df2f76ef22181cca990e691478.tar.gz
tcl-724d7b20d49b89df2f76ef22181cca990e691478.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.