Last active
November 14, 2017 07:20
-
-
Save SpringMT/71697af087e5ba95dee939e065fd2ce5 to your computer and use it in GitHub Desktop.
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
% ruby ruby_compile.rb | |
compile file sample: | |
== disasm: #<ISeq:<main>@./sample_test.rb>============================== | |
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 1] hoe | |
0000 putspecialobject 3 ( 1) | |
0002 putnil | |
0003 defineclass :Hoe, <class:Hoe>, 0 | |
0007 pop | |
0008 putnil ( 11) | |
0009 getconstant :Hoe | |
0011 send <callinfo!mid:new, argc:0, ARGS_SIMPLE>, <callcache>, nil | |
0015 setlocal hoe, 0 | |
0018 getlocal hoe, 0 ( 12) | |
0021 putobject 1 | |
0023 send <callinfo!mid:test_value=, argc:1, ARGS_SIMPLE>, <callcache>, nil | |
0027 pop | |
0028 getlocal hoe, 0 ( 13) | |
0031 send <callinfo!mid:func, argc:0, ARGS_SIMPLE>, <callcache>, nil | |
0035 leave | |
== disasm: #<ISeq:<class:Hoe>@./sample_test.rb>========================= | |
0000 putself ( 2) | |
0001 putobject :test_value | |
0003 send <callinfo!mid:attr_accessor, argc:1, FCALL|ARGS_SIMPLE>, <callcache>, nil | |
0007 pop | |
0008 putspecialobject 1 ( 3) | |
0010 putobject :func | |
0012 putiseq func | |
0014 send <callinfo!mid:core#define_method, argc:2, ARGS_SIMPLE>, <callcache>, nil | |
0018 pop | |
0019 putspecialobject 1 ( 6) | |
0021 putobject :as_is | |
0023 putiseq as_is | |
0025 send <callinfo!mid:core#define_method, argc:2, ARGS_SIMPLE>, <callcache>, nil | |
0029 leave | |
== disasm: #<ISeq:func@./sample_test.rb>================================ | |
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | |
[ 1] res | |
0000 putself ( 4) | |
0001 putself | |
0002 send <callinfo!mid:test_value, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache>, nil <=== メソッドが呼ばれている | |
0006 send <callinfo!mid:as_is, argc:1, FCALL|ARGS_SIMPLE>, <callcache>, nil | |
0010 dup | |
0011 setlocal res, 0 | |
0014 leave | |
== disasm: #<ISeq:as_is@./sample_test.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 ( 7) | |
0003 leave |
Author
SpringMT
commented
Nov 14, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment