Class: YTLJit::TypeUtil::TypeContainer
Instance Method Summary collapse
- #add_node(key) ⇒ Object
- #add_type(key, type, pos) ⇒ Object
-
#initialize ⇒ TypeContainer
constructor
A new instance of TypeContainer.
- #search_types(key) ⇒ Object
- #to_signature(context, offset = -1)) ⇒ Object
- #type_list(key) ⇒ Object
Constructor Details
#initialize ⇒ TypeContainer
Returns a new instance of TypeContainer.
82 83 84 |
# File 'lib/ytljit/vm_type.rb', line 82 def initialize @types_tree = KlassTree.new end |
Instance Method Details
#add_node(key) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/ytljit/vm_type.rb', line 117 def add_node(key) # inherit types of most similar signature ival = [[], []] simnode = @types_tree.add(key, ival) =begin simnode.value.each do |ele| ival.push ele end =end simnode end |
#add_type(key, type, pos) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ytljit/vm_type.rb', line 94 def add_type(key, type, pos) tvs = @types_tree.search(key) if tvs then tvsv = tvs.value[pos] if !tvsv.include? type then tvsv.push type end else # inherit types of most similar signature ival = [[], []] simnode = @types_tree.add(key, ival) =begin simnode.value.each do |ele| ival.push ele end =end if !ival.include? type then ival[pos].push type end end end |
#search_types(key) ⇒ Object
90 91 92 |
# File 'lib/ytljit/vm_type.rb', line 90 def search_types(key) @types_tree.search(key) end |
#to_signature(context, offset = -1)) ⇒ Object
86 87 88 |
# File 'lib/ytljit/vm_type.rb', line 86 def to_signature(context, offset = -1) context.current_method_signature[offset] end |
#type_list(key) ⇒ Object
130 131 132 133 134 135 136 137 |
# File 'lib/ytljit/vm_type.rb', line 130 def type_list(key) res = search_types(key) if res == nil then res = add_node(key) end res end |