Class: CastOff::Compiler::SimpleIR::Concatarray
- Defined in:
- lib/cast_off/compile/ir/call_ir.rb
Constant Summary
Constants included from Instruction
Instruction::BlockSeparator, Instruction::BranchInstruction, Instruction::IgnoreInstruction, Instruction::JumpOrReturnInstruction, Instruction::SupportInstruction, Instruction::TypeInfoUser, Instruction::VM_CALL_ARGS_BLOCKARG_BIT, Instruction::VM_CALL_ARGS_SPLAT_BIT, Instruction::VM_CALL_FCALL_BIT, Instruction::VM_CALL_OPT_SEND_BIT, Instruction::VM_CALL_SUPER_BIT, Instruction::VM_CALL_TAILCALL_BIT, Instruction::VM_CALL_TAILRECURSION_BIT, Instruction::VM_CALL_VCALL_BIT
Instance Attribute Summary
Attributes inherited from VMInsnIR
Attributes inherited from CallIR
#argc, #result_variable, #return_value, #values, #variables, #variables_without_result
Attributes inherited from IR
Instance Method Summary collapse
- #harmless?(recv_p) ⇒ Boolean
-
#initialize(param, argc, return_value, insn, cfg) ⇒ Concatarray
constructor
A new instance of Concatarray.
- #propergate_exact_class(defs) ⇒ Object
- #propergate_guard_usage ⇒ Object
- #side_effect? ⇒ Boolean
- #to_c(params) ⇒ Object
- #type_propergation(defs) ⇒ Object
Methods inherited from VMInsnIR
#dont_duplicate_if_harmless, #should_be_alive?
Methods inherited from CallIR
#can_not_unbox, #mark, #param_irs, #param_variables, #propergate_boxed_value, #sampling_return_value, #sampling_return_value?, #should_be_alive?, #unboxing_prelude
Methods included from Util
Methods inherited from IR
#add_sampling_variable, #alive, #alive?, #dispatch_method?, #generate_guard, #get_definition, #get_definition_str, #get_usage, #get_variable, #inlining_target?, #propergate_boxed_value, #reset, #sampling_variable, #set_info, #standard_guard_target, #unboxing_prelude, #vanish, #vanish?
Constructor Details
#initialize(param, argc, return_value, insn, cfg) ⇒ Concatarray
Returns a new instance of Concatarray.
492 493 494 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 492 def initialize(param, argc, return_value, insn, cfg) super(param, argc, return_value, insn, cfg) end |
Instance Method Details
#harmless?(recv_p) ⇒ Boolean
529 530 531 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 529 def harmless?(recv_p) false # can be call to_a method end |
#propergate_exact_class(defs) ⇒ Object
501 502 503 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 501 def propergate_exact_class(defs) @return_value.class_exact? ? false : @return_value.is_class_exact() end |
#propergate_guard_usage ⇒ Object
496 497 498 499 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 496 def propergate_guard_usage() params = param_irs() params.each{|p| p.need_guard(false)} end |
#side_effect? ⇒ Boolean
533 534 535 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 533 def side_effect? true end |
#to_c(params) ⇒ Object
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 505 def to_c(params) ret = [] ret << super(params) param = param_variables() ary1 = param.shift ary2 = param.shift # FIXME C のヘッダに記述 c_ary = @insn.iseq.use_temporary_c_ary(2) ret << " \#{c_ary}[0] = rb_check_convert_type(\#{ary1}, T_ARRAY, \"Array\", \"to_a\");\n \#{c_ary}[1] = rb_check_convert_type(\#{ary2}, T_ARRAY, \"Array\", \"to_a\");\n if (NIL_P(\#{c_ary}[0])) \#{c_ary}[0] = rb_ary_new3(1, \#{ary1});\n if (NIL_P(\#{c_ary}[1])) \#{c_ary}[1] = rb_ary_new3(1, \#{ary2});\n if (\#{c_ary}[0] == \#{ary1}) \#{c_ary}[0] = rb_ary_dup(\#{ary1});\n \#{@return_value} = rb_ary_concat(\#{c_ary}[0], \#{c_ary}[1]);\n EOS\n bug() unless param.empty?\n ret.join(\"\\n\")\nend\n" |
#type_propergation(defs) ⇒ Object
525 526 527 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 525 def type_propergation(defs) @return_value.is_static([Array]) end |