move constants to machine
This commit is contained in:
parent
7e0778dc70
commit
e75517ff05
@ -6,6 +6,7 @@ module Register
|
|||||||
# init= Parfait::Space.object_space.get_class_by_name("Kernel").get_instance_method "__init__"
|
# init= Parfait::Space.object_space.get_class_by_name("Kernel").get_instance_method "__init__"
|
||||||
self.objects.clear
|
self.objects.clear
|
||||||
keep Parfait::Space.object_space , 0
|
keep Parfait::Space.object_space , 0
|
||||||
|
constants.each {|o| keep(o,0)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def keep object , depth
|
def keep object , depth
|
||||||
@ -14,12 +15,6 @@ module Register
|
|||||||
#puts "ADD #{object.first.class}, #{object.last.class}" if object.is_a? Array
|
#puts "ADD #{object.first.class}, #{object.last.class}" if object.is_a? Array
|
||||||
return unless self.add_object object
|
return unless self.add_object object
|
||||||
return unless object.respond_to? :has_layout?
|
return unless object.respond_to? :has_layout?
|
||||||
if( object.is_a? Parfait::Method)
|
|
||||||
object.source.constants.each{|c|
|
|
||||||
#puts "keeping constant #{c.class}:#{c.object_id}"
|
|
||||||
keep(c , depth + 1)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
layout = object.get_layout
|
layout = object.get_layout
|
||||||
keep(layout , depth + 1)
|
keep(layout , depth + 1)
|
||||||
return if object.is_a? Symbol
|
return if object.is_a? Symbol
|
||||||
|
@ -17,7 +17,9 @@ module Register
|
|||||||
@parser = Parser::Salama.new
|
@parser = Parser::Salama.new
|
||||||
@objects = {}
|
@objects = {}
|
||||||
@booted = false
|
@booted = false
|
||||||
|
@constants = []
|
||||||
end
|
end
|
||||||
|
attr_reader :constants
|
||||||
attr_reader :space , :class_mappings , :init , :objects , :booted
|
attr_reader :space , :class_mappings , :init , :objects , :booted
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,9 +55,7 @@ module Register
|
|||||||
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
||||||
add_code FunctionReturn.new( self , Register.new_message_reg , Register.resolve_index(:message , :return_address) )
|
add_code FunctionReturn.new( self , Register.new_message_reg , Register.resolve_index(:message , :return_address) )
|
||||||
@current = enter
|
@current = enter
|
||||||
@constants = []
|
|
||||||
end
|
end
|
||||||
attr_reader :constants
|
|
||||||
attr_accessor :current , :receiver , :instructions
|
attr_accessor :current , :receiver , :instructions
|
||||||
|
|
||||||
# add an instruction after the current (insertion point)
|
# add an instruction after the current (insertion point)
|
||||||
|
@ -38,7 +38,7 @@ module Soml
|
|||||||
def on_string expression
|
def on_string expression
|
||||||
value = expression.first.to_sym
|
value = expression.first.to_sym
|
||||||
reg = use_reg :Word
|
reg = use_reg :Word
|
||||||
@method.source.constants << value
|
Register.machine.constants << value
|
||||||
add_code Register::LoadConstant.new( expression, value , reg )
|
add_code Register::LoadConstant.new( expression, value , reg )
|
||||||
return reg
|
return reg
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user