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