Class: CastOff::Compiler::SimpleIR::DynamicVariable

Inherits:
Pointer show all
Defined in:
lib/cast_off/compile/ir/operand.rb

Constant Summary

Constants inherited from TypeContainer

TypeContainer::FixnumWrapper, TypeContainer::FloatWrapper

Instance Attribute Summary collapse

Attributes inherited from TypeContainer

#state, #types

Instance Method Summary collapse

Methods inherited from Variable

#class_exact?, #has_undefined_path, #is_class_exact, #reset

Methods inherited from TypeContainer

#box, #boxed?, #boxed_form, #can_unbox?, #class_exact?, #declare, #declare_class, #dynamic?, #is_also, #is_also?, #is_annotated, #is_class_exact, #is_dynamic, #is_just?, #is_negative_cond_value, #is_not, #is_static, #not_initialized, #reset, #static?, #to_debug_string, #to_s, #unboxed?, #undefined?, #union

Methods included from Util

#bug, #dlog, #todo, #vlog

Constructor Details

#initialize(name, idx, op_idx, lv, types) ⇒ DynamicVariable

Returns a new instance of DynamicVariable.



789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/cast_off/compile/ir/operand.rb', line 789

def initialize(name, idx, op_idx, lv, types)
  super()
  @name = name
  @index = idx
  @op_idx = op_idx
  @level = lv

  if types
    bug() unless types.is_a?(Array)
    is_annotated(types)
  end
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



787
788
789
# File 'lib/cast_off/compile/ir/operand.rb', line 787

def index
  @index
end

#levelObject (readonly)

Returns the value of attribute level.



787
788
789
# File 'lib/cast_off/compile/ir/operand.rb', line 787

def level
  @level
end

Instance Method Details

#==(v) ⇒ Object



815
816
817
# File 'lib/cast_off/compile/ir/operand.rb', line 815

def ==(v)
  eql?(v)
end

#declare?Boolean

Returns:

  • (Boolean)


823
824
825
# File 'lib/cast_off/compile/ir/operand.rb', line 823

def declare?
  false
end

#eql?(v) ⇒ Boolean

Returns:

  • (Boolean)


810
811
812
813
# File 'lib/cast_off/compile/ir/operand.rb', line 810

def eql?(v)
  return false unless v.is_a?(DynamicVariable)
  @index == v.index && @level == v.level
end

#hashObject



819
820
821
# File 'lib/cast_off/compile/ir/operand.rb', line 819

def hash
  self.to_name.hash
end

#sourceObject



806
807
808
# File 'lib/cast_off/compile/ir/operand.rb', line 806

def source
  @name.to_s
end

#to_nameObject



802
803
804
# File 'lib/cast_off/compile/ir/operand.rb', line 802

def to_name
  "dfp#{@level}[#{@op_idx}]"
end