class RubyVM::RJIT::Context

Public Class Methods

new(stack_size: 0, sp_offset: 0, chain_depth: 0) click to toggle source
Calls superclass method
# File lib/ruby_vm/rjit/context.rb, line 7
  def initialize(stack_size: 0, sp_offset: 0, chain_depth: 0) = super

  def stack_push(size = 1)
    self.stack_size += size
    self.sp_offset += size
    stack_opnd(0)
  end

  def stack_pop(size = 1)
    opnd = stack_opnd(0)
    self.stack_size -= size
    self.sp_offset -= size
    opnd
  end

  def stack_opnd(depth_from_top)
    [SP, C.VALUE.size * (self.sp_offset - 1 - depth_from_top)]
  end

  def sp_opnd(offset_bytes = 0)
    [SP, (C.VALUE.size * self.sp_offset) + offset_bytes]
  end
end

Public Instance Methods

sp_opnd(offset_bytes = 0) click to toggle source
# File lib/ruby_vm/rjit/context.rb, line 26
def sp_opnd(offset_bytes = 0)
  [SP, (C.VALUE.size * self.sp_offset) + offset_bytes]
end
stack_opnd(depth_from_top) click to toggle source
# File lib/ruby_vm/rjit/context.rb, line 22
def stack_opnd(depth_from_top)
  [SP, C.VALUE.size * (self.sp_offset - 1 - depth_from_top)]
end
stack_pop(size = 1) click to toggle source
# File lib/ruby_vm/rjit/context.rb, line 15
def stack_pop(size = 1)
  opnd = stack_opnd(0)
  self.stack_size -= size
  self.sp_offset -= size
  opnd
end
stack_push(size = 1) click to toggle source
# File lib/ruby_vm/rjit/context.rb, line 9
def stack_push(size = 1)
  self.stack_size += size
  self.sp_offset += size
  stack_opnd(0)
end