
Untitled
By: a guest on
Jul 1st, 2012 | syntax:
None | size: 0.98 KB | hits: 13 | expires: Never
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>