summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-29 13:28:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-29 13:28:32 (GMT)
commit4187ab8e37b22866a8b3a8727b9d661bca6378c8 (patch)
treeadefcd33b5268f2e85014860b1f8aca78237da6c /generic/tclExecute.c
parent4796062aab8a24df621cf33dbe862f72b36986f8 (diff)
parenta812c806619d185a0f16bfa431b848006ba98044 (diff)
downloadtcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.zip
tcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.tar.gz
tcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.tar.bz2
Merge tip-548
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index cf133c4..828d7d2 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2069,7 +2069,7 @@ TEBCresume(
int cleanup = PTR2INT(data[2]);
Tcl_Obj *objResultPtr;
- int checkInterp; /* Indicates when a check of interp readyness
+ int checkInterp = 0; /* Indicates when a check of interp readyness
* is necessary. Set by CACHE_STACK_INFO() */
/*
@@ -2104,7 +2104,6 @@ TEBCresume(
if (!pc) {
/* bytecode is starting from scratch */
- checkInterp = 0;
pc = codePtr->codeStart;
goto cleanup0;
} else {
@@ -2126,8 +2125,9 @@ TEBCresume(
goto abnormalReturn;
}
if (codePtr->flags & TCL_BYTECODE_RECOMPILE) {
- iPtr->flags |= ERR_ALREADY_LOGGED;
codePtr->flags &= ~TCL_BYTECODE_RECOMPILE;
+ checkInterp = 1;
+ iPtr->flags |= ERR_ALREADY_LOGGED;
}
if (result != TCL_OK) {
@@ -2187,10 +2187,12 @@ TEBCresume(
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
}
+ /* FALLTHRU */
case 2:
cleanup2_pushObjResultPtr:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 1:
cleanup1_pushObjResultPtr:
objPtr = OBJ_AT_TOS;
@@ -2207,14 +2209,17 @@ TEBCresume(
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
}
+ /* FALLTHRU */
case 2:
cleanup2:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 1:
cleanup1:
objPtr = POP_OBJECT();
TclDecrRefCount(objPtr);
+ /* FALLTHRU */
case 0:
/*
* We really want to do nothing now, but this is needed for some
@@ -2302,12 +2307,12 @@ TEBCresume(
iPtr->cmdCount += TclGetUInt4AtPtr(pc+5);
if (checkInterp) {
- checkInterp = 0;
if (((codePtr->compileEpoch != iPtr->compileEpoch) ||
(codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) &&
!(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) {
goto instStartCmdFailed;
}
+ checkInterp = 0;
}
inst = *(pc += 9);
goto peepholeStart;
@@ -2741,15 +2746,18 @@ TEBCresume(
* INVOCATION BLOCK
*/
- instEvalStk:
case INST_EVAL_STK:
+ instEvalStk:
bcFramePtr->data.tebc.pc = (char *) pc;
iPtr->cmdFramePtr = bcFramePtr;
cleanup = 1;
pc += 1;
+ /* yield next instruction */
TEBC_YIELD();
- return TclNREvalObjEx(interp, OBJ_AT_TOS, 0, NULL, 0);
+ /* add TEBCResume for object at top of stack */
+ return TclNRExecuteByteCode(interp,
+ TclCompileObj(interp, OBJ_AT_TOS, NULL, 0));
case INST_INVOKE_EXPANDED:
CLANG_ASSERT(auxObjList);
@@ -7766,19 +7774,22 @@ TEBCresume(
{
const char *bytes;
- checkInterp = 1;
length = 0;
+ if (TclInterpReady(interp) == TCL_ERROR) {
+ goto gotError;
+ }
+
/*
* We used to switch to direct eval; for NRE-awareness we now
* compile and eval the command so that this evaluation does not
- * add a new TEBC instance. [Bug 2910748]
+ * add a new TEBC instance. Bug [2910748], bug [fa6bf38d07]
+ *
+ * TODO: recompile, search this command and eval a code starting from,
+ * so that this evaluation does not add a new TEBC instance without
+ * NRE-trampoline.
*/
- if (TclInterpReady(interp) == TCL_ERROR) {
- goto gotError;
- }
-
codePtr->flags |= TCL_BYTECODE_RECOMPILE;
bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL);
opnd = TclGetUInt4AtPtr(pc+1);