public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
irb(main):006:0> File.write('out.rb', 'def foo; @attributes["zomg"]; end')
=> 33
irb(main):007:0> x = RubyVM::InstructionSequence.compile_file 'out.rb'
=> <RubyVM::InstructionSequence:<main>@out.rb>
irb(main):008:0> puts x.disasm
== disasm: <RubyVM::InstructionSequence:<main>@out.rb>==================
0000 trace 1 ( 1)
0002 putspecialobject 1
0004 putspecialobject 2
0006 putobject :foo
0008 putiseq foo
0010 send :"core#define_method", 3, nil, 0, <ic:0>
0016 leave
== disasm: <RubyVM::InstructionSequence:foo@out.rb>=====================
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] ?
0000 trace 8 ( 1)
0002 trace 1
0004 getinstancevariable :@attributes, <ic:0>
0007 putstring "zomg"
0009 opt_aref <ic:2>
0011 trace 16
0013 leave
=> nil
irb(main):009:0>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.