| Ticket UUID: | 1752146 | ||
| Title: | command limit is never reached in loops | ||
| Type: | Bug | Created on: | 2007-07-11 18:34:07 |
| Submitter: | nobody | Assigned to: | msofer |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 5 Medium | Last modified: | 2007-07-22 02:41:44 |
| Status: | Closed | Closed by: | msofer |
| Resolution: | Fixed | Closed on: | 2007-07-11 21:25:47 |
| Version: | obsolete: 8.5a6 | ||
| Description: | ||||
Hi,
*** release 8.5a6 - 2007-04-25
in some cases, while interpreting some very short loop code, the command limit of the interpreter is never reached.
For example, the following code never reach the command limit :
*****************
interp create testlimit
testlimit eval {
proc testlimit {} {
while 1 {
set b 22
}
}
}
interp limit testlimit commands -value 303
testlimit eval testlimit
******************
As well, the following code never reach the command limit :
*****************
interp create testlimit
testlimit eval {
set b 22
proc testlimit {} {
while 1 {
incr b
}
}
}
interp limit testlimit commands -value 303
testlimit eval testlimit
******************
Conversely, the following code aborts when the command limit is reached (correct behavior) :
*****************
interp create testlimit
testlimit eval {
set b 22
proc testlimit {} {
while 1 {
set b 22
set a 22
}
}
}
interp limit testlimit commands -value 303
testlimit eval testlimit
******************
| ||||
| User Comments: | ||||
msofer added on 2007-07-12 01:50:55:
Logged In: YES user_id=148712 Originator: NO The problem seems to be caused by the optimisation of INST_START_CMD (2007-04-01), and require for its manifestation: (a) a 'while 1' loop with (b) a single bytecoded command in the body In this case all the bytecode in the loop is atmdStart, and there is no ISC within the loop. Note also that the 'deep cause' is that the commands are miscounted: the first command in the loop body will be counted just once, and not at each iteration. Again, only on 'while 1' which starts the body immediately (when there is no condition a jump is optimised away by the compiler). msofer added on 2007-07-12 04:25:46:
Logged In: YES user_id=148712 Originator: NO Misdiagnosis: problem present with 8.5a5, which is earlier than that patch. It was caused by faulty avoidance of ISC when the very first opcode in a script is within a loop body - as produced by 'while 1'. | ||||
