Class: YTLJit::VM::YARVContext
- Includes:
- Node
- Defined in:
- lib/ytljit/vm_trans.rb
Instance Attribute Summary collapse
-
#current_class_node ⇒ Object
Returns the value of attribute current_class_node.
-
#current_file_name ⇒ Object
Returns the value of attribute current_file_name.
-
#current_line_no ⇒ Object
Returns the value of attribute current_line_no.
-
#current_local_label ⇒ Object
Returns the value of attribute current_local_label.
-
#current_method_node ⇒ Object
Returns the value of attribute current_method_node.
-
#current_node ⇒ Object
Returns the value of attribute current_node.
-
#enc_label ⇒ Object
Returns the value of attribute enc_label.
-
#enc_pos_in_source ⇒ Object
Returns the value of attribute enc_pos_in_source.
-
#exception_table ⇒ Object
Returns the value of attribute exception_table.
-
#expstack ⇒ Object
readonly
Returns the value of attribute expstack.
-
#local_label_list ⇒ Object
readonly
Returns the value of attribute local_label_list.
-
#local_label_tab ⇒ Object
readonly
Returns the value of attribute local_label_tab.
-
#macro_method ⇒ Object
Returns the value of attribute macro_method.
-
#not_reached_pos ⇒ Object
Returns the value of attribute not_reached_pos.
-
#the_top ⇒ Object
Returns the value of attribute the_top.
-
#top_nodes ⇒ Object
readonly
Returns the value of attribute top_nodes.
-
#vmtab ⇒ Object
readonly
Returns the value of attribute vmtab.
Instance Method Summary collapse
- #current_exception_table ⇒ Object
- #debug_info ⇒ Object
- #import_object(klass, name, value) ⇒ Object
-
#initialize(oldcontext = nil) ⇒ YARVContext
constructor
A new instance of YARVContext.
Methods included from Node
Constructor Details
#initialize(oldcontext = nil) ⇒ YARVContext
Returns a new instance of YARVContext.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ytljit/vm_trans.rb', line 6 def initialize(oldcontext = nil) if oldcontext and false then @the_top = oldcontext.the_top else @the_top = TopTopNode.new(nil, Object) end @top_nodes = [@the_top] @current_file_name = nil @current_class_node = @the_top @current_method_node = nil @enc_label = "" @enc_pos_in_source = "" @current_line_no = 0 @current_local_label = nil @current_node = @the_top @vmtab = [] @expstack = [] @local_label_tab = {} @local_label_list = [] @exception_table = {} @not_reached_pos = false @macro_method = nil end |
Instance Attribute Details
#current_class_node ⇒ Object
Returns the value of attribute current_class_node.
42 43 44 |
# File 'lib/ytljit/vm_trans.rb', line 42 def current_class_node @current_class_node end |
#current_file_name ⇒ Object
Returns the value of attribute current_file_name.
41 42 43 |
# File 'lib/ytljit/vm_trans.rb', line 41 def current_file_name @current_file_name end |
#current_line_no ⇒ Object
Returns the value of attribute current_line_no.
47 48 49 |
# File 'lib/ytljit/vm_trans.rb', line 47 def current_line_no @current_line_no end |
#current_local_label ⇒ Object
Returns the value of attribute current_local_label.
48 49 50 |
# File 'lib/ytljit/vm_trans.rb', line 48 def current_local_label @current_local_label end |
#current_method_node ⇒ Object
Returns the value of attribute current_method_node.
43 44 45 |
# File 'lib/ytljit/vm_trans.rb', line 43 def current_method_node @current_method_node end |
#current_node ⇒ Object
Returns the value of attribute current_node.
50 51 52 |
# File 'lib/ytljit/vm_trans.rb', line 50 def current_node @current_node end |
#enc_label ⇒ Object
Returns the value of attribute enc_label.
45 46 47 |
# File 'lib/ytljit/vm_trans.rb', line 45 def enc_label @enc_label end |
#enc_pos_in_source ⇒ Object
Returns the value of attribute enc_pos_in_source.
46 47 48 |
# File 'lib/ytljit/vm_trans.rb', line 46 def enc_pos_in_source @enc_pos_in_source end |
#exception_table ⇒ Object
Returns the value of attribute exception_table.
58 59 60 |
# File 'lib/ytljit/vm_trans.rb', line 58 def exception_table @exception_table end |
#expstack ⇒ Object (readonly)
Returns the value of attribute expstack.
54 55 56 |
# File 'lib/ytljit/vm_trans.rb', line 54 def expstack @expstack end |
#local_label_list ⇒ Object (readonly)
Returns the value of attribute local_label_list.
56 57 58 |
# File 'lib/ytljit/vm_trans.rb', line 56 def local_label_list @local_label_list end |
#local_label_tab ⇒ Object (readonly)
Returns the value of attribute local_label_tab.
55 56 57 |
# File 'lib/ytljit/vm_trans.rb', line 55 def local_label_tab @local_label_tab end |
#macro_method ⇒ Object
Returns the value of attribute macro_method.
62 63 64 |
# File 'lib/ytljit/vm_trans.rb', line 62 def macro_method @macro_method end |
#not_reached_pos ⇒ Object
Returns the value of attribute not_reached_pos.
60 61 62 |
# File 'lib/ytljit/vm_trans.rb', line 60 def not_reached_pos @not_reached_pos end |
#the_top ⇒ Object
Returns the value of attribute the_top.
38 39 40 |
# File 'lib/ytljit/vm_trans.rb', line 38 def the_top @the_top end |
#top_nodes ⇒ Object (readonly)
Returns the value of attribute top_nodes.
39 40 41 |
# File 'lib/ytljit/vm_trans.rb', line 39 def top_nodes @top_nodes end |
#vmtab ⇒ Object (readonly)
Returns the value of attribute vmtab.
52 53 54 |
# File 'lib/ytljit/vm_trans.rb', line 52 def vmtab @vmtab end |
Instance Method Details
#current_exception_table ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ytljit/vm_trans.rb', line 100 def current_exception_table result = {} @exception_table.each do |kind, lst| lst.each do |st, ed, cnt, body| if @local_label_list.include?(st) and !@local_label_list.include?(ed) and body then result[kind] = [st, ed, cnt, body] break end end end result end |
#debug_info ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ytljit/vm_trans.rb', line 85 def debug_info mname = nil if @current_method_node then mname = @current_method_node.get_constant_value end if mname then mname = mname[0] end [@current_file_name, @current_class_node.name, mname, @current_line_no] end |
#import_object(klass, name, value) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/ytljit/vm_trans.rb', line 64 def import_object(klass, name, value) ctn = ClassTopNode.get_class_top_node(klass) if ctn == nil then ctn = ClassTopNode.new(@the_top, klass, klass.name) end valnode = nil if value.is_a?(Class) then valnode = ClassTopNode.get_class_top_node(value) if valnode == nil then valnode = ClassTopNode.new(@the_top, value, value.name) klassclass = valnode.klassclass valnode.type = RubyType::BaseType.from_ruby_class(klassclass) end else valnode = LiteralNode.new(ctn, value) end ctn.get_constant_tab[name] = valnode end |