summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2019-08-27 15:00:44 (GMT)
committersebres <sebres@users.sourceforge.net>2019-08-27 15:00:44 (GMT)
commit6a3d250548f9acc17013c28b36a7d1fc3490edd5 (patch)
tree6ff6a21eebd41f5f2c63ae5c592502b77325f4cf /generic/tclExecute.c
parent045b6322e8966c4321b829083490ae5d746f9a92 (diff)
downloadtcl-6a3d250548f9acc17013c28b36a7d1fc3490edd5.zip
tcl-6a3d250548f9acc17013c28b36a7d1fc3490edd5.tar.gz
tcl-6a3d250548f9acc17013c28b36a7d1fc3490edd5.tar.bz2
fixes [fa6bf38d07]: command invocation (NRE callback to TEBCResume) caused by execution of recompiled TEBC (on epoch bump)
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 832054e..873cac3 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2400,12 +2400,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;
@@ -2975,7 +2975,6 @@ TEBCresume(
* INVOCATION BLOCK
*/
- instEvalStk:
case INST_EVAL_STK:
bcFramePtr->data.tebc.pc = (char *) pc;
iPtr->cmdFramePtr = bcFramePtr;
@@ -8157,26 +8156,38 @@ 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);
pc += (opnd-1);
assert(bytes);
PUSH_OBJECT(Tcl_NewStringObj(bytes, length));
- goto instEvalStk;
+
+ bcFramePtr->data.tebc.pc = (char *) pc;
+ iPtr->cmdFramePtr = bcFramePtr;
+ cleanup = 1;
+ pc += 1;
+ /* yield next instruction */
+ TEBC_YIELD();
+ /* add TEBCResume for this command */
+ return TclNRExecuteByteCode(interp,
+ TclCompileObj(interp, OBJ_AT_TOS, NULL, 0));
}
}