class SyntaxTree::YARV::GetInstanceVariable
~~~
@instance_variable
~~~ruby
### Usage
instead so the caches are unique per instruction.
instructions and could be shared. Since Ruby 3.2, it uses object shapes
Ruby 3.2, the inline cache corresponded to both the get and set
This instruction has two forms, but both have the same structure. Before
variable in the class hierarchy every time.
stack. It uses an inline cache to avoid having to look up the instance
`getinstancevariable` pushes the value of an instance variable onto the
### Summary
def ==(other)
def ==(other) other.is_a?(GetInstanceVariable) && other.name == name && other.cache == cache end
def call(vm)
def call(vm) method = Object.instance_method(:instance_variable_get) vm.push(method.bind(vm.frame._self).call(name)) end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { name: name, cache: cache } end
def disasm(fmt)
def disasm(fmt) fmt.instruction( "getinstancevariable", [fmt.object(name), fmt.inline_storage(cache)] ) end
def initialize(name, cache)
def initialize(name, cache) @name = name @cache = cache end
def length
def length 3 end
def pushes
def pushes 1 end
def to_a(_iseq)
def to_a(_iseq) [:getinstancevariable, name, cache] end