Class: SyntaxTree::YARV::OptGT
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptGT
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_gt 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 4 > 3 ~~~
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) ⇒ OptGT
constructor
A new instance of OptGT.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptGT
3529 3530 3531 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3529 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3527 3528 3529 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3527 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
3545 3546 3547 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3545 def ==(other) other.is_a?(OptGT) && other.calldata == calldata end |
#call(vm) ⇒ Object
3565 3566 3567 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3565 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3561 3562 3563 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3561 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
3541 3542 3543 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3541 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
3533 3534 3535 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3533 def disasm(fmt) fmt.instruction("opt_gt", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3549 3550 3551 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3549 def length 2 end |
#pops ⇒ Object
3553 3554 3555 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3553 def pops 2 end |
#pushes ⇒ Object
3557 3558 3559 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3557 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3537 3538 3539 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3537 def to_a(_iseq) [:opt_gt, calldata.to_h] end |