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.
3488
3489
3490
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3488
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3486
3487
3488
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3486
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3504
3505
3506
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3504
def ==(other)
other.is_a?(OptLT) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3524
3525
3526
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3524
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3520
3521
3522
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3520
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3500
3501
3502
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3500
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3492
3493
3494
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3492
def disasm(fmt)
fmt.instruction("opt_lt", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3508
3509
3510
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3508
def length
2
end
|
#pops ⇒ Object
3512
3513
3514
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3512
def pops
2
end
|
#pushes ⇒ Object
3516
3517
3518
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3516
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3496
3497
3498
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3496
def to_a(_iseq)
[:opt_lt, calldata.to_h]
end
|