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.
4394
4395
4396
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4394
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
4392
4393
4394
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4392
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
4410
4411
4412
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4410
def ==(other)
other.is_a?(OptSucc) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
4430
4431
4432
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4430
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
4426
4427
4428
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4426
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
4406
4407
4408
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4406
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
4398
4399
4400
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4398
def disasm(fmt)
fmt.instruction("opt_succ", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
4414
4415
4416
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4414
def length
2
end
|
#pops ⇒ Object
4418
4419
4420
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4418
def pops
1
end
|
#pushes ⇒ Object
4422
4423
4424
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4422
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4402
4403
4404
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4402
def to_a(_iseq)
[:opt_succ, calldata.to_h]
end
|