Class: SyntaxTree::YARV::OptLT
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptLT
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_lt is a specialization of the opt_send_without_block instruction that occurs when the < operator is used. Fast paths exist when both operands are integers or floats. It pops both the receiver and the argument off the stack and pushes on the result.
### Usage
~~~ruby 3 < 4 ~~~
Instance Attribute Summary collapse
-
#calldata ⇒ Object
readonly
Returns the value of attribute calldata.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(calldata) ⇒ OptLT
constructor
A new instance of OptLT.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptLT
3244 3245 3246 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3244 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3242 3243 3244 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3242 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3272 3273 3274 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3272 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3268 3269 3270 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3268 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
3248 3249 3250 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3248 def disasm(fmt) fmt.instruction("opt_lt", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3256 3257 3258 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3256 def length 2 end |
#pops ⇒ Object
3260 3261 3262 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3260 def pops 2 end |
#pushes ⇒ Object
3264 3265 3266 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3264 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3252 3253 3254 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3252 def to_a(_iseq) [:opt_lt, calldata.to_h] end |