Class: SyntaxTree::YARV::Legacy::OptSetInlineCache
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::Legacy::OptSetInlineCache
- 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
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(cache) ⇒ OptSetInlineCache
constructor
A new instance of OptSetInlineCache.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(cache) ⇒ OptSetInlineCache
149 150 151 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 149 def initialize(cache) @cache = cache end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
147 148 149 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 147 def cache @cache end |
Instance Method Details
#==(other) ⇒ Object
165 166 167 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 165 def ==(other) other.is_a?(OptSetInlineCache) && other.cache == cache end |
#call(vm) ⇒ Object
185 186 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 185 def call(vm) end |
#canonical ⇒ Object
181 182 183 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 181 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
161 162 163 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 161 def deconstruct_keys(_keys) { cache: cache } end |
#disasm(fmt) ⇒ Object
153 154 155 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 153 def disasm(fmt) fmt.instruction("opt_setinlinecache", [fmt.inline_storage(cache)]) end |
#length ⇒ Object
169 170 171 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 169 def length 2 end |
#pops ⇒ Object
173 174 175 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 173 def pops 1 end |
#pushes ⇒ Object
177 178 179 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 177 def pushes 1 end |
#to_a(_iseq) ⇒ Object
157 158 159 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 157 def to_a(_iseq) [:opt_setinlinecache, cache] end |