From 039b5c21864604ac410777f49e11d9a11b255d06 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Jul 2014 21:23:45 +0000 Subject: Fix part of [d19aef1487] (broken --disable-load on MacOSX), broken by [4d417791c9] --- generic/tclLoadNone.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclLoadNone.c b/generic/tclLoadNone.c index c22c4c4..6cb4378 100644 --- a/generic/tclLoadNone.c +++ b/generic/tclLoadNone.c @@ -104,7 +104,9 @@ TclpLoadMemory( int size, /* Dummy: unused by this implementation */ int codeSize, /* Dummy: unused by this implementation */ Tcl_LoadHandle *loadHandle, /* Dummy: unused by this implementation */ - Tcl_FSUnloadFileProc **unloadProcPtr) + Tcl_FSUnloadFileProc **unloadProcPtr, + /* Dummy: unused by this implementation */ + int flags) /* Dummy: unused by this implementation */ { Tcl_SetObjResult(interp, Tcl_NewStringObj("dynamic loading from memory " -- cgit v0.12 From 374022fc5dab400eaec3c8af83d78f75e53a488f Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 1 Aug 2014 14:36:30 +0000 Subject: Correction and commentary in the details of ensemble compiling. --- generic/tclEnsemble.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 022dafa..763f5a0 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3019,8 +3019,24 @@ TclCompileEnsemble( cmdPtr = oldCmdPtr; depth--; } - (void) Tcl_ListObjReplace(NULL, replaced, depth, 2, 0, NULL); } + /* + * The length of the "replaced" list must be depth-1. Trim back + * any extra elements that might have been appended by failing + * pathways above. + */ + (void) Tcl_ListObjReplace(NULL, replaced, depth-1, INT_MAX, 0, NULL); + + /* + * TODO: Reconsider whether we ought to call CompileToInvokedCommand() + * when depth==1. In that case we are choosing to emit the + * INST_INVOKE_REPLACE bytecode when there is in fact no replacing + * to be done. It would be equally functional and presumably more + * performant to fall through to cleanup below, return TCL_ERROR, + * and let the compiler harness emit the INST_INVOKE_STK + * implementation for us. + */ + CompileToInvokedCommand(interp, parsePtr, replaced, cmdPtr, envPtr); ourResult = TCL_OK; } -- cgit v0.12 From d6128e2e73aa4d49417ff9beddd89216f0df77db Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 1 Aug 2014 16:01:30 +0000 Subject: [e75fabac06] Teardown line information after failed ensemble subcommand compile attempts. Copy/paste from CompileCmdCompileProc(). May be refactor opportunity here. --- generic/tclEnsemble.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 763f5a0..473c4bb 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2749,6 +2749,7 @@ TclCompileEnsemble( int ourResult = TCL_ERROR; unsigned numBytes; const char *word; + DefineLineInformation; Tcl_IncrRefCount(replaced); if (parsePtr->numWords < depth + 1) { @@ -3008,6 +3009,23 @@ TclCompileEnsemble( } /* + * Throw out any line information generated by the failed compile attempt. + */ + + while (mapPtr->nuloc - 1 > eclIndex) { + mapPtr->nuloc--; + ckfree(mapPtr->loc[mapPtr->nuloc].line); + mapPtr->loc[mapPtr->nuloc].line = NULL; + } + + /* + * Reset the index of next command. Toss out any from failed nested + * partial compiles. + */ + + envPtr->numCommands = mapPtr->nuloc; + + /* * Failed to do a full compile for some reason. Try to do a direct invoke * instead of going through the ensemble lookup process again. */ -- cgit v0.12