Class: SyntaxTree::YARV::OptSucc
Overview
### Summary
‘opt_succ` is a specialization of the `opt_send_without_block` instruction when the method being called is `succ`. Fast paths exist when the receiver is either a String or a Fixnum. It pops the receiver off the stack and pushes on the result.
### Usage
~~~ruby “”.succ ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(calldata) ⇒ OptSucc
Returns a new instance of OptSucc.
4440
4441
4442
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4440
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
4438
4439
4440
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4438
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
4456
4457
4458
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4456
def ==(other)
other.is_a?(OptSucc) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
4476
4477
4478
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4476
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
4472
4473
4474
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4472
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
4452
4453
4454
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4452
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
4444
4445
4446
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4444
def disasm(fmt)
fmt.instruction("opt_succ", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
4460
4461
4462
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4460
def length
2
end
|
#pops ⇒ Object
4464
4465
4466
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4464
def pops
1
end
|
#pushes ⇒ Object
4468
4469
4470
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4468
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4448
4449
4450
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4448
def to_a(_iseq)
[:opt_succ, calldata.to_h]
end
|