class SyntaxTree::YARV::OptEq

### Summary

‘opt_eq` 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, floats, symbols or strings. It pops both the receiver and the argument off the stack and pushes on the result.

### Usage

~~~ruby 2 == 2 ~~~

Attributes

calldata[R]

Public Class Methods

new(calldata) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3147
def initialize(calldata)
  @calldata = calldata
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3163
def ==(other)
  other.is_a?(OptEq) && other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3183
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3179
def canonical
  Send.new(calldata, nil)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3159
def deconstruct_keys(_keys)
  { calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3151
def disasm(fmt)
  fmt.instruction("opt_eq", [fmt.calldata(calldata)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3167
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3171
def pops
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3175
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3155
def to_a(_iseq)
  [:opt_eq, calldata.to_h]
end