Class: CastOff::Compiler::SimpleIR::JumpGuard

Inherits:
GuardIR
  • Object
show all
Defined in:
lib/cast_off/compile/ir/guard_ir.rb

Constant Summary

Constants inherited from GuardIR

GuardIR::CLASS_CHECK_FUNCTION_TEMPLATE_COMPLEX, GuardIR::CLASS_CHECK_FUNCTION_TEMPLATE_SIMPLE, GuardIR::GUARD_CHECK_TEMPLATE, GuardIR::GUARD_DEOPTIMIZATION_TEMPLATE, GuardIR::GUARD_EXCEPTION_FUNCTION_TEMPLATE, GuardIR::GUARD_RECOMPILATION_FUNCTION_TEMPLATE, GuardIR::GUARD_TEMPLATE

Instance Attribute Summary

Attributes inherited from GuardIR

#guard_value, #result_variable, #values, #variables, #variables_without_result

Attributes inherited from IR

#alias, #insn

Instance Method Summary collapse

Methods inherited from GuardIR

#mark, #propergate_boxed_value, #propergate_exact_class, #unboxing_prelude

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, #propergate_guard_usage, #sampling_variable, #set_info, #standard_guard_target, #unboxing_prelude, #vanish, #vanish?

Methods included from Util

#bug, #dlog, #todo, #vlog

Constructor Details

#initialize(val, vars, insn, cfg) ⇒ JumpGuard

Returns a new instance of JumpGuard.



413
414
415
416
# File 'lib/cast_off/compile/ir/guard_ir.rb', line 413

def initialize(val, vars, insn, cfg)
  super(val, vars, insn, cfg)
  @bool = bool_value()
end

Instance Method Details

#resetObject



422
423
424
425
426
427
428
429
430
431
432
# File 'lib/cast_off/compile/ir/guard_ir.rb', line 422

def reset()
  super()
  if @configuration.deoptimize?
    bug() unless @dependent_variables
    @dependent_variables.map! do |v|
      bug() unless v.is_a?(Variable)
      @cfg.find_variable(v)
    end
    bug() if @dependent_variables.include?(nil)
  end
end

#to_cObject



438
439
440
441
# File 'lib/cast_off/compile/ir/guard_ir.rb', line 438

def to_c()
  bug() unless @bool == bool_value()
  super()
end

#to_debug_stringObject



434
435
436
# File 'lib/cast_off/compile/ir/guard_ir.rb', line 434

def to_debug_string()
  "JumpGuard(#{@guard_value.to_debug_string()})"
end

#type_propergation(defs) ⇒ Object



418
419
420
# File 'lib/cast_off/compile/ir/guard_ir.rb', line 418

def type_propergation(defs)
  defs.type_resolve(@guard_value) #分岐のみで使用されるインスタンス変数等のために必要
end