wip, fixed some label, need more fixing
This commit is contained in:
@ -5,6 +5,7 @@ module Risc
|
||||
def self.collect_space
|
||||
@objects = {}
|
||||
keep Parfait.object_space , 0
|
||||
puts "CONST #{Risc.machine.constants}"
|
||||
Risc.machine.constants.each {|obj| keep(obj,0)}
|
||||
@objects
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ module Risc
|
||||
# compilation of ruby code. Ruby code works on Objects only
|
||||
#
|
||||
# But for Builtin methods, methods that are created programatically and form the runtime,
|
||||
# it can be handy to load an integer directly withou the object overhead.
|
||||
# it can be handy to load an integer directly without the object overhead.
|
||||
#
|
||||
class LoadData < Instruction
|
||||
def initialize( source , constant , register)
|
||||
|
@ -55,7 +55,7 @@ module Risc
|
||||
def risc_init
|
||||
@risc_init ||= Branch.new( "__initial_branch__" , Parfait.object_space.get_init.risc_instructions )
|
||||
end
|
||||
# add a constant (which get created during compilatio and need to be linked)
|
||||
# add a constant (which get created during compilation and need to be linked)
|
||||
def add_constant(const)
|
||||
raise "Must be Parfait #{const}" unless const.is_a?(Parfait::Object)
|
||||
@constants << const
|
||||
@ -66,10 +66,10 @@ module Risc
|
||||
#
|
||||
# Position in the order
|
||||
# - initial jump
|
||||
# - all object
|
||||
# - all code
|
||||
# As code length amy change during assembly, this way at least the objects stay
|
||||
# in place and we don't have to deal with chaning loading code
|
||||
# - all objects
|
||||
# - all code (BinaryCode objects)
|
||||
# As code length may change during assembly, this way at least the objects stay
|
||||
# in place and we don't have to deal with changing loading code
|
||||
def position_all
|
||||
raise "Not translated " unless @translated
|
||||
#need the initial jump at 0 and then functions
|
||||
|
@ -43,7 +43,9 @@ module Risc
|
||||
if pos == nil
|
||||
str = "position accessed but not set, "
|
||||
str += "0x#{object.object_id.to_s(16)}\n"
|
||||
str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.to_s[0...130]}"
|
||||
str += "for #{object.class} "
|
||||
str += "byte_length #{object.byte_length}" if object.respond_to?(:byte_length)
|
||||
str += " for #{object.to_s[0...130]}"
|
||||
raise str
|
||||
end
|
||||
pos
|
||||
|
Reference in New Issue
Block a user