Class: CastOff::Compiler::SimpleIR::Splatarray

Inherits:
VMInsnIR show all
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

#argv

Attributes inherited from CallIR

#argc, #result_variable, #return_value, #values, #variables, #variables_without_result

Attributes inherited from IR

#alias, #insn

Instance Method Summary collapse

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, #propergate_exact_class, #sampling_return_value, #sampling_return_value?, #should_be_alive?, #unboxing_prelude

Methods included from Util

#bug, #dlog, #todo, #vlog

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) ⇒ Splatarray



890
891
892
# File 'lib/cast_off/compile/ir/call_ir.rb', line 890

def initialize(param, argc, return_value, insn, cfg)
  super(param, argc, return_value, insn, cfg)
end

Instance Method Details

#harmless?(recv_p) ⇒ Boolean



919
920
921
# File 'lib/cast_off/compile/ir/call_ir.rb', line 919

def harmless?(recv_p)
  false # can be return self
end

#propergate_guard_usageObject



894
895
896
897
# File 'lib/cast_off/compile/ir/call_ir.rb', line 894

def propergate_guard_usage()
  params = param_irs()
  params.each{|p| p.need_guard(false)}
end

#side_effect?Boolean



923
924
925
# File 'lib/cast_off/compile/ir/call_ir.rb', line 923

def side_effect?
  true
end

#to_c(params) ⇒ Object



899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
# File 'lib/cast_off/compile/ir/call_ir.rb', line 899

def to_c(params)
  ret = []
  ret << super(params)
  param = param_variables()
  ary = param.shift
  # FIXME ary の型を考慮
  # Nil にならないと分かっていたら、nil かどうかの確認は消せる
  ret << <<-EOS
  cast_off_tmp = rb_check_convert_type(#{ary}, T_ARRAY, "Array", "to_a");
  if (NIL_P(cast_off_tmp)) cast_off_tmp = rb_ary_new3(1, #{ary});
  #{@return_value} = cast_off_tmp;
  EOS
  bug() unless param.empty?
  ret.join("\n")
end

#type_propergation(defs) ⇒ Object



915
916
917
# File 'lib/cast_off/compile/ir/call_ir.rb', line 915

def type_propergation(defs)
  @return_value.is_static([Array])
end