Last active
March 25, 2021 08:03
-
-
Save joker1007/966f7f6e3d786292a66b6b030efaef14 to your computer and use it in GitHub Desktop.
ruby_for_insn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in [1, 2, 3] | |
p i | |
j = i | |
end | |
p j | |
[1, 2, 3].each do |k| | |
l = k | |
end | |
x = 0 | |
while x < 5 | |
x += 1 | |
y = x | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== disasm: #<ISeq:<main>@for.rb:1 (1,0)-(16,3)> (catch: FALSE) | |
== catch table | |
| catch type: break st: 0000 ed: 0005 sp: 0000 cont: 0005 | |
| == disasm: #<ISeq:block in <main>@for.rb:1 (1,0)-(4,3)> (catch: FALSE) | |
| == catch table | |
| | catch type: redo st: 0005 ed: 0016 sp: 0000 cont: 0005 | |
| | catch type: next st: 0005 ed: 0016 sp: 0000 cont: 0016 | |
| |------------------------------------------------------------------------ | |
| local table (size: 1, argc: 1 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
| [ 1] ?@0<Arg> | |
| 0000 getlocal_WC_0 ?@0 ( 1) | |
| 0002 setlocal_WC_1 i@0 | |
| 0004 nop [Bc] | |
| 0005 putself ( 2)[Li] | |
| 0006 getlocal_WC_1 i@0 | |
| 0008 opt_send_without_block <calldata!mid:p, argc:1, FCALL|ARGS_SIMPLE> | |
| 0010 pop | |
| 0011 getlocal_WC_1 i@0 ( 3)[Li] | |
| 0013 dup | |
| 0014 setlocal_WC_1 j@1 | |
| 0016 nop | |
| 0017 leave ( 4)[Br] | |
| catch type: break st: 0013 ed: 0018 sp: 0000 cont: 0018 | |
| == disasm: #<ISeq:block in <main>@for.rb:8 (8,15)-(10,3)> (catch: FALSE) | |
| == catch table | |
| | catch type: redo st: 0001 ed: 0006 sp: 0000 cont: 0001 | |
| | catch type: next st: 0001 ed: 0006 sp: 0000 cont: 0006 | |
| |------------------------------------------------------------------------ | |
| local table (size: 2, argc: 1 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
| [ 2] k@0<Arg> | [ 1] l@1 | |
| 0000 nop ( 8)[Bc] | |
| 0001 getlocal_WC_0 k@0 ( 9)[Li] | |
| 0003 dup | |
| 0004 setlocal_WC_0 l@1 | |
| 0006 nop | |
| 0007 leave ( 10)[Br] | |
| catch type: break st: 0029 ed: 0049 sp: 0000 cont: 0049 | |
| catch type: next st: 0029 ed: 0049 sp: 0000 cont: 0026 | |
| catch type: redo st: 0029 ed: 0049 sp: 0000 cont: 0029 | |
|------------------------------------------------------------------------ | |
local table (size: 4, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 4] i@0 [ 3] j@1 [ 2] x@2 [ 1] y@3 | |
0000 duparray [1, 2, 3] ( 1)[Li] | |
0002 send <calldata!mid:each, argc:0>, block in <main> | |
0005 nop | |
0006 pop ( 1) | |
0007 putself ( 6)[Li] | |
0008 getlocal_WC_0 j@1 | |
0010 opt_send_without_block <calldata!mid:p, argc:1, FCALL|ARGS_SIMPLE> | |
0012 pop | |
0013 duparray [1, 2, 3] ( 8)[Li] | |
0015 send <calldata!mid:each, argc:0>, block in <main> | |
0018 nop | |
0019 pop ( 8) | |
0020 putobject_INT2FIX_0_ ( 12)[Li] | |
0021 setlocal_WC_0 x@2 | |
0023 jump 40 ( 13)[Li] | |
0025 putnil | |
0026 pop | |
0027 jump 40 | |
0029 getlocal_WC_0 x@2 ( 14)[Li] | |
0031 putobject_INT2FIX_1_ | |
0032 opt_plus <calldata!mid:+, argc:1, ARGS_SIMPLE> | |
0034 setlocal_WC_0 x@2 | |
0036 getlocal_WC_0 x@2 ( 15)[Li] | |
0038 setlocal_WC_0 y@3 | |
0040 getlocal_WC_0 x@2 ( 13) | |
0042 putobject 5 | |
0044 opt_lt <calldata!mid:<, argc:1, ARGS_SIMPLE> | |
0046 branchif 29 | |
0048 putnil | |
0049 nop | |
0050 leave ( 15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment