Class: SyntaxTree::YARV::Legacy::OptSetInlineCache

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/yarv/legacy.rb

Overview

### Summary

opt_setinlinecache sets an inline cache for a constant lookup. It pops the value it should set off the top of the stack. It uses this value to set the cache. It then pushes that value back onto the top of the stack.

This instruction is no longer used since in Ruby 3.2 it was replaced by the consolidated opt_getconstant_path instruction.

### Usage

~~~ruby Constant ~~~

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache) ⇒ OptSetInlineCache



132
133
134
# File 'lib/syntax_tree/yarv/legacy.rb', line 132

def initialize(cache)
  @cache = cache
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



130
131
132
# File 'lib/syntax_tree/yarv/legacy.rb', line 130

def cache
  @cache
end

Instance Method Details

#call(vm) ⇒ Object



160
161
# File 'lib/syntax_tree/yarv/legacy.rb', line 160

def call(vm)
end

#canonicalObject



156
157
158
# File 'lib/syntax_tree/yarv/legacy.rb', line 156

def canonical
  self
end

#disasm(fmt) ⇒ Object



136
137
138
# File 'lib/syntax_tree/yarv/legacy.rb', line 136

def disasm(fmt)
  fmt.instruction("opt_setinlinecache", [fmt.inline_storage(cache)])
end

#lengthObject



144
145
146
# File 'lib/syntax_tree/yarv/legacy.rb', line 144

def length
  2
end

#popsObject



148
149
150
# File 'lib/syntax_tree/yarv/legacy.rb', line 148

def pops
  1
end

#pushesObject



152
153
154
# File 'lib/syntax_tree/yarv/legacy.rb', line 152

def pushes
  1
end

#to_a(_iseq) ⇒ Object



140
141
142
# File 'lib/syntax_tree/yarv/legacy.rb', line 140

def to_a(_iseq)
  [:opt_setinlinecache, cache]
end