1. Get the bytecode for some code:
irb(main):001:0> x = RubyVM::InstructionSequence.new '1 + 1' => <RubyVM::InstructionSequence:<compiled>@<compiled>> irb(main):002:0> puts x.disasm == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>========== 0000 trace 1 ( 1) 0002 putobject 1 0004 putobject 1 0006 opt_plus <ic:1> 0008 leave => nil irb(main):003:0>
$ ruby -y -e'1 + 1'
$ bin/rbx compile -A -S -B -e '1 + 1' # A(ST), S(exp), B(ytecode)
1. Get the bytecode for some code:
2. Output parser states and debugging information: (The output is long so I haven't pasted it. :-) )