Class: SyntaxTree::YARV::OptGE
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptGE
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_ge 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) ⇒ OptGE
constructor
A new instance of OptGE.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptGE
Returns a new instance of OptGE.
3408 3409 3410 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3408 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3406 3407 3408 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3406 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
3424 3425 3426 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3424 def ==(other) other.is_a?(OptGE) && other.calldata == calldata end |
#call(vm) ⇒ Object
3444 3445 3446 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3444 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3440 3441 3442 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3440 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
3420 3421 3422 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3420 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
3412 3413 3414 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3412 def disasm(fmt) fmt.instruction("opt_ge", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3428 3429 3430 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3428 def length 2 end |
#pops ⇒ Object
3432 3433 3434 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3432 def pops 2 end |
#pushes ⇒ Object
3436 3437 3438 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3436 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3416 3417 3418 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3416 def to_a(_iseq) [:opt_ge, calldata.to_h] end |