class SyntaxTree::YARV::SetInstanceVariable
~~~
@instance_variable = 1
~~~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
the instance variable associated with the instruction to that value.
‘setinstancevariable` pops a value off the top of the stack and then sets
### Summary
def ==(other)
def ==(other) other.is_a?(SetInstanceVariable) && other.name == name && other.cache == cache end
def call(vm)
def call(vm) method = Object.instance_method(:instance_variable_set) method.bind(vm.frame._self).call(name, vm.pop) end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { name: name, cache: cache } end
def disasm(fmt)
def disasm(fmt) fmt.instruction( "setinstancevariable", [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 pops
def pops 1 end
def to_a(_iseq)
def to_a(_iseq) [:setinstancevariable, name, cache] end