Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ bin/rbx
- irb(main):001:0> load './fib_r.rb'
- => true
- irb(main):002:0> cc = A.instance_method(:fibi).executable
- => #<Rubinius::CompiledCode:0x3680 name=fibi file=(dynamic) line=1>
- irb(main):003:0> cc.iseq
- => #<Rubinius::InstructionSequence:0x3840>
- irb(main):004:0> iseq = _
- => #<Rubinius::InstructionSequence:0x3840>
- irb(main):005:0> iseq.opcodes
- => #<Rubinius::Tuple: 184, 1, 127, 0, 0, 134, 2, 0, 148, 3, 2, 1, 126, 3, 49, 184, 0, 184, 3, 137, 4, 0, 0, 150, 5, 4, 2, 126, 5, 46, 136, 6, 0, 137, 0, 0, 3, 136, 3, 6, 137, 4, 4, 1, 181, 23, 135, 0, 0, 132, 0, 70, 0>
- irb(main):006:0> puts cc.decode
- 0000: r_load_1 1
- 0002: r_load_local 0, 0
- 0005: r_load_int 2, 0
- 0008: n_ile 3, 2, 1
- 0012: b_if 3, 49
- 0015: r_load_1 0
- 0017: r_load_1 3
- 0019: n_iadd 4, 0, 0
- 0023: n_ige 5, 4, 2
- 0027: b_if 5, 46
- 0030: r_copy 6, 0
- 0033: n_iadd 0, 0, 3
- 0037: r_copy 3, 6
- 0040: n_iadd 4, 4, 1
- 0044: goto_past 0023:
- 0046: r_store_int 0, 0
- 0049: r_store_stack 0
- 0051: ret 0
- => nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement