Class: SyntaxTree::YARV::OptLE
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
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(calldata) ⇒ OptLE
Returns a new instance of OptLE.
3427
3428
3429
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3427
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3425
3426
3427
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3425
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3443
3444
3445
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3443
def ==(other)
other.is_a?(OptLE) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3463
3464
3465
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3463
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3459
3460
3461
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3459
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3439
3440
3441
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3439
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3431
3432
3433
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3431
def disasm(fmt)
fmt.instruction("opt_le", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3447
3448
3449
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3447
def length
2
end
|
#pops ⇒ Object
3451
3452
3453
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3451
def pops
2
end
|
#pushes ⇒ Object
3455
3456
3457
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3455
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3435
3436
3437
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3435
def to_a(_iseq)
[:opt_le, calldata.to_h]
end
|