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
- #call(vm) ⇒ Object
- #canonical ⇒ 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
132 133 134 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 132 def initialize(cache) @cache = cache end |
Instance Attribute Details
#cache ⇒ Object (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 |
#canonical ⇒ Object
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 |
#length ⇒ Object
144 145 146 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 144 def length 2 end |
#pops ⇒ Object
148 149 150 |
# File 'lib/syntax_tree/yarv/legacy.rb', line 148 def pops 1 end |
#pushes ⇒ Object
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 |