Skip to content
Tcl Source Code View Ticket
Login

View Ticket

improve literal handling

Closed / Invalid1323154fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-10-10 17:53:43
While investigating something else, I came to notice
that the compiler is doing a bad job at literal
sharing. Note in this bytecode that the three "" appear
as three different literals:

ByteCode 0x816c458, refCt 1, epoch 0, interp 0x814cb28
(epoch 0)
  Source "for break 1 {} {}"
  Cmds 2, src 17, inst 18, litObjs 4, aux 0, stkDepth
1, code/src 12.00
  Code 204 = header 100+inst 18+litObj 16+exc 56+aux
0+cmdMap 8
  Exception ranges 2, depth 1:
      0: level 1, loop, pc 4-5, continue 7, break 15
      1: level 1, loop, pc 7-8, continue -1, break 15
  Commands 2:
      1: pc 0-16, src 0-16         2: pc 0-0, src 4-8
  Command 1: "for break 1 {} {}"
  Command 2: "break"
    (0) break
    (1) pop
    (2) jump1 +8        # pc 10
    (4) push1 0         # ""
    (6) pop
    (7) push1 1         # ""
    (9) pop
    (10) push1 2        # "1"
    (12) tryCvtToNumeric
    (13) jumpTrue1 -9   # pc 4
    (15) push1 3        # ""
    (17) done
i
msoferplain2005-10-11 01:06:03
Logged In: YES 
user_id=148712

Tcl8.4.11 does not have this problem, the literal is shared
there
msoferplain2005-10-11 01:17:35
Logged In: YES 
user_id=148712

This is just a fluke caused by the fix for [Bug 458361]:
single-word scripts are unshared in order to stop them from
shimmering. Nothing to see here, not a bug.
Log in (anonymous is fine) to add a comment.