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
- #call(vm) ⇒ Object
- #canonical ⇒ 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.
3146 3147 3148 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3146 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3144 3145 3146 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3144 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3174 3175 3176 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3174 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3170 3171 3172 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3170 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
3150 3151 3152 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3150 def disasm(fmt) fmt.instruction("opt_le", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3158 3159 3160 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3158 def length 2 end |
#pops ⇒ Object
3162 3163 3164 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3162 def pops 2 end |
#pushes ⇒ Object
3166 3167 3168 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3166 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3154 3155 3156 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3154 def to_a(_iseq) [:opt_le, calldata.to_h] end |