Class: SyntaxTree::YARV::OptLT
Overview
### Summary
‘opt_lt` 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) ⇒ OptLT
Returns a new instance of OptLT.
3541
3542
3543
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3541
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3539
3540
3541
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3539
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3557
3558
3559
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3557
def ==(other)
other.is_a?(OptLT) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3577
3578
3579
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3577
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3573
3574
3575
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3573
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3553
3554
3555
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3553
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3545
3546
3547
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3545
def disasm(fmt)
fmt.instruction("opt_lt", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3561
3562
3563
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3561
def length
2
end
|
#pops ⇒ Object
3565
3566
3567
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3565
def pops
2
end
|
#pushes ⇒ Object
3569
3570
3571
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3569
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3549
3550
3551
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3549
def to_a(_iseq)
[:opt_lt, calldata.to_h]
end
|