Class: YTLJit::VM::Node::ClassTopNode
- Includes:
- MethodTopCodeGen, SendNodeCodeGen
- Defined in:
- lib/ytljit/vm.rb
Direct Known Subclasses
Constant Summary collapse
- @@class_top_tab =
{}
Constants included from AbsArch
AbsArch::AL, AbsArch::BL, AbsArch::CL, AbsArch::DL, AbsArch::FUNC_ARG, AbsArch::FUNC_ARG_YTL, AbsArch::FUNC_FLOAT_ARG, AbsArch::FUNC_FLOAT_ARG_YTL, AbsArch::INDIRECT_BPR, AbsArch::INDIRECT_RETR, AbsArch::INDIRECT_SPR, AbsArch::INDIRECT_TMPR, AbsArch::INDIRECT_TMPR2, AbsArch::INDIRECT_TMPR3
Constants included from SSE
SSE::XMM0, SSE::XMM1, SSE::XMM2, SSE::XMM3, SSE::XMM4, SSE::XMM5, SSE::XMM6, SSE::XMM7
Instance Attribute Summary collapse
-
#constant_tab ⇒ Object
readonly
Returns the value of attribute constant_tab.
-
#klass_object ⇒ Object
readonly
Returns the value of attribute klass_object.
-
#method_tab ⇒ Object
readonly
Returns the value of attribute method_tab.
Attributes inherited from TopNode
#end_nodes, #name, #orig_modified_local_var, #signature_cache, #yield_node
Attributes included from HaveChildlenMixin
Attributes inherited from BaseNode
#code_space, #element_node_list, #id, #parent, #ti_observee, #ti_observer, #type
Class Method Summary collapse
Instance Method Summary collapse
- #collect_candidate_type(context, signode, sig) ⇒ Object
- #collect_info(context) ⇒ Object
- #compile(context) ⇒ Object
- #construct_frame_info(locals, argnum) ⇒ Object
- #get_constant_tab(klassobj = @klass_object) ⇒ Object
- #get_constant_value ⇒ Object
- #get_method_tab(klassobj = @klass_object) ⇒ Object
-
#initialize(parent, klassobj, name = nil) ⇒ ClassTopNode
constructor
A new instance of ClassTopNode.
- #make_klassclass_node ⇒ Object
- #search_constant_with_super(name, klassobj = @klass_object) ⇒ Object
- #search_method_with_super(name, klassobj = @klass_object) ⇒ Object
Methods included from MethodTopCodeGen
Methods included from SendNodeCodeGen
#dump_context, #gen_call, #gen_make_argv
Methods inherited from TopNode
#add_cs_for_signature, #disp_signature, #find_cs_by_signature, #modified_instance_var, #traverse_childlen
Methods included from NodeUtil
#search_class_top, #search_end, #search_frame_info, #search_top
Methods included from HaveChildlenMixin
Methods inherited from BaseNode
#add_element_node, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #inference_type, #merge_type, #same_type, #ti_add_observer, #ti_changed, #ti_del_link, #ti_reset, #ti_update
Methods included from TypeListWithSignature
#add_type, #set_type_list, #type_list, #type_list_initvar
Methods included from Inspect
Constructor Details
#initialize(parent, klassobj, name = nil) ⇒ ClassTopNode
Returns a new instance of ClassTopNode.
920 921 922 923 924 925 926 927 928 929 930 931 932 |
# File 'lib/ytljit/vm.rb', line 920 def initialize(parent, klassobj, name = nil) super(parent, name) @constant_tab = {} @method_tab = {} @klass_object = klassobj @klassclass = ClassClassWrapper.new(@klass_object) @klassclass_node = nil # Lazy RubyType::define_wraped_class(@klassclass, RubyType::RubyTypeBoxed) unless @@class_top_tab[klassobj] @@class_top_tab[klassobj] = self end end |
Instance Attribute Details
#constant_tab ⇒ Object (readonly)
Returns the value of attribute constant_tab.
1011 1012 1013 |
# File 'lib/ytljit/vm.rb', line 1011 def constant_tab @constant_tab end |
#klass_object ⇒ Object (readonly)
Returns the value of attribute klass_object.
1010 1011 1012 |
# File 'lib/ytljit/vm.rb', line 1010 def klass_object @klass_object end |
#method_tab ⇒ Object (readonly)
Returns the value of attribute method_tab.
1012 1013 1014 |
# File 'lib/ytljit/vm.rb', line 1012 def method_tab @method_tab end |
Class Method Details
.get_class_top_node(klass) ⇒ Object
916 917 918 |
# File 'lib/ytljit/vm.rb', line 916 def self.get_class_top_node(klass) @@class_top_tab[klass] end |
Instance Method Details
#collect_candidate_type(context, signode, sig) ⇒ Object
946 947 948 949 950 951 952 953 |
# File 'lib/ytljit/vm.rb', line 946 def collect_candidate_type(context, signode, sig) super if @klassclass_node then @klassclass_node.collect_candidate_type(context, signode, sig) else context end end |
#collect_info(context) ⇒ Object
934 935 936 937 938 939 940 941 942 943 944 |
# File 'lib/ytljit/vm.rb', line 934 def collect_info(context) context.modified_local_var.push [{}] context.modified_instance_var = Hash.new context = super context.modified_local_var.pop if @klassclass_node then @klassclass_node.collect_info(context) else context end end |
#compile(context) ⇒ Object
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File 'lib/ytljit/vm.rb', line 1039 def compile(context) context = super(context) cs = self.find_cs_by_signature(context.to_signature) if cs then asm = context.assembler add = lambda { @klassclass.value.address } var_klassclass = OpVarImmidiateAddress.new(add) context.start_using_reg(FUNC_ARG[0]) context.start_using_reg(FUNC_ARG[1]) context.start_using_reg(FUNC_ARG[2]) asm.with_retry do asm.mov(FUNC_ARG_YTL[0], BPR) asm.mov(FUNC_ARG_YTL[1], 4) asm.mov(FUNC_ARG_YTL[2], var_klassclass) end add = cs.var_base_address context = gen_call(context, add, 3) context.end_using_reg(FUNC_ARG[2]) context.end_using_reg(FUNC_ARG[1]) context.end_using_reg(FUNC_ARG[0]) end context end |
#construct_frame_info(locals, argnum) ⇒ Object
1014 1015 1016 1017 1018 1019 1020 |
# File 'lib/ytljit/vm.rb', line 1014 def construct_frame_info(locals, argnum) locals.unshift :_self locals.unshift :_block locals.unshift :_prev_env argnum += 3 super(locals, argnum) end |
#get_constant_tab(klassobj = @klass_object) ⇒ Object
972 973 974 975 976 977 978 979 980 |
# File 'lib/ytljit/vm.rb', line 972 def get_constant_tab(klassobj = @klass_object) ktop = @@class_top_tab[klassobj] if ktop then ktop.constant_tab else ktop.constant_tab = {} ktop.constant_tab end end |
#get_constant_value ⇒ Object
1065 1066 1067 |
# File 'lib/ytljit/vm.rb', line 1065 def get_constant_value [@klass_object] end |
#get_method_tab(klassobj = @klass_object) ⇒ Object
963 964 965 966 967 968 969 970 |
# File 'lib/ytljit/vm.rb', line 963 def get_method_tab(klassobj = @klass_object) ktop = @@class_top_tab[klassobj] if ktop then ktop.method_tab else {} end end |
#make_klassclass_node ⇒ Object
955 956 957 958 959 960 961 |
# File 'lib/ytljit/vm.rb', line 955 def make_klassclass_node clsclsnode = ClassTopNode.new(self, @klassclass, @klassclass.name) clsclsnode.body = DummyNode.new @klassclass_node = clsclsnode end |
#search_constant_with_super(name, klassobj = @klass_object) ⇒ Object
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 |
# File 'lib/ytljit/vm.rb', line 996 def search_constant_with_super(name, klassobj = @klass_object) clsnode = @@class_top_tab[klassobj] if clsnode then ctab = clsnode.get_constant_tab if val = ctab[name] then return [val, clsnode] end return search_constant_with_super(name, klassobj.superclass) end [nil, nil] end |
#search_method_with_super(name, klassobj = @klass_object) ⇒ Object
982 983 984 985 986 987 988 989 990 991 992 993 994 |
# File 'lib/ytljit/vm.rb', line 982 def search_method_with_super(name, klassobj = @klass_object) clsnode = @@class_top_tab[klassobj] if clsnode then mtab = clsnode.get_method_tab if val = mtab[name] then return [val, clsnode] end return search_method_with_super(name, klassobj.superclass) end [nil, nil] end |