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
- #call(vm) ⇒ Object
- #canonical ⇒ 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
Returns a new instance of OptGT.
3097 3098 3099 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3097 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3095 3096 3097 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3095 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3125 3126 3127 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3125 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3121 3122 3123 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3121 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
3101 3102 3103 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3101 def disasm(fmt) fmt.instruction("opt_gt", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3109 3110 3111 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3109 def length 2 end |
#pops ⇒ Object
3113 3114 3115 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3113 def pops 2 end |
#pushes ⇒ Object
3117 3118 3119 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3117 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3105 3106 3107 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3105 def to_a(_iseq) [:opt_gt, calldata.to_h] end |