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.
3259
3260
3261
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3259
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3257
3258
3259
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3257
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3275
3276
3277
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3275
def ==(other)
other.is_a?(OptGT) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3295
3296
3297
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3295
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3291
3292
3293
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3291
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3271
3272
3273
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3271
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3263
3264
3265
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3263
def disasm(fmt)
fmt.instruction("opt_gt", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3279
3280
3281
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3279
def length
2
end
|
#pops ⇒ Object
3283
3284
3285
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3283
def pops
2
end
|
#pushes ⇒ Object
3287
3288
3289
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3287
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3267
3268
3269
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3267
def to_a(_iseq)
[:opt_gt, calldata.to_h]
end
|