Class: CastOff::Compiler::SimpleIR::Newarray
- 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) ⇒ Newarray
constructor
A new instance of Newarray.
-
#propergate_exact_class(defs) ⇒ Object
unboxing end ###.
- #propergate_guard_usage ⇒ Object
- #side_effect? ⇒ Boolean
- #to_c(params) ⇒ Object
- #type_propergation(defs) ⇒ Object
-
#unboxing_prelude ⇒ Object
unboxing begin ###.
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?
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, #vanish, #vanish?
Constructor Details
#initialize(param, argc, return_value, insn, cfg) ⇒ Newarray
Returns a new instance of Newarray.
240 241 242 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 240 def initialize(param, argc, return_value, insn, cfg) super(param, argc, return_value, insn, cfg) end |
Instance Method Details
#harmless?(recv_p) ⇒ Boolean
280 281 282 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 280 def harmless?(recv_p) false end |
#propergate_exact_class(defs) ⇒ Object
unboxing end ###
257 258 259 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 257 def propergate_exact_class(defs) @return_value.class_exact? ? false : @return_value.is_class_exact() end |
#propergate_guard_usage ⇒ Object
244 245 246 247 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 244 def propergate_guard_usage() params = param_irs() params.each{|p| p.need_guard(false)} end |
#side_effect? ⇒ Boolean
284 285 286 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 284 def side_effect? false end |
#to_c(params) ⇒ Object
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 261 def to_c(params) ret = [] ret << super(params) param = param_variables() if @argc == 0 ret << " #{@return_value} = rb_ary_new2(0);" else c_ary = @insn.iseq.use_temporary_c_ary(@argc) @argc.times{|i| ret << " #{c_ary}[#{i}] = #{param.shift};"} ret << " #{@return_value} = rb_ary_new4((long)#{@argc}, #{c_ary});" end bug() unless param.empty? ret.join("\n") end |
#type_propergation(defs) ⇒ Object
276 277 278 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 276 def type_propergation(defs) @return_value.is_static([Array]) end |
#unboxing_prelude ⇒ Object
unboxing begin ###
250 251 252 253 254 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 250 def unboxing_prelude() params = param_variables() params.each{|p| p.box()} @return_value.box() unless @return_value.can_unbox? end |