class Rubinius::CompiledCode

Constants

CODE_ID_BYTES
KernelMethodSerial

Attributes

arity[RW]
block_index[RW]
file[RW]
hints[RW]
iseq[RW]
keywords[RW]
lines[RW]
literals[RW]
local_count[RW]
local_names[RW]
metadata[RW]
name[RW]
post_args[RW]
primitive[RW]
required_args[RW]
scope[RW]
splat[RW]
stack_size[RW]
total_args[RW]

Public Class Methods

new() click to toggle source
# File lib/rubinius/bridge/compiled_code.rb, line 27
def initialize
  @code_id = nil
end

Public Instance Methods

add_metadata(key, val) click to toggle source
# File lib/rubinius/bridge/compiled_code.rb, line 41
def add_metadata(key, val)
  raise TypeError, "key must be a symbol" unless key.kind_of? Symbol

  case val
  when true, false, Symbol, Fixnum, String
    # ok
  else
    raise TypeError, "invalid type of value"
  end

  @metadata ||= nil # to deal with MRI seeing @metadata as not set

  unless @metadata
    @metadata = Tuple.new(2)
    @metadata[0] = key
    @metadata[1] = val
    return val
  end

  i = 0
  fin = @metadata.size

  while i < fin
    if @metadata[i] == key
      @metadata[i + 1] = val
      return val
    end

    i += 2
  end

  tup = Tuple.new(fin + 2)
  tup.copy_from @metadata, 0, fin, 0
  tup[fin] = key
  tup[fin + 1] = val

  @metadata = tup

  return val
end
code_id() click to toggle source
# File lib/rubinius/bridge/compiled_code.rb, line 37
def code_id
  @code_id || (@code_id = SecureRandom.hex(CODE_ID_BYTES))
end
decode(bytecodes = @iseq) click to toggle source
# File lib/rubinius/bridge/compiled_code.rb, line 31
def decode(bytecodes = @iseq)
  # TODO
end