Class: SyntaxTree::YARV::OptLE
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptLE
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_le 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) ⇒ OptLE
constructor
A new instance of OptLE.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptLE
Returns a new instance of OptLE.
3586 3587 3588 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3586 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3584 3585 3586 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3584 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
3602 3603 3604 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3602 def ==(other) other.is_a?(OptLE) && other.calldata == calldata end |
#call(vm) ⇒ Object
3622 3623 3624 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3622 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3618 3619 3620 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3618 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
3598 3599 3600 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3598 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
3590 3591 3592 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3590 def disasm(fmt) fmt.instruction("opt_le", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3606 3607 3608 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3606 def length 2 end |
#pops ⇒ Object
3610 3611 3612 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3610 def pops 2 end |
#pushes ⇒ Object
3614 3615 3616 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3614 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3594 3595 3596 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3594 def to_a(_iseq) [:opt_le, calldata.to_h] end |