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.
3374
3375
3376
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3374
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3372
3373
3374
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3372
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3390
3391
3392
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3390
def ==(other)
other.is_a?(OptLE) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3410
3411
3412
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3410
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3406
3407
3408
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3406
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3386
3387
3388
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3386
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3378
3379
3380
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3378
def disasm(fmt)
fmt.instruction("opt_le", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3394
3395
3396
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3394
def length
2
end
|
#pops ⇒ Object
3398
3399
3400
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3398
def pops
2
end
|
#pushes ⇒ Object
3402
3403
3404
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3402
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3382
3383
3384
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3382
def to_a(_iseq)
[:opt_le, calldata.to_h]
end
|