Skip to content

Instantly share code, notes, and snippets.

@hkdnet
Created September 18, 2017 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkdnet/1c42ff3b807048cf548763326a7ec2e0 to your computer and use it in GitHub Desktop.
Save hkdnet/1c42ff3b807048cf548763326a7ec2e0 to your computer and use it in GitHub Desktop.
p (-1.3).abs
p = 2
p (-1.3).abs
$ ruby --dump=insns foo.rb
== disasm: #<ISeq:<main>@foo.rb>========================================
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] p
0000 trace 1 ( 1)
0002 putself
0003 putobject -1.3
0005 opt_send_without_block <callinfo!mid:abs, argc:0, ARGS_SIMPLE>, <callcache>
0008 opt_send_without_block <callinfo!mid:p, argc:1, FCALL|ARGS_SIMPLE>, <callcache>
0011 pop
0012 trace 1 ( 2)
0014 putobject 2
0016 setlocal_OP__WC__0 2
0018 trace 1 ( 3)
0020 putself
0021 putobject -1.3
0023 opt_send_without_block <callinfo!mid:p, argc:1, FCALL|ARGS_SIMPLE>, <callcache>
0026 opt_send_without_block <callinfo!mid:abs, argc:0, ARGS_SIMPLE>, <callcache>
0029 leave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment