Skip to content
Tcl Source Code History Of Ticket 729692ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 729692ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 729692ffffffffffffffffffffffffffffffffff

  1. Ticket change [383c16ddb2] (rid 112161) by rmax on 2003-04-29 16:27:44:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The following piece of code doesn't work as expected
      due to the empty proc body optimization that went into
      Tcl 8.4.
      
      proc bar args {}
      proc main {} {
          proc bar args {puts "this is bar"}
          bar
      }
      main
      
      While this example is artificial, I stumbled over this
      bug in a situation where a (formerly empty) proc got
      redefined through by
       namespace import -force
      and invoked immediately afterwards, all within the same
      arm of a switch statement. So it took me some time (and
      the help of fellow Tcl'ers on the chat) to find out
      what's going on.
      
      
    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: "rmax"
    9. subsystem initialized to: "47. Bytecode Compiler"
    10. title initialized to: "empty body optimization does too much"
    11. type initialized to: "Bug"
  2. Ticket change [4ada6d7783] (rid 126602) by dgp on 2003-11-13 08:40:17:

    1. foundin changed to: "obsolete: 8.4.2"
  3. Ticket change [015e3db59e] (rid 119471) by rmax on 2003-11-13 14:22:44:

    1. foundin changed to: "obsolete: 8.4.5"
  4. Ticket change [7dfbb3e024] (rid 97326) by msofer on 2003-11-16 06:24:32:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Not much that we can do about that? This is really a
      fundamental bug in the bytecode model: once a bytecode is
      running, it can't be modified.
      In your example, changes to bytecompiled commands called
      from within main's body will not affect main while it is
      running. Another example is
         proc tst {} {
             rename set _set
             proc set args {puts GOTCHA}
             set x 1
             rename set {}
             rename _set set
         }
      Running tst the new definition of 'set' will be ignored,as
      it was bytecompiled.
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. title changed to:
      redef of bcc'ed commands inoperant in current bcode
      
    5. username: "msofer"
  5. Ticket change [d72003d536] (rid 123926) by dgp on 2004-03-10 05:16:10:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      OK, this may go nowhere, but here's a thought.
      
      We have epoch counters that tell us whether
      we need to recomile a whole unit of bytecode
      before executing it.
      
      Some bytecode execution can increment the
      epoch counter.   Can't we check for an increment
      after we execute those bytecodes, and if we
      see one, abandon bytecode execution and
      switch over to direct string evaluation?  (leaving
      any recompile for the next evaluation of the
      whole bytecode unit)
      
      Is this merely difficult, or fundamentally
      impossible?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [b514851606] (rid 125182) by msofer on 2004-03-10 07:21:25:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      This is very similar to bug 495830, at least in its causes.
      The general solution could well involve defining a new
      bytecode for either 'command start' or 'command end' that
      checks for (interp validity, epochs,  ...) and switches to
      direct string evaluation in exceptional cases. 
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [b9e627a3c0] (rid 129226) by dkf on 2004-03-10 18:54:44:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      I think we're not talking 'impossible' but rather
      'exceptionally difficult' and possibly even 'impossible with
      the current bytecode engine'.
      
      The nub of the problem is what happens if you redefine
      [while] inside a [while] loop and then try to call that
      redefined [while] while still executing that loop.  You have
      to be able to invalidate sections of bytecode and replace
      them with bytecodes of potentially different length without
      invalidating the outer bytecodes which are still in use
      (change those and you're also altering the semantics of Tcl,
      and it's a non-trivial change at best.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  8. Ticket change [233139294e] (rid 130880) by msofer on 2004-03-10 21:02:59:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Idea - but may be costly in runtime. Define INST_START_CMD
      and INST_END_CMD. Let the bc engine have two states:
        - normal N: execute bytecodes
        - exceptional E: find next command from the source,
      interpret it
      
      State N:
         INST_START_CMD: check epoch; if ok do nothing, else
      switch state to E and rexec INST_START_CMD
         INST_END_CMD: a noop
      
      State E:
          INST_START_CMD: find in the sources the command
      corresponding to the next command; interpret it and push its
      result on the stack; jump to the instruction after the
      corresponding INST_END_CMD
          INST_END_CMD: a noop
      
      It can possibly be made marginally more efficient (in the
      sense of it being less costly in state E). But I do think
      this approach could work. Feedback?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [5639baee18] (rid 94284) by msofer on 2004-03-29 10:22:02:

    1. assignee changed to: "dkf"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Enclosed a tentative patch for review; more test cases
      needed. Note that this also fixes [Bug 495830].
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  10. Ticket change [fb9e336bc2] (rid 92095) by msofer on 2004-03-29 10:22:04:

    1. icomment:
      
      
      File Added - 81711: 729692.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [00107cd377] (rid 119255) by msofer on 2004-03-30 01:10:21:

    1. icomment:
      
      
      File Deleted - 81711: 
      
      
      
      File Added - 81782: 729692.patch
      
      Logged In: YES 
      user_id=148712
      
      Fixed patch to work correctly with precompiled scripts - the
      new instruction is effectively a noop for them.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  12. Ticket change [a579529000] (rid 110385) by dkf on 2004-03-30 03:45:03:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      It all looks like a good patch to me taking a good route to
      solve the problem, but I can't test ATM because of the other
      things I've got cooking in various sandboxes; I assume that
      the updated test suite works?
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "7 High"
    5. username: "dkf"
  13. Ticket change [3d620c52f5] (rid 121077) by dkf on 2004-03-30 03:46:31:

    1. assignee changed to: "msofer"
  14. Ticket change [f2e2c1b5ef] (rid 109635) by msofer on 2004-03-30 07:41:52:

    1. icomment:
      
      
      File Deleted - 81782: 
      
      
      
      File Added - 81838: 729692.patch
      
      Logged In: YES 
      user_id=148712
      
      Slightly modified patch and tclbench results attached.
      The patch produces a small overall slowdown in the whole
      benchmark suite. Bytecode intensive tests are noticeably
      slowed down: 5-10% (loops, base64, klist, list iterate, ...)
      with two bad ~15-20% cases (sha1, heapsort).
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  15. Add attachment "729692.patch" [8812701ec8] (rid 131807) by msofer on 2004-03-30 07:41:52.

  16. Ticket change [d08a9f5f22] (rid 113201) by msofer on 2004-03-30 07:43:03:

    1. icomment:
      
      
      File Added - 81839: tclbench
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  17. Add attachment "tclbench" [6c6e16303f] (rid 128507) by msofer on 2004-03-30 07:43:03.

  18. Ticket change [c1a2dd5140] (rid 111351) by msofer on 2004-03-30 07:56:21:

    1. foundin changed to: "obsolete: 8.5a2"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Note that this patch introduces a new bug that requires
      fixingbefore applying:
         while 1 {}
      does not check for asyncs.
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  19. Ticket change [1ba3595ec7] (rid 123186) by dkf on 2004-03-30 15:08:30:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      An idea that occurred to me is that we should not issue this
      instruction multiple times in a row (currently possible when
      compiling a command whose argument is itself a compiled
      command) since the first instance will more than adequately
      protect all subsequent ones.
      
      On the other issue: Perhaps we need a counter to do the
      asynch stuff that is reset when a startcmd instruction is
      processed?  We could make the counter have a relatively long
      period, of course, so only very evil BC loops would have any
      danger of hitting it.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  20. Ticket change [f8ac11a84d] (rid 91579) by msofer on 2004-03-30 16:24:32:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      I was actually thinking of compiling an INST_START_CMD into
      every empty loop body. Any downside to that?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  21. Ticket change [b357d0cb70] (rid 124849) by dkf on 2004-03-30 16:43:09:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Hmm.  If the target was the next instruction, that'd be OK.
       However, we'd also need to be careful to only do this in
      the case when the body was empty (or at least empty of
      bytecodes).  In the non-empty case, the body's own startcmds
      would be better.
      
      Without this particular niggle, I think it would be fairly
      easy to add the extra information to the compileenv to help
      generate only minimal numbers of startcmds, which would
      probably help with the speed.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  22. Ticket change [f03e7051e2] (rid 109153) by msofer on 2004-03-30 18:20:18:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The minimisation of INST_START_CMDs (ISC) looks to me like
      (yet another) job for a post-compile optimiser. In general,
      if there are two ISCs such that:
      
        (a) there is no intervening jump or jump target (including
      the second ISC)
        (b) there is no intervening invocation or variable access
      (in TEBC terms: instructions that do not DECACHE_STACK_INFO)
      
      then the second ISC can be effectively eliminated.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  23. Ticket change [415cb5a515] (rid 116178) by msofer on 2004-03-30 18:24:56:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      (Topic now changed to discussion of the patch ... OT for the
      bug ticket? Should I rather open a patch ticket?)
      Further possible usage for ISC (assuming no redundancy
      elimination): enabling of command tracing in bcc'ed code.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  24. Ticket change [488000ac5a] (rid 99892) by dkf on 2004-03-30 19:57:46:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      We need to work out what duties the ISC serves and optimise
      it for that.  The more it does, the less it can be optimised.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  25. Ticket change [542ac3e2dd] (rid 93891) by dgp on 2004-03-30 22:49:54:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      I'm all in favor of making
      further improvements, but
      how about committing the
      fix we have to the HEAD?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  26. Ticket change [24b437a22f] (rid 131155) by msofer on 2004-03-30 23:38:44:

    1. closedate changed to: "2004-03-30T16:38:44"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Patch committed; we'll improve on it during alpha if
      necessary. New bug item for the missing async checks during
      empty loops.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"
  27. Ticket change [90278425a2] (rid 120401) by hobbs on 2004-03-31 00:20:27:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      IMO this patch should be reversed if miguel's slowdown
      numbers are accurate.  This was a known issue, and is a
      pathological case that is acceptable when documented.  It's
      not acceptable to take up to a 10% slowdown for the core
      just to support this.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "hobbs"
  28. Ticket change [192a71292d] (rid 122771) by msofer on 2004-03-31 01:10:38:

    1. closedate changed to: "2004-03-30T18:10:38"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      Closed again - performance bug 926164 now open.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "msofer"
  29. Ticket change [0ce974bee6] (rid 114265) by msofer on 2004-09-22 22:48:39:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The fix has been corrected; it was wrong whenever the
      newly-interpreted script returns TCL_BREAK or TCL_CONTINUE.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"