Compare commits

...
Author SHA1 Message Date
dgp 13ef1cf7dd Report pc value when VERIFY fails. 2013-10-23 15:34:57 +00:00
dgp 4d1c31595c Avoid stack verificaton steps in macros when called by assembler. It uses
them differently.  Also suspend optimization pass.
2013-10-23 14:58:04 +00:00
dgp c6a601218a Merge assemble revert. 2013-10-22 20:11:59 +00:00
dgp 200e6994c3 merge trunk 2013-10-22 17:37:53 +00:00
dgp cb3ef498d7 Complete the repair on the INST_POP removal. 2013-10-22 17:17:39 +00:00
dgp f125eeb86e Conditionalize size of INST_POP removal. 2013-10-22 14:53:00 +00:00
dgp c63b2f08e0 Merge e9c8ef 2013-10-22 14:30:59 +00:00
dgp e10a837108 Merge 15882 2013-10-22 12:53:13 +00:00
dgp 950dd1945d Merge 78341 2013-10-22 12:42:47 +00:00
dgp 3f1625e0e9 Merge d1cc50 2013-10-22 12:24:31 +00:00
dgp 56a099f664 Merge af7ffd 2013-10-22 12:10:36 +00:00
dgp d7ad7cb438 Merge 2718a16 2013-10-22 04:39:58 +00:00
dgp bdb60f815e Merge to TCS rewrite merge point. 2013-10-21 22:59:44 +00:00
dgp bf3f488989 Merge 97f680 2013-10-21 21:32:26 +00:00
dgp 9522800ec3 Merge to pre-TCS branch. 2013-10-21 19:47:25 +00:00
dgp 4639bb95bb Leave behind the stack depth estimate testing machinery in this branch. It verifies
instruction by instruction that the stack depth estimated by the compiler is matched
by the stack depth at execution time.  Use a --enable-symbols=all build to perform
the testing.  In this checkin, a pass through the test suite validates all but
the assembler.
2013-06-11 23:05:30 +00:00
dgp b52ea3cedb merge trunk 2013-06-11 20:45:51 +00:00
dgp 226cb39a8b merge trunk 2013-06-11 19:51:10 +00:00
dgp 9fcbd30ea6 Make compiled [if] stack depth estimation simpler and more accurate. 2013-06-11 19:21:17 +00:00
dgp f1c5939b5e merge trunk 2013-06-11 18:10:08 +00:00
dgp b05ec10b3b simpler stack management 2013-06-11 16:57:10 +00:00
dgp 60d493021c More tidying of stack management code. 2013-06-11 05:26:04 +00:00
dgp 69a57e77d2 Tidy up the stack depth management code. 2013-06-11 04:54:03 +00:00
dgp 936bce600d Fix stack estimates for INST_EXPAND_DROP. 2013-06-10 16:25:48 +00:00
dgp 817548a251 Repair stack estimates. 2013-06-10 15:24:54 +00:00
dgp da517832be Merge trunk (creates new stack estimate breakage). 2013-06-10 04:09:34 +00:00
dgp 00fa47f88b undo mistaken commit 2013-06-10 03:29:18 +00:00
dgp 6e0e870c0b merge near trunk 2013-06-10 03:25:22 +00:00
dgp 2fe7243297 merge trunk 2013-06-07 15:26:19 +00:00
dgp 577f909dd0 Repaid debug compile of [array unset]. 2013-06-07 04:24:41 +00:00
dgp 5238eb91f9 Repair debug compile of [info commands]. 2013-06-07 04:09:07 +00:00
dgp b70228c537 Fix up the stack estimates for dict.test again 2013-06-06 23:26:39 +00:00
dgp 7800111ce9 merge trunk 2013-06-06 22:15:17 +00:00
dgp 1179a55b0b Progress getting more stack estimates correct. Exceptions are still the hard part. 2013-06-06 19:29:11 +00:00
dgp feea8024fb Stack estimates corrected for dict.test 2013-06-06 18:24:25 +00:00
dgp 15ad0ff2f3 merge trunk 2013-06-06 17:24:01 +00:00
dgp 2231d4f8f1 merge trunk 2013-06-06 10:51:51 +00:00
dkf 708f97410d merge trunk 2013-06-05 21:44:10 +00:00
dgp eae09f9b3d debug reporting fix 2013-06-05 20:25:32 +00:00
dgp aab8a14ed7 Progress fixing up the stack management of compiled [dict]. 2013-06-05 20:15:08 +00:00
dgp 239f08f04c Get stack depth adjustments right for INST_DONE opimized [return] compile. 2013-06-05 18:12:12 +00:00
dgp d5a42fa9c0 Compiled [subst] properly track stack adjustments. 2013-06-05 17:23:23 +00:00
dgp b1a38c3e79 Debug printing for [subst] compiles 2013-06-05 16:09:15 +00:00
dgp 4f79cc95e6 Repair merge of instruction table 2013-06-05 16:07:31 +00:00
dgp 15950a709c Get a proper merge from the trunk going again. 2013-06-05 15:35:54 +00:00
dgp 89760fbaf8 repair error.test 2013-06-03 22:43:06 +00:00
dgp 40f6d3ee82 merge trunk 2013-06-03 22:38:33 +00:00
dgp cf0124589c Work in progress auditing the stack usage estimates of the bytecode
compiler routines.  Much of this code is ugly and will never find a
place on the trunk, but the problems it pinpoints will be fixed there.

