Skip to content
Tcl Source Code View Ticket
Login

View Ticket

bad stack depth computations: is 0, should be 1

Closedb8da19fd1658fed8e370a4f9b458e2c189022135Created 8 years agoUpdated 8 years ago
Descriptionplain2018-12-04 09:25:56
Hi,

Getting error during TCL upgrade from 8.4 to 8.6
We had added few New mathematics operator in TCL8.4 and working fine.
But now i am porting TCL to 8.6 and getting "bad stack depth computations: is 0, should be 1" error.

If modify "tclInstructionTable" value field as mention below. it working fine.

in TCL porting to 8.4 used 
    {"error",             0,  0,          0,   {OPERAND_NONE}},
in TCL porting to 8.6 
     {"error",            1,  0,          0,   {OPERAND_NONE}},

We have to use "1" instead of "0" as Bytes filed.. WHY ?
also what type of modification required for other filed value ?
 
Is there any document for "tclInstructionTable"? if yes please share

I am looking forward to hearing from you 

Thanks
sebreswiki2018-12-04 12:09:23

> We have to use "1" instead of "0" as Bytes filed.. WHY ?

Because the byte of the instruction-command self is counted also, numBytes equals all bytes reserved for a command in byte-code (including command instruction and operand bytes also). Thus all single-byte instructions have numBytes = 1.

> Is there any document for "tclInstructionTable"? if yes please share

For example take a look in tclCompile.h and declaration of InstructionDesc type.

Also note that 8.6 has additional handling round about byte-code/instructions compilation process: byte-code and compaction optimizations (see tclOptimize.c/tclCompile.c), command search (emit of instruction relative INST_START_CMD), capturing the inner context (e. g. call stack in error case) as well as disassembling of the byte-code, etc.

Because byte-code compilation is merely an internal API, the source code will be your best friend there.

Also note that some instructions may be a bit incompatible between 8.4 and 8.6. To have some obsolete instructions (like INST_CALL_BUILTIN_FUNC1, INST_CALL_FUNC1) you must also compile Tcl using directive TCL_SUPPORT_84_BYTECODE=1.

sebresplain2019-01-07 01:47:24
closed for no activity (as pure upgrade issue).
Log in (anonymous is fine) to add a comment.