diff options
author | dgp <dgp@users.sourceforge.net> | 2013-05-30 22:46:46 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-05-30 22:46:46 (GMT) |
commit | 7c5c2954aa4e7e3da4eb61000669cf7346d37141 (patch) | |
tree | 19b5c409b6694f6af86077b53b28733b074de2fe | |
parent | bf1b3702bd0029c2b00c5e864b5de5b2eb32d639 (diff) | |
download | tcl-7c5c2954aa4e7e3da4eb61000669cf7346d37141.zip tcl-7c5c2954aa4e7e3da4eb61000669cf7346d37141.tar.gz tcl-7c5c2954aa4e7e3da4eb61000669cf7346d37141.tar.bz2 |
Set up to (ab)use INST_EXPAND_STKTOP to debug compiler stack estimates.
-rw-r--r-- | generic/tclExecute.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 24b1dd2..6486206 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2726,6 +2726,18 @@ TEBCresume( int i; ptrdiff_t moved; +#ifdef TCL_COMPILE_DEBUG + /* + * This is how deep the compiler thought the stack would be, + * assuming no expansion. + */ + int estimate = TclGetInt4AtPtr(pc+1); + + if (CURR_DEPTH != estimate + auxObjList->length) { + Tcl_Panic("Bad stack estimate = %d; truth = %ld", estimate, + CURR_DEPTH - auxObjList->length); + } +#endif /* * Make sure that the element at stackTop is a list; if not, just * leave with an error. Note that the element from the expand list @@ -2747,8 +2759,8 @@ TEBCresume( * stack depth, as seen by the compiler. */ - if (objc > 1) { auxObjList->length += objc - 1; + if ((objc > 1) && (auxObjList->length > 0)) { length = auxObjList->length /* Total expansion room we need */ + codePtr->maxStackDepth /* Beyond the original max */ - CURR_DEPTH; /* Relative to where we are */ |