Skip to content
Tcl Source Code History Of Ticket 465811ffffffffff
Login

History Of Ticket 465811ffffffffff

Artifacts Associated With Ticket 465811ffffffffff

  1. Ticket change [0b32bbd550] (rid 113943) by andreas_kupries on 2001-09-27 20:50:54:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      This is possibly not a feature request but a 
      performance bug /
      enhancement.
      
      The control commands [if], [while] and [for] currently 
      do not check
      their expression arguments for static strings and 
      constant
      expressions. This means that for example
      
      if {0} {
      bla
      }
      
      is compiled into bytecode despite the fact that the 
      code will not be
      executed, ever.
      
      I propose that the compile procedures for the 
      aformentioned commands
      are extended to detect simple constant expressions and 
      to react
      accordingly. I.e. not to compile the if/while/for 
      statement at all or
      only partially and to compile only the sub-scripts 
      which are reachable
      for the constant expression.
      
      This enhancement is along the lines of the 
      optimization for [proc
      {args} {}], but should present less problems with 
      recompilation as no
      commands are implicitly added or removed from the 
      interp. It does
      present a new set of challenges if we want to go 
      beyond the detection
      of simple constant expressions to the detection of (0 
      && ...) etc.
      
      Note: This is easier for logical expressions as they 
      are defined to
      have shortcircuit evaluation and thus present less 
      problems with
      regard to variable tracing.
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "andreas_kupries"
    9. subsystem initialized to: "47. Bytecode Compiler"
    10. title initialized to: "Optimize if/while/... during compilation"
    11. type initialized to: "RFE"
  2. Ticket change [2516e720f0] (rid 131223) by kennykb on 2001-09-29 05:03:50:

    1. icomment:
      Logged In: YES 
      user_id=99768
      
      This sounds like a fine idea.  We also have to make sure that the
      scripts themselves are constant.  Otherwise, we'll generate incorrect
      code for something like
          if 0 [commandWithSideEffects]
      
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  3. Ticket change [dffea03960] (rid 115115) by msofer on 2001-09-29 05:08:00:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      proc foo {} { 
          if {0} { catch this thing that won't work } 
          return 0 
      }
      
      currently errs out on compilation; it is a bug ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Ticket change [9d9e8db46e] (rid 96338) by msofer on 2002-02-09 00:07:24:

    1. assignee changed to: "andreas_kupries"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      The enclosed patch includes the following optimisations:
      
        * [if]: optimise for constant boolean conditions
        * [for]: loop rotation to avoid one extra branch in the
      loop
        * [while]: both optimisations above
      
      It also fixes the bug in my last comment. Assigning to aku
      for comments.
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  5. Add attachment "465811.patch" [ca022b0f93] (rid 122387) by msofer on 2002-02-09 00:07:24.

  6. Ticket change [605869998f] (rid 115980) by msofer on 2002-02-09 00:07:25:

    1. icomment:
      
      
      File Added - 17495: 465811.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [bc2a24a5a7] (rid 129619) by andreas_kupries on 2002-02-09 01:00:24:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=75003
      
      In general it looks ok, in detail I can't say cause I know 
      zilch about the data structures used by the compiler. I 
      will reassign this to Jeff. 
      
      Question about: while (1) {}. Does it generate
      
      B: body
         goto B
      
      or the less efficient
      
         goto A
      B: body
      A: goto B
      
      ?
      
      
      
    3. login: "andreas_kupries"
    4. mimetype: "text/plain"
    5. username: "andreas_kupries"
  8. Ticket change [823667b1ce] (rid 117195) by msofer on 2002-02-09 01:17:44:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      while 1 {...} does compile the efficient version; witness
      
        Source "while 1 break\n"
        Cmds 2, src 14, inst 7, litObjs 1, aux 0, stkDepth 1,
      code/src 11.14
        Code 156 = header 100+inst 7+litObj 4+exc 28+aux 0+cmdMap
      8
        Exception ranges 1, depth 1:
            0: level 1, loop, pc 0-0, continue 0, break 4
        Commands 2:
            1: pc 0-5, src 0-12          2: pc 0-0, src 8-12
        Command 1: "while 1 break"
        Command 2: "break"
          (0) break 
          (1) pop 
          (2) jump1 -2        # pc 0
          (4) push1 0         # ""
          (6) done 
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [5f13c3dff1] (rid 115750) by hobbs on 2002-02-23 02:25:51:

    1. assignee changed to: "msofer"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      go ahead and commit
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. username: "hobbs"
  10. Ticket change [2a09abffb6] (rid 118486) by msofer on 2002-02-23 02:55:40:

    1. closedate changed to: "2002-02-22T19:55:40"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Committed; the detection of simple constant conditions
      remains in the to-do list.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Accepted"
    7. status changed to: "Closed"
    8. username: "msofer"
  11. Ticket change [1a7654bef7] (rid 122980) by msofer on 2002-02-23 02:59:33:

    1. closedate changed to: "2002-02-22T19:59:33"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Doh ... simple constant conditions *are* detected ("if 0",
      "while on", ...). What is not done is the detection of
      simple expressions that evaluate to a constant ("if {0 &&
      $w}")
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. username: "msofer"