diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-03-30 16:22:11 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-03-30 16:22:11 (GMT) |
commit | d7342e95b8185e47c027ad6a573b4242e5ca67c9 (patch) | |
tree | 513ad8ee17cc642e66403897bbb9188df51ee60b /generic/tclCompile.c | |
parent | 18687b718a2c5a3bc06cd3aea1c081fa25827009 (diff) | |
download | tcl-d7342e95b8185e47c027ad6a573b4242e5ca67c9.zip tcl-d7342e95b8185e47c027ad6a573b4242e5ca67c9.tar.gz tcl-d7342e95b8185e47c027ad6a573b4242e5ca67c9.tar.bz2 |
* generic/tclCompile.c: New instruction code INST_START_CMD
* generic/tclCompile.h: that allows checking the bytecode's
* generic/tclExecute.c: validity [Bug 729692] and the interp's
* tests/interp.test (18.9): readyness [Bug 495830] before running
* tests/proc.test (7.1): the command. It also changes the
* tests/rename.test (6.1): mechanics of the async tests in TEBC,
doing it now at command start instead of every 16 instructions.
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 22 |
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) { /* |