Class: VMLib::InstSeqTree
Constant Summary collapse
- Headers =
%w(magic major_version minor_version format_type misc name filename filepath line type locals args exception_table)
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #init_from_ary(ary) ⇒ Object
-
#initialize(parent = nil, iseq = nil) ⇒ InstSeqTree
constructor
call-seq: VMLib::InstSeqTree.new(parent, iseq) parent Partent of InstSeqTree For example, when you will construct InstSeqTree of the method body, you must ‘parent’ is InstSeqTree of definition code of the method.
- #to_a ⇒ Object
Constructor Details
#initialize(parent = nil, iseq = nil) ⇒ InstSeqTree
call-seq:
VMLib::InstSeqTree.new(parent, iseq)
parent Partent of InstSeqTree
For example, when you will construct InstSeqTree of
the method body, you must 'parent' is InstSeqTree of definition
code of the method.
If parent is none, 'parent' is nil.
iseq Instruction Sequence, Normally the result of
VM::InstructionSequence.compile(...) or
VM::InstructionSequence.compile_file(...)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ytljit/rubyvm.rb', line 22 def initialize(parent = nil, iseq = nil) @lblock = {} @lblock_list = [nil] @header = {} @body = nil @parent = parent Headers.each do |name| @header[name] = nil end if iseq then init_from_ary(iseq.to_a) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
40 41 42 |
# File 'lib/ytljit/rubyvm.rb', line 40 def body @body end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
39 40 41 |
# File 'lib/ytljit/rubyvm.rb', line 39 def header @header end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
41 42 43 |
# File 'lib/ytljit/rubyvm.rb', line 41 def parent @parent end |
Instance Method Details
#init_from_ary(ary) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/ytljit/rubyvm.rb', line 43 def init_from_ary(ary) i = 0 Headers.each do |name| @header[name] = ary[i] i = i + 1 end @body = ary[i] end |
#to_a ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/ytljit/rubyvm.rb', line 53 def to_a res = [] Headers.each do |name| res.push @header[name] end res.push @body res end |