Compare commits
54
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13ef1cf7dd | ||
|
|
4d1c31595c | ||
|
|
c6a601218a | ||
|
|
200e6994c3 | ||
|
|
cb3ef498d7 | ||
|
|
f125eeb86e | ||
|
|
c63b2f08e0 | ||
|
|
e10a837108 | ||
|
|
950dd1945d | ||
|
|
3f1625e0e9 | ||
|
|
56a099f664 | ||
|
|
d7ad7cb438 | ||
|
|
bdb60f815e | ||
|
|
bf3f488989 | ||
|
|
9522800ec3 | ||
|
|
4639bb95bb | ||
|
|
b52ea3cedb | ||
|
|
226cb39a8b | ||
|
|
9fcbd30ea6 | ||
|
|
f1c5939b5e | ||
|
|
b05ec10b3b | ||
|
|
60d493021c | ||
|
|
69a57e77d2 | ||
|
|
936bce600d | ||
|
|
817548a251 | ||
|
|
da517832be | ||
|
|
00fa47f88b | ||
|
|
6e0e870c0b | ||
|
|
2fe7243297 | ||
|
|
577f909dd0 | ||
|
|
5238eb91f9 | ||
|
|
b70228c537 | ||
|
|
7800111ce9 | ||
|
|
1179a55b0b | ||
|
|
feea8024fb | ||
|
|
15ad0ff2f3 | ||
|
|
2231d4f8f1 | ||
|
|
708f97410d | ||
|
|
eae09f9b3d | ||
|
|
aab8a14ed7 | ||
|
|
239f08f04c | ||
|
|
d5a42fa9c0 | ||
|
|
b1a38c3e79 | ||
|
|
4f79cc95e6 | ||
|
|
15950a709c | ||
|
|
89760fbaf8 | ||
|
|
40f6d3ee82 | ||
|
|
cf0124589c | ||
|
|
120b9e8366 | ||
|
|
7c5c2954aa | ||
|
|
bf1b3702bd | ||
|
|
a71d301fff | ||
|
|
3ffeb15b98 | ||
|
|
d1ba3dff8f |
Regular → Executable
Regular → Executable
Regular → Executable
@@ -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
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user