Skip to content

Instantly share code, notes, and snippets.

@dronov
Created March 20, 2015 14:07
Show Gist options
  • Save dronov/aa5c60780824b364c14c to your computer and use it in GitHub Desktop.
Save dronov/aa5c60780824b364c14c to your computer and use it in GitHub Desktop.
irb(main):009:0> code = <<-END
irb(main):010:0" puts 2+2
irb(main):011:0" END
=> "puts 2+2\n"
irb(main):012:0> puts RubyVM::InstructionSequence.compile(code).disasm
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putself
0003 putobject 2
0005 putobject 2
0007 opt_plus <callinfo!mid:+, argc:1, ARGS_SKIP>
0009 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0011 leave
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment