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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ 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
Returns a new instance of OptLT.
3700 3701 3702 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3700 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3698 3699 3700 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3698 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
3716 3717 3718 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3716 def ==(other) other.is_a?(OptLT) && other.calldata == calldata end |
#call(vm) ⇒ Object
3736 3737 3738 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3736 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3732 3733 3734 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3732 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
3712 3713 3714 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3712 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
3704 3705 3706 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3704 def disasm(fmt) fmt.instruction("opt_lt", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3720 3721 3722 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3720 def length 2 end |
#pops ⇒ Object
3724 3725 3726 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3724 def pops 2 end |
#pushes ⇒ Object
3728 3729 3730 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3728 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3708 3709 3710 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3708 def to_a(_iseq) [:opt_lt, calldata.to_h] end |