Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ea02d046614818d2069d8a61bb2c4be60bcf97f982f488ece05f07ceb9bf9839
Ticket: 7b51dbf6ca834b4e88b4be497b08e5fb08512f65
Code using namespace exported commands not regenerated correctly
User & Date: beric on 2019-05-23 07:09:54
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    While experimenting if namespace exported commands were optimized as direct commands when argument is "args" and body is empty, I have found that bytecode generated for the commands were not regenerated correctly:
    
    <verbatim>
       namespace eval debug {
         proc assert {args} {}
         namespace export assert
       }
       namespace import ::debug::assert
       proc test1 {} {assert anything} 
    </verbatim>
    
    The generated bytecode shows that the assert call is optimized:
    
    <verbatim>
    tcl::unsupported::disassemble proc test1
    ByteCode 0x04910178, refCt 1, epoch 18, interp 0x0480C488 (epoch 18)
      Source "assert anything"
      Cmds 1, src 15, inst 3, litObjs 1, aux 0, stkDepth 1, code/src 0.00
      Proc 0x049051A0, refCt 1, args 0, compiled locals 0
      Commands 1:
          1: pc 0-1, src 0-14
      Command 1: "assert anything"
        (0) push1 0 	# ""
        (2) done 
    </verbatim>
    
    But redefining the assert command:
    
    <verbatim>
       proc debug::assert {args} {puts $args}
    </verbatim>
    
    The compile epoch has changed, but the assert call is still optimized:
    
    <verbatim>
    tcl::unsupported::disassemble proc test1
    ByteCode 0x04910178, refCt 1, epoch 19, interp 0x0480C488 (epoch 19)
      Source "assert anything"
      Cmds 1, src 15, inst 3, litObjs 1, aux 0, stkDepth 1, code/src 0.00
      Proc 0x049051A0, refCt 1, args 0, compiled locals 0
      Commands 1:
          1: pc 0-1, src 0-14
      Command 1: "assert anything"
        (0) push1 0 	# ""
        (2) done 
    </verbatim>
    
  5. foundin changed to: "8.6.9"
  6. is_private changed to: "0"
  7. login: "beric"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Critical"
  11. status changed to: "Open"
  12. submitter changed to: "beric"
  13. subsystem changed to: "47. Bytecode Compiler"
  14. title changed to:
    Code using namespace exported commands not regenerated correctly
    
  15. type changed to: "Bug"