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
- #call(vm) ⇒ Object
- #canonical ⇒ 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
2992 2993 2994 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2992 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
2990 2991 2992 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2990 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3020 3021 3022 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3020 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3016 3017 3018 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3016 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
2996 2997 2998 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2996 def disasm(fmt) fmt.instruction("opt_ge", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3004 3005 3006 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3004 def length 2 end |
#pops ⇒ Object
3008 3009 3010 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3008 def pops 2 end |
#pushes ⇒ Object
3012 3013 3014 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3012 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3000 3001 3002 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3000 def to_a(_iseq) [:opt_ge, calldata.to_h] end |