Class: SyntaxTree::YARV::OptGE
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
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(calldata) ⇒ OptGE
Returns a new instance of OptGE.
3257
3258
3259
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3257
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3255
3256
3257
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3255
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3273
3274
3275
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3273
def ==(other)
other.is_a?(OptGE) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3293
3294
3295
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3293
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3289
3290
3291
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3289
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3269
3270
3271
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3269
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3261
3262
3263
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3261
def disasm(fmt)
fmt.instruction("opt_ge", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3277
3278
3279
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3277
def length
2
end
|
#pops ⇒ Object
3281
3282
3283
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3281
def pops
2
end
|
#pushes ⇒ Object
3285
3286
3287
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3285
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3265
3266
3267
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3265
def to_a(_iseq)
[:opt_ge, calldata.to_h]
end
|