Class: YTLJit::VM::Node::ConstantAssignNode
- Inherits:
-
VariableRefCommonNode
- Object
- BaseNode
- VariableRefCommonNode
- YTLJit::VM::Node::ConstantAssignNode
- Includes:
- HaveChildlenMixin, NodeUtil, TypeListWithoutSignature
- Defined in:
- lib/ytljit/vm.rb
Constant Summary
Constants inherited from BaseNode
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
Attributes included from HaveChildlenMixin
Attributes inherited from BaseNode
#code_space, #debug_info, #element_node_list, #id, #is_escape, #parent, #ti_observee, #ti_observer, #type
Instance Method Summary collapse
- #collect_candidate_type(context) ⇒ Object
- #compile(context) ⇒ Object
-
#compile_get_constant(context) ⇒ Object
def type @value.type end.
-
#initialize(parent, klass, name, value) ⇒ ConstantAssignNode
constructor
A new instance of ConstantAssignNode.
- #traverse_childlen {|@value| ... } ⇒ Object
Methods included from TypeListWithoutSignature
#add_type, #set_type_list, #type_list, #type_list_initvar
Methods included from NodeUtil
#search_class_top, #search_end, #search_frame_info, #search_top
Methods inherited from BaseNode
#add_element_node, #add_element_node_backward, #add_element_node_backward_aux, #collect_info, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_element_node, #marge_type, #same_type, #search_valid_signature, #set_escape_node, #set_escape_node_backward, #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, klass, name, value) ⇒ ConstantAssignNode
Returns a new instance of ConstantAssignNode.
4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 |
# File 'lib/ytljit/vm.rb', line 4090 def initialize(parent, klass, name, value) super(parent) @name = name @class_top = klass # .search_class_top pvalue = nil @value = value @value_node = value if !value.is_a?(LiteralNode) then @value_node = self end if klass.is_a?(ClassTopNode) then klass.constant_tab[@name] = @value_node else pp klass.class raise "Not Implemented yet for set constant for dynamic class" end @constant_area = nil end |
Instance Method Details
#collect_candidate_type(context) ⇒ Object
4116 4117 4118 4119 4120 4121 |
# File 'lib/ytljit/vm.rb', line 4116 def collect_candidate_type(context) sig = context.to_signature context = @value.collect_candidate_type(context) same_type(self, @value, sig, sig, context) @body.collect_candidate_type(context) end |
#compile(context) ⇒ Object
4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 |
# File 'lib/ytljit/vm.rb', line 4143 def compile(context) if !@value.is_a?(LiteralNode) then asm = context.assembler valproc = lambda { 4 } varnilval = OpVarMemAddress.new(valproc) @constant_area = asm.add_value_entry_no_cache(varnilval) @constant_area = @constant_area.to_immidiate context = @value.compile(context) rtype = decide_type_once(context.to_signature) tmpr = TMPR if rtype.ruby_type == Float and !rtype.boxed then tmpr = XMM0 end asm.with_retry do asm.push(TMPR2) asm.mov(tmpr, context.ret_reg) asm.mov(TMPR2, @constant_area) asm.mov(INDIRECT_TMPR2, tmpr) asm.pop(TMPR2) end end @body.compile(context) end |
#compile_get_constant(context) ⇒ Object
def type
@value.type
end
4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 |
# File 'lib/ytljit/vm.rb', line 4127 def compile_get_constant(context) asm = context.assembler rtype = decide_type_once(context.to_signature) retr = RETR if rtype.ruby_type == Float and !rtype.boxed then retr = XMM0 end asm.with_retry do asm.mov(TMPR, @constant_area) asm.mov(retr, INDIRECT_TMPR) end context.ret_reg = retr context.ret_node = self context end |
#traverse_childlen {|@value| ... } ⇒ Object
4111 4112 4113 4114 |
# File 'lib/ytljit/vm.rb', line 4111 def traverse_childlen yield @value yield @body end |