Posted to tcl by kbk at Thu Apr 04 17:19:09 GMT 2019view pretty

% proc one {a b} { expr {$a < $b} } ; tcl::unsupported::disassemble proc one
ByteCode 0x0x2228390, refCt 1, epoch 15, interp 0x0x21f77f0 (epoch 15)
  Source " expr {$a < $b} "
  Cmds 1, src 16, inst 6, litObjs 0, aux 0, stkDepth 2, code/src 0.00
  Proc 0x0x224d5c0, refCt 1, args 2, compiled locals 2
      slot 0, scalar, arg, "a"
      slot 1, scalar, arg, "b"
  Commands 1:
      1: pc 0-4, src 1-15
  Command 1: "expr {$a < $b} "
    (0) loadScalar1 %v0 	# var "a"
    (2) loadScalar1 %v1 	# var "b"
    (4) lt 
    (5) done 

% proc two {a b} { < $a $b } ; tcl::unsupported::disassemble proc two
ByteCode 0x0x2228490, refCt 1, epoch 15, interp 0x0x21f77f0 (epoch 15)
  Source " < $a $b "
  Cmds 1, src 9, inst 9, litObjs 1, aux 0, stkDepth 3, code/src 0.00
  Proc 0x0x2259c70, refCt 1, args 2, compiled locals 2
      slot 0, scalar, arg, "a"
      slot 1, scalar, arg, "b"
  Commands 1:
      1: pc 0-7, src 1-8
  Command 1: "< $a $b "
    (0) push1 0 	# "<"
    (2) loadScalar1 %v0 	# var "a"
    (4) loadScalar1 %v1 	# var "b"
    (6) invokeStk1 3 
    (8) done 

Comments

Posted by kbk at Thu Apr 04 17:25:49 GMT 2019 [text] [code]

I'm wrong, mistyped tcl::mathop in the [namespace path] % proc two {a b} { < $a $b } ; tcl::unsupported::disassemble proc two ByteCode 0x0x2228490, refCt 1, epoch 15, interp 0x0x21f77f0 (epoch 15) Source " < $a $b " Cmds 1, src 9, inst 6, litObjs 0, aux 0, stkDepth 2, code/src 0.00 Proc 0x0x2259ef0, refCt 1, args 2, compiled locals 2 slot 0, scalar, arg, "a" slot 1, scalar, arg, "b" Commands 1: 1: pc 0-4, src 1-8 Command 1: "< $a $b " (0) loadScalar1 %v0 # var "a" (2) loadScalar1 %v1 # var "b" (4) lt (5) done