Ticket Change Details
Not logged in
Overview

Artifact ID: 52a8a21221d3b96ff1cb23dc59710d20659278debabefc1101410df3729baff0
Ticket: 552ed5eac53ff5e4685badea56935871627aff34
Strange discrepancy regarding INST_START_CMD in body of cycles if compiled with or without invocation in condition/iterator...
User & Date: aspect 2018-04-22 02:24:14
Changes

  1. icomment:
    A simpler example would make this easier to follow ..
    
        % proc x {t} {while {[t]} {incr x}}
          Command 1: "while {[t]} {incr x}"
            (0) jump1 +15       # pc 15
          Command 2: "incr x..."
            (2) startCommand +12 1      # next cmd at pc 14, 1 cmds start here
            (11) incrScalar1Imm %v1 +1  # var "x"
            (14) pop
          Command 3: "t..."
            (15) push1 0        # "t"
            (17) invokeStk1 1
            (19) nop
            (20) jumpTrue1 -18  # pc 2
            (22) push1 1        # ""
            (24) done
    
        % proc y {y} {while {$t} {incr x}}
          Command 1: "while {$t} {incr x}"
            (0) jump1 +6        # pc 6
          Command 2: "incr x..."
            (2) incrScalar1Imm %v1 +1   # var "x"
            (5) pop
            (6) loadScalar1 %v2         # var "t"
            (8) nop
            (9) jumpTrue1 -7    # pc 2
            (11) push1 0        # ""
            (13) done
    
    Is this due to the optimisation at https://core.tcl.tk/tcl/artifact/49a6bfc698a0d1c0?ln=825 ?
    
    It looks legitimate to me, since START_CMD only (?) exists for book-keeping
    for the error path and interp limits.  Note that optimisation is skipped if
    an interp limit exists.
    
    The [info cmdcount] discrepancy is incorrect, but I understand [info cmdcount]
    to be (necessarily) fragile in the face of BCC.  Probably the manual
    should be updated to reflect what is said in https://wiki.tcl.tk/9813
    
  2. login: "aspect"
  3. mimetype: "text/plain"