Class: YTLJit::VM::CollectInfoContext

Inherits:
Object
  • Object
show all
Defined in:
lib/ytljit/vm_codegen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tnode) ⇒ CollectInfoContext

Returns a new instance of CollectInfoContext.



77
78
79
80
81
82
83
84
85
86
# File 'lib/ytljit/vm_codegen.rb', line 77

def initialize(tnode)
  @top_node = tnode
  @modified_local_var = []
  @modified_instance_var = Hash.new
  @modified_global_var = Hash.new
  @yield_node = []

  # Options from user
  @options = {}
end

Instance Attribute Details

#modified_global_varObject

Returns the value of attribute modified_global_var.



91
92
93
# File 'lib/ytljit/vm_codegen.rb', line 91

def modified_global_var
  @modified_global_var
end

#modified_instance_varObject

Returns the value of attribute modified_instance_var.



90
91
92
# File 'lib/ytljit/vm_codegen.rb', line 90

def modified_instance_var
  @modified_instance_var
end

#modified_local_varObject

Returns the value of attribute modified_local_var.



89
90
91
# File 'lib/ytljit/vm_codegen.rb', line 89

def modified_local_var
  @modified_local_var
end

#optionsObject

Returns the value of attribute options.



93
94
95
# File 'lib/ytljit/vm_codegen.rb', line 93

def options
  @options
end

#top_nodeObject (readonly)

Returns the value of attribute top_node.



88
89
90
# File 'lib/ytljit/vm_codegen.rb', line 88

def top_node
  @top_node
end

#yield_nodeObject

Returns the value of attribute yield_node.



92
93
94
# File 'lib/ytljit/vm_codegen.rb', line 92

def yield_node
  @yield_node
end

Instance Method Details

#marge_local_var(lvlist) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ytljit/vm_codegen.rb', line 95

def marge_local_var(lvlist)
  res = nil
  lvlist.each do |lvs|
    if res then
      lvs.each_with_index do |lvt, i|
        dst = res[i]
        lvt.each do |idx, vall|
          dst[idx] = dst[idx] | vall
        end
      end
    else
      res = lvs.map {|lvt| lvt.dup}
    end
  end

  @modified_local_var[-1] = res
end