Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. $ bin/rbx
  2. irb(main):001:0> load './fib_r.rb'
  3. => true
  4. irb(main):002:0> cc = A.instance_method(:fibi).executable
  5. => #<Rubinius::CompiledCode:0x3680 name=fibi file=(dynamic) line=1>
  6. irb(main):003:0> cc.iseq
  7. => #<Rubinius::InstructionSequence:0x3840>
  8. irb(main):004:0> iseq = _
  9. => #<Rubinius::InstructionSequence:0x3840>
  10. irb(main):005:0> iseq.opcodes
  11. => #<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>
  12. irb(main):006:0> puts cc.decode
  13. 0000: r_load_1 1
  14. 0002: r_load_local 0, 0
  15. 0005: r_load_int 2, 0
  16. 0008: n_ile 3, 2, 1
  17. 0012: b_if 3, 49
  18. 0015: r_load_1 0
  19. 0017: r_load_1 3
  20. 0019: n_iadd 4, 0, 0
  21. 0023: n_ige 5, 4, 2
  22. 0027: b_if 5, 46
  23. 0030: r_copy 6, 0
  24. 0033: n_iadd 0, 0, 3
  25. 0037: r_copy 3, 6
  26. 0040: n_iadd 4, 4, 1
  27. 0044: goto_past 0023:
  28. 0046: r_store_int 0, 0
  29. 0049: r_store_stack 0
  30. 0051: ret 0
  31. => nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement