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 {|@body| ... } ⇒ 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, #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, #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.
3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 |
# File 'lib/ytljit/vm.rb', line 3521 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
3546 3547 3548 3549 3550 3551 |
# File 'lib/ytljit/vm.rb', line 3546 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
3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 |
# File 'lib/ytljit/vm.rb', line 3573 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
3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 |
# File 'lib/ytljit/vm.rb', line 3557 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 {|@body| ... } ⇒ Object
3542 3543 3544 |
# File 'lib/ytljit/vm.rb', line 3542 def traverse_childlen yield @body end |