Last active
November 17, 2017 14:47
-
-
Save SpringMT/844432acc27318b86b44277e00f612fc to your computer and use it in GitHub Desktop.
fooがローカル変数になる
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>@./sample.rb>=================================== | |
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 1] a | |
0000 putspecialobject 3 ( 1) | |
0002 putnil | |
0003 defineclass :A, <class:A>, 0 | |
0007 pop | |
0008 getinlinecache 15, <is:0> ( 13) | |
0011 getconstant :A | |
0013 setinlinecache <is:0> | |
0015 send <callinfo!mid:new, argc:0, ARGS_SIMPLE>, <callcache>, nil | |
0019 setlocal a, 0 | |
0022 getlocal a, 0 ( 14) | |
0025 putobject 1 | |
0027 send <callinfo!mid:foo=, argc:1, ARGS_SIMPLE>, <callcache>, nil | |
0031 pop | |
0032 putself ( 15) | |
0033 getlocal a, 0 | |
0036 send <callinfo!mid:bar, argc:0, ARGS_SIMPLE>, <callcache>, nil | |
0040 send <callinfo!mid:p, argc:1, FCALL|ARGS_SIMPLE>, <callcache>, nil | |
0044 leave | |
== disasm: #<ISeq:<class:A>@./sample.rb>================================ | |
0000 putself ( 2) | |
0001 putobject :foo | |
0003 send <callinfo!mid:attr_accessor, argc:1, FCALL|ARGS_SIMPLE>, <callcache>, nil | |
0007 pop | |
0008 putspecialobject 1 ( 3) | |
0010 putobject :bar | |
0012 putiseq bar | |
0014 send <callinfo!mid:core#define_method, argc:2, ARGS_SIMPLE>, <callcache>, nil | |
0018 pop | |
0019 putspecialobject 1 ( 8) | |
0021 putobject :baz | |
0023 putiseq baz | |
0025 send <callinfo!mid:core#define_method, argc:2, ARGS_SIMPLE>, <callcache>, nil | |
0029 leave | |
== disasm: #<ISeq:bar@./sample.rb>====================================== | |
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 1] foo | |
0000 putself ( 4) | |
0001 getlocal foo, 0 <================ ここでローカル変数fooが定義されている | |
0004 send <callinfo!mid:baz, argc:1, FCALL|ARGS_SIMPLE>, <callcache>, nil | |
0008 setlocal foo, 0 | |
0011 getlocal foo, 0 ( 5) | |
0014 leave | |
== disasm: #<ISeq:baz@./sample.rb>====================================== | |
local table (size: 1, argc: 1 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 1] v<Arg> | |
0000 getlocal v, 0 ( 9) | |
0003 leave |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment