#3742 command limit is never reached in loops

obsolete: 8.5a6
closed-fixed
5
2007-07-21
2007-07-11
Anonymous
No

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
******************

Discussion

  • miguel sofer

    miguel sofer - 2007-07-11
    • assigned_to: hobbs --> dkf
     
  • miguel sofer

    miguel sofer - 2007-07-11

    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).

     
  • miguel sofer

    miguel sofer - 2007-07-11
    • status: open --> closed
     
  • miguel sofer

    miguel sofer - 2007-07-11

    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'.

     
  • miguel sofer

    miguel sofer - 2007-07-11
    • assigned_to: dkf --> msofer
    • status: closed --> closed-fixed
     
  • Donal K. Fellows

    • labels: 105661 --> 47. Bytecode Compiler
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks