summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 6230e06..def4e4d 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.59 2004/03/29 02:09:46 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.60 2004/03/30 16:22:11 msofer Exp $
*/
#include "tclInt.h"
@@ -282,6 +282,9 @@ InstructionDesc tclInstructionTable[] = {
/* List Index: push (lindex stktop op4) */
{"listRangeImm", 9, 0, 2, {OPERAND_IDX4, OPERAND_IDX4}},
/* List Range: push (lrange stktop op4 op4) */
+
+ {"startCommand", 5, 0, 1, {OPERAND_UINT4}},
+ /* Start of bytecoded command: op is the length of the cmd's code */
{0}
};
@@ -1056,9 +1059,26 @@ TclCompileScript(interp, script, numBytes, envPtr)
unsigned int savedCodeNext =
envPtr->codeNext - envPtr->codeStart;
+ /*
+ * Mark the start of the command; the proper
+ * bytecode length will be updated later.
+ */
+
+ TclEmitInstInt4(INST_START_CMD, 0, envPtr);
+
code = (*(cmdPtr->compileProc))(interp, &parse,
envPtr);
+
if (code == TCL_OK) {
+ /*
+ * Fix the bytecode length.
+ */
+ unsigned char *fixPtr = envPtr->codeStart + savedCodeNext + 1;
+ unsigned int fixLen = envPtr->codeNext - envPtr->codeStart
+ - savedCodeNext;
+
+ TclStoreInt4AtPtr(fixLen, fixPtr);
+
goto finishCommand;
} else if (code == TCL_OUT_LINE_COMPILE) {
/*