This is now at the point where the test suite of a --enable-symbols=all
build will usefully panic on those tests where stack estimates are
not correct (or where the auditing code itself is still faulty).
2013-06-01 04:05:14 +00:00
dgp 120b9e8366 Experimental super-stack-estimate checker. 2013-05-30 23:29:30 +00:00
dgp 7c5c2954aa Set up to (ab)use INST_EXPAND_STKTOP to debug compiler stack estimates. 2013-05-30 22:46:46 +00:00
dgp bf1b3702bd Tighten up expansion a bit. 2013-05-30 20:37:44 +00:00
dgp a71d301fff Back on track. 2013-05-30 20:03:03 +00:00
dgp 3ffeb15b98 Oops! Don't forget nested script substitution! 2013-05-30 18:58:38 +00:00
dgp d1ba3dff8f More robust expansion calculation. Look Ma! No operand! 2013-05-30 18:51:44 +00:00
163 changed files with 222 additions and 108 deletions
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+4 -2
View File
@@ -28,6 +28,8 @@
*- returnCodeBranch
*/
#define TCL_ASSEMBLE
#include "tclInt.h"
#include "tclCompile.h"
#include "tclOOInt.h"
@@ -1363,7 +1365,7 @@ AssembleOneLine(
|| CheckStrictlyPositive(interp, opnd) != TCL_OK) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd+1);
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd+1, opnd+1);
break;
case ASSEM_DICT_SET:
@@ -1379,7 +1381,7 @@ AssembleOneLine(
if (localVar < 0) {
goto cleanup;
}
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd, opnd+1);
BBEmitInstInt4(assemEnvPtr, tblIdx, opnd+1, opnd+1);
TclEmitInt4(localVar, envPtr);
break;
+56 -22
View File
@@ -303,9 +303,17 @@ TclCompileArraySetCmd(
} else {
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr);
TclEmitInstInt1(INST_JUMP_TRUE1, 5, envPtr);
TclEmitInstInt1(INST_JUMP_TRUE1, 5
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
TclEmitOpcode( INST_ARRAY_MAKE_STK, envPtr);
TclEmitInstInt1(INST_JUMP1, 3, envPtr);
TclEmitInstInt1(INST_JUMP1, 3
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
/* Each branch decrements stack depth, but we only take one. */
TclAdjustStackDepth(1, envPtr);
TclEmitOpcode( INST_POP, envPtr);
@@ -383,7 +391,11 @@ TclCompileArraySetCmd(
} else {
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr);
TclEmitInstInt1(INST_JUMP_TRUE1, 4, envPtr);
TclEmitInstInt1(INST_JUMP_TRUE1, 4
#ifdef TCL_COMPILE_DEBUG
+15
#endif
, envPtr);
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_ARRAY_MAKE_STK, envPtr);
TclEmitInstInt4(INST_FOREACH_START4, infoIndex, envPtr);
@@ -437,15 +449,27 @@ TclCompileArrayUnsetCmd(
if (localIndex >= 0) {
TclEmitInstInt4(INST_ARRAY_EXISTS_IMM, localIndex, envPtr);
TclEmitInstInt1(INST_JUMP_FALSE1, 8, envPtr);
TclEmitInstInt1(INST_JUMP_FALSE1, 8
#ifdef TCL_COMPILE_DEBUG
+5
#endif
, envPtr);
TclEmitInstInt1(INST_UNSET_SCALAR, 1, envPtr);
TclEmitInt4( localIndex, envPtr);
} else {
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr);
TclEmitInstInt1(INST_JUMP_FALSE1, 6, envPtr);
TclEmitInstInt1(INST_JUMP_FALSE1, 6
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
TclEmitInstInt1(INST_UNSET_STK, 1, envPtr);
TclEmitInstInt1(INST_JUMP1, 3, envPtr);
TclEmitInstInt1(INST_JUMP1, 3
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
/* Each branch decrements stack depth, but we only take one. */
TclAdjustStackDepth(1, envPtr);
TclEmitOpcode( INST_POP, envPtr);
@@ -637,7 +661,11 @@ TclCompileCatchCmd(
TclEmitOpcode( INST_POP, envPtr);
PushStringLiteral(envPtr, "0");
TclEmitInstInt1( INST_JUMP1, 3, envPtr);
TclEmitInstInt1( INST_JUMP1, 3
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
TclAdjustStackDepth(-1, envPtr);
ExceptionRangeTarget(envPtr, range, catchOffset);
TclEmitOpcode( INST_PUSH_RETURN_CODE, envPtr);
@@ -877,9 +905,8 @@ TclCompileDictSetCmd(
* Now emit the instruction to do the dict manipulation.
*/
TclEmitInstInt4( INST_DICT_SET, parsePtr->numWords-3, envPtr);
TclEmitInstInt4( INST_DICT_SET, parsePtr->numWords-2, envPtr);
TclEmitInt4( dictVarIndex, envPtr);
TclAdjustStackDepth(-1, envPtr);
return TCL_OK;
}
@@ -987,8 +1014,7 @@ TclCompileDictGetCmd(
CompileWord(envPtr, tokenPtr, interp, i);
tokenPtr = TokenAfter(tokenPtr);
}
TclEmitInstInt4(INST_DICT_GET, parsePtr->numWords-2, envPtr);
TclAdjustStackDepth(-1, envPtr);
TclEmitInstInt4(INST_DICT_GET, parsePtr->numWords-1, envPtr);
return TCL_OK;
}
@@ -1024,8 +1050,7 @@ TclCompileDictExistsCmd(
CompileWord(envPtr, tokenPtr, interp, i);
tokenPtr = TokenAfter(tokenPtr);
}
TclEmitInstInt4(INST_DICT_EXISTS, parsePtr->numWords-2, envPtr);
TclAdjustStackDepth(-1, envPtr);
TclEmitInstInt4(INST_DICT_EXISTS, parsePtr->numWords-1, envPtr);
return TCL_OK;
}
@@ -1164,9 +1189,8 @@ TclCompileDictCreateCmd(
tokenPtr = TokenAfter(tokenPtr);
CompileWord(envPtr, tokenPtr, interp, i+1);
tokenPtr = TokenAfter(tokenPtr);
TclEmitInstInt4( INST_DICT_SET, 1, envPtr);
TclEmitInstInt4( INST_DICT_SET, 2, envPtr);
TclEmitInt4( worker, envPtr);
TclAdjustStackDepth(-1, envPtr);
TclEmitOpcode( INST_POP, envPtr);
}
Emit14Inst( INST_LOAD_SCALAR, worker, envPtr);
@@ -1245,14 +1269,21 @@ TclCompileDictMergeCmd(
tokenPtr = TokenAfter(tokenPtr);
CompileWord(envPtr, tokenPtr, interp, i);
TclEmitInstInt4( INST_DICT_FIRST, infoIndex, envPtr);
TclEmitInstInt1( INST_JUMP_TRUE1, 24, envPtr);
TclEmitInstInt1( INST_JUMP_TRUE1, 24
#ifdef TCL_COMPILE_DEBUG
+25
#endif
, envPtr);
TclEmitInstInt4( INST_REVERSE, 2, envPtr);
TclEmitInstInt4( INST_DICT_SET, 1, envPtr);
TclEmitInstInt4( INST_DICT_SET, 2, envPtr);
TclEmitInt4( workerIndex, envPtr);
TclAdjustStackDepth(-1, envPtr);
TclEmitOpcode( INST_POP, envPtr);
TclEmitInstInt4( INST_DICT_NEXT, infoIndex, envPtr);
TclEmitInstInt1( INST_JUMP_FALSE1, -20, envPtr);
TclEmitInstInt1( INST_JUMP_FALSE1, -20
#ifdef TCL_COMPILE_DEBUG
-15
#endif
, envPtr);
TclEmitOpcode( INST_POP, envPtr);
TclEmitOpcode( INST_POP, envPtr);
TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr);
@@ -1268,7 +1299,11 @@ TclCompileDictMergeCmd(
Emit14Inst( INST_LOAD_SCALAR, workerIndex, envPtr);
TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr);
TclEmitInt4( workerIndex, envPtr);
TclEmitInstInt1( INST_JUMP1, 18, envPtr);
TclEmitInstInt1( INST_JUMP1, 18
#ifdef TCL_COMPILE_DEBUG
+20
#endif
, envPtr);
/*
* If an exception happens when starting to iterate over the second (and
@@ -1463,9 +1498,8 @@ CompileDictEachCmd(
if (collect == TCL_EACH_COLLECT) {
Emit14Inst( INST_LOAD_SCALAR, keyVarIndex, envPtr);
TclEmitInstInt4(INST_OVER, 1, envPtr);
TclEmitInstInt4(INST_DICT_SET, 1, envPtr);
TclEmitInstInt4(INST_DICT_SET, 2, envPtr);
TclEmitInt4( collectVar, envPtr);
TclAdjustStackDepth(-1, envPtr);
TclEmitOpcode( INST_POP, envPtr);
}
TclEmitOpcode( INST_POP, envPtr);
+5 -1
View File
@@ -592,7 +592,11 @@ TclCompileInfoCommandsCmd(
TclEmitOpcode( INST_RESOLVE_COMMAND, envPtr);
TclEmitOpcode( INST_DUP, envPtr);
TclEmitOpcode( INST_STR_LEN, envPtr);
TclEmitInstInt1( INST_JUMP_FALSE1, 7, envPtr);
TclEmitInstInt1( INST_JUMP_FALSE1, 7
#ifdef TCL_COMPILE_DEBUG
+10
#endif
, envPtr);
TclEmitInstInt4( INST_LIST, 1, envPtr);
return TCL_OK;
+30 -15
View File
@@ -1965,7 +1965,11 @@ TclCompileThrowCmd(
OP4( REVERSE, 3);
OP( DUP);
OP( LIST_LENGTH);
OP1( JUMP_FALSE1, 16);
OP1( JUMP_FALSE1, 16
#ifdef TCL_COMPILE_DEBUG
+20
#endif
);
OP4( LIST, 2);
OP44( RETURN_IMM, TCL_ERROR, 0);
TclAdjustStackDepth(2, envPtr);
@@ -2286,7 +2290,11 @@ IssueTryClausesInstructions(
} else {
PUSH( "0");
OP4( REVERSE, 2);
OP1( JUMP1, 4);
OP1( JUMP1, 4
#ifdef TCL_COMPILE_DEBUG
+10
#endif
);
TclAdjustStackDepth(-2, envPtr);
}
ExceptionRangeTarget(envPtr, range, catchOffset);
@@ -2327,8 +2335,7 @@ IssueTryClausesInstructions(
LOAD( optionsVar);
PUSH( "-errorcode");
OP4( DICT_GET, 1);
TclAdjustStackDepth(-1, envPtr);
OP4( DICT_GET, 2);
OP44( LIST_RANGE_IMM, 0, len-1);
p = Tcl_GetStringFromObj(matchClauses[i], &len);
PushLiteral(envPtr, p, len);
@@ -2394,8 +2401,7 @@ IssueTryClausesInstructions(
OP( POP);
PUSH( "-during");
OP4( REVERSE, 2);
OP44( DICT_SET, 1, optionsVar);
TclAdjustStackDepth(-1, envPtr);
OP44( DICT_SET, 2, optionsVar);
FIXJUMP1( dontChangeOptions);
OP4( REVERSE, 2);
INVOKE( RETURN_STK);
@@ -2497,7 +2503,11 @@ IssueTryClausesFinallyInstructions(
} else {
PUSH( "0");
OP4( REVERSE, 2);
OP1( JUMP1, 4);
OP1( JUMP1, 4
#ifdef TCL_COMPILE_DEBUG
+15
#endif
);
TclAdjustStackDepth(-2, envPtr);
}
ExceptionRangeTarget(envPtr, range, catchOffset);
@@ -2537,8 +2547,7 @@ IssueTryClausesFinallyInstructions(
LOAD( optionsVar);
PUSH( "-errorcode");
OP4( DICT_GET, 1);
TclAdjustStackDepth(-1, envPtr);
OP4( DICT_GET, 2);
OP44( LIST_RANGE_IMM, 0, len-1);
p = Tcl_GetStringFromObj(matchClauses[i], &len);
PushLiteral(envPtr, p, len);
@@ -2618,7 +2627,11 @@ IssueTryClausesFinallyInstructions(
PUSH( "0");
OP( PUSH_RETURN_OPTIONS);
OP4( REVERSE, 3);
OP1( JUMP1, 5);
OP1( JUMP1, 5
#ifdef TCL_COMPILE_DEBUG
+20
#endif
);
TclAdjustStackDepth(-3, envPtr);
forwardsToFix[i] = -1;
@@ -2645,8 +2658,7 @@ IssueTryClausesFinallyInstructions(
OP4( REVERSE, 3);
STORE( optionsVar);
OP( POP);
OP44( DICT_SET, 1, optionsVar);
TclAdjustStackDepth(-1, envPtr);
OP44( DICT_SET, 2, optionsVar);
JUMP1( JUMP, trapError);
FIXJUMP1( noTrapError);
STORE( optionsVar);
@@ -2712,8 +2724,7 @@ IssueTryClausesFinallyInstructions(
OP4( REVERSE, 3);
STORE( optionsVar);
OP( POP);
OP44( DICT_SET, 1, optionsVar);
TclAdjustStackDepth(-1, envPtr);
OP44( DICT_SET, 2, optionsVar);
OP( POP);
JUMP1( JUMP, finalError);
TclAdjustStackDepth(1, envPtr);
@@ -2751,7 +2762,11 @@ IssueTryFinallyInstructions(
ExceptionRangeStarts(envPtr, range);
BODY( bodyToken, 1);
ExceptionRangeEnds(envPtr, range);
OP1( JUMP1, 3);
OP1( JUMP1, 3
#ifdef TCL_COMPILE_DEBUG
+10
#endif
);
TclAdjustStackDepth(-1, envPtr);
ExceptionRangeTarget(envPtr, range, catchOffset);
OP( PUSH_RESULT);
+11 -4
View File
@@ -540,11 +540,14 @@ InstructionDesc const tclInstructionTable[] = {
/* Concatenates the two lists at the top of the stack into a single
* list and pushes that resulting list onto the stack.
* Stack: ... list1 list2 => ... [lconcat list1 list2] */
{"expandDrop", 1, 0, 0, {OPERAND_NONE}},
/* Drops an element from the auxiliary stack, popping stack elements
* until the matching stack depth is reached. */
{"verify", 5, 0, 1, {OPERAND_UINT4}},
/* Verify the predicted stack depth (operand) is true during
* bytecode execution. */
{NULL, 0, 0, 0, {OPERAND_NONE}}
};
@@ -732,7 +735,7 @@ TclSetByteCodeFromAny(
* faster code in some cases, and more compact code in more.
*/
if (Tcl_GetMaster(interp) == NULL &&
if (0 && Tcl_GetMaster(interp) == NULL &&
!Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME)
&& IsCompactibleCompileEnv(interp, &compEnv)) {
TclFreeCompileEnv(&compEnv);
@@ -2119,6 +2122,10 @@ TclCompileScript(
envPtr->cmdMapPtr[lastCmdIdx].numCodeBytes--;
envPtr->codeNext--;
#ifdef TCL_COMPILE_DEBUG
envPtr->cmdMapPtr[lastCmdIdx].numCodeBytes -= 5;
envPtr->codeNext -= 5;
#endif
envPtr->currStackDepth++;
}
}
@@ -4019,9 +4026,9 @@ TclEmitInvoke(
TclEmitOpcode(INST_RETURN_STK, envPtr);
break;
case INST_INVOKE_REPLACE:
TclEmitInstInt4(INST_INVOKE_REPLACE, arg1, envPtr);
TclEmitInstInt4(INST_INVOKE_REPLACE, arg1+1, envPtr);
TclEmitInt1(arg2, envPtr);
TclAdjustStackDepth(-1, envPtr); /* Correction to stack depth calcs */
// TclAdjustStackDepth(-1, envPtr); /* Correction to stack depth calcs */
break;
}
+73 -1
View File
@@ -768,8 +768,10 @@ typedef struct ByteCode {
#define INST_EXPAND_DROP 165
#define INST_VERIFY 166
/* The last opcode */
#define LAST_INST_OPCODE 165
#define LAST_INST_OPCODE 166
/*
* Table describing the Tcl bytecode instructions: their name (for displaying
@@ -1153,6 +1155,27 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
* void TclAdjustStackDepth(int delta, CompileEnv *envPtr);
*/
#if defined(TCL_COMPILE_DEBUG)
#define VerifyStackDepth(envPtr) \
do { \
int i = (envPtr)->currStackDepth; \
if (((envPtr)->codeNext + 5) > (envPtr)->codeEnd) { \
TclExpandCodeArray(envPtr); \
} \
*(envPtr)->codeNext++ = (unsigned char) INST_VERIFY; \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 24); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 16); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 8); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) ); \
} while (0)
#else
#define VerifyStackDepth(envPtr)
#endif
#define TclAdjustStackDepth(delta, envPtr) \
do { \
if ((delta) < 0) { \
@@ -1161,6 +1184,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
} \
} \
(envPtr)->currStackDepth += (delta); \
VerifyStackDepth(envPtr); \
} while (0)
/*
@@ -1221,6 +1245,23 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
* void TclEmitInt4(int i, CompileEnv *envPtr);
*/
#if defined(TCL_COMPILE_DEBUG) && !defined(TCL_ASSEMBLE)
#define TclEmitInt1(i, envPtr) \
do { \
if ((envPtr)->codeNext == (envPtr)->codeEnd) { \
TclExpandCodeArray(envPtr); \
} \
if ((envPtr)->codeNext[-5] == INST_VERIFY) { \
memmove((envPtr)->codeNext-4, (envPtr)->codeNext-5, 5); \
(envPtr)->codeNext[-5] = \
(unsigned char) ((unsigned int) (i)); \
(envPtr)->codeNext++; \
break; \
} \
*(envPtr)->codeNext++ = (unsigned char) ((unsigned int) (i)); \
} while (0)
#else
#define TclEmitInt1(i, envPtr) \
do { \
if ((envPtr)->codeNext == (envPtr)->codeEnd) { \
@@ -1228,7 +1269,37 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
} \
*(envPtr)->codeNext++ = (unsigned char) ((unsigned int) (i)); \
} while (0)
#endif
#if defined(TCL_COMPILE_DEBUG) && !defined(TCL_ASSEMBLE)
#define TclEmitInt4(i, envPtr) \
do { \
if (((envPtr)->codeNext + 4) > (envPtr)->codeEnd) { \
TclExpandCodeArray(envPtr); \
} \
if ((envPtr)->codeNext[-5] == INST_VERIFY) { \
memmove((envPtr)->codeNext-1, (envPtr)->codeNext-5, 5); \
(envPtr)->codeNext[-5] = \
(unsigned char) ((unsigned int) (i) >> 24); \
(envPtr)->codeNext[-4] = \
(unsigned char) ((unsigned int) (i) >> 16); \
(envPtr)->codeNext[-3] = \
(unsigned char) ((unsigned int) (i) >> 8); \
(envPtr)->codeNext[-2] = \
(unsigned char) ((unsigned int) (i) ); \
(envPtr)->codeNext += 4; \
break; \
} \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 24); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 16); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) >> 8); \
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) ); \
} while (0)
#else
#define TclEmitInt4(i, envPtr) \
do { \
if (((envPtr)->codeNext + 4) > (envPtr)->codeEnd) { \
@@ -1243,6 +1314,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
*(envPtr)->codeNext++ = \
(unsigned char) ((unsigned int) (i) ); \
} while (0)
#endif
/*
* Macros to emit an instruction with signed or unsigned integer operands.
+43 -5
View File
@@ -1543,7 +1543,7 @@ CompileExprObj(
codePtr->localCachePtr->refCount++;
}
#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile == 2) {
if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
fflush(stdout);
}
@@ -2732,6 +2732,23 @@ TEBCresume(
PUSH_TAUX_OBJ(objPtr);
NEXT_INST_F(1, 0, 0);
case INST_VERIFY : {
#ifdef TCL_COMPILE_DEBUG
/*
* This is how deep the compiler thought the stack would be,
* assuming no expansion.
*/
int estimate = TclGetUInt4AtPtr(pc+1);
if (CURR_DEPTH != estimate + (auxObjList ? auxObjList->length : 0)) {
Tcl_Panic("(%d) Bad stack estimate = %d; truth = %ld",
(int)(pc - TD->pc), estimate,
CURR_DEPTH - (auxObjList ? auxObjList->length : 0));
}
#endif
NEXT_INST_F(5, 0, 0);
}
case INST_EXPAND_DROP:
/*
* Drops an element of the auxObjList, popping stack elements to
@@ -2752,6 +2769,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
@@ -2997,7 +3026,7 @@ TEBCresume(
#endif
case INST_INVOKE_REPLACE:
objc = TclGetUInt4AtPtr(pc+1);
objc = TclGetUInt4AtPtr(pc+1) - 1;
opnd = TclGetUInt1AtPtr(pc+5);
objPtr = POP_OBJECT();
objv = &OBJ_AT_DEPTH(objc-1);
@@ -6175,6 +6204,11 @@ TEBCresume(
*/
pc += 5;
#ifdef TCL_COMPILE_DEBUG
if (*pc == INST_VERIFY) {
pc +=5;
}
#endif
if (*pc == INST_JUMP_FALSE1) {
NEXT_INST_F((continueLoop? 2 : TclGetInt1AtPtr(pc+1)), 0, 0);
} else {
@@ -6241,7 +6275,11 @@ TEBCresume(
if (code < TCL_ERROR || code > TCL_CONTINUE) {
code = TCL_CONTINUE + 1;
}
NEXT_INST_F(2*code -1, 1, 0);
NEXT_INST_F(2*code -1
#ifdef TCL_COMPILE_DEBUG
+ (code != TCL_ERROR)*10
#endif
, 1, 0);
}
/*
@@ -6271,7 +6309,7 @@ TEBCresume(
case INST_DICT_EXISTS: {
register Tcl_Interp *interp2 = interp;
opnd = TclGetUInt4AtPtr(pc+1);
opnd = TclGetUInt4AtPtr(pc+1) - 1;
TRACE(("%u => ", opnd));
dictPtr = OBJ_AT_DEPTH(opnd);
if (*pc == INST_DICT_EXISTS) {
@@ -6327,7 +6365,7 @@ TEBCresume(
case INST_DICT_SET:
case INST_DICT_UNSET:
case INST_DICT_INCR_IMM:
opnd = TclGetUInt4AtPtr(pc+1);
opnd = TclGetUInt4AtPtr(pc+1) - (*pc == INST_DICT_SET);
opnd2 = TclGetUInt4AtPtr(pc+5);
varPtr = LOCAL(opnd2);
Regular → Executable
View File
-58
View File
@@ -1,58 +0,0 @@
/*
* tclStubLibTbl.c --
*
* Stub object that will be statically linked into extensions that want
* to access Tcl.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tclInt.h"
/*
*----------------------------------------------------------------------
*
* TclInitStubTable --
*
* Initialize the stub table, using the structure pointed at
* by the "version" argument.
*
* Results:
* Outputs the value of the "version" argument.
*
* Side effects:
* Sets the stub table pointers.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE const char *
TclInitStubTable(
const char *version) /* points to the version field of a
TclStubInfoType structure variable. */
{
tclStubsPtr = ((const TclStubInfoType *) version)->stubs;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
} else {
tclPlatStubsPtr = NULL;
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
return version;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File

Some files were not shown because too many files have changed in this diff Show More