move address list to object_space

where i guess it should have been from the start
This commit is contained in:
Torsten Ruger
2018-07-01 13:43:53 +03:00
parent 35b10c46a3
commit 57fc67ddf6
3 changed files with 40 additions and 17 deletions

View File

@ -36,6 +36,8 @@ module Parfait
@types = Dictionary.new
message = Message.new(nil)
101.times { @next_integer = Integer.new(0,@next_integer) }
10.times { @next_address = ReturnAddress.new(0,@next_address) }
50.times do
@first_message = Message.new message
message.set_caller @first_message
@ -49,7 +51,7 @@ module Parfait
@nil_object = Parfait::NilClass.new
end
attr_reader :classes , :types , :first_message , :next_integer
attr_reader :classes , :types , :first_message , :next_integer , :next_address
attr_reader :true_object , :false_object , :nil_object
# hand out one of the preallocated ints for use as constant
@ -62,6 +64,16 @@ module Parfait
int
end
# hand out a return address for use as constant the address is added
def get_address
10.times do # 10 for whole pages
@next_address = ReturnAddress.new(0,@next_address)
end unless @next_address
addr = @next_address
@next_address = @next_address.next_integer
addr
end
def each_type
@types.values.each do |type|
yield(type)

View File

@ -115,9 +115,10 @@ module Parfait
# superclasses other than default object
def self.super_class_names
{ Data4: :DataObject , Data8: :DataObject ,Data16: :DataObject ,Data32: :DataObject ,
{ Data4: :DataObject , Data8: :DataObject ,Data16: :DataObject ,
Data32: :DataObject ,
BinaryCode: :Data16 , Integer: :Data4 , Word: :Data8 ,
Object: :BasicObject , List: :Data16 , ReturnAddress: :Integer}
Object: :BasicObject, List: :Data16 , ReturnAddress: :Integer}
end
# the function really just returns a constant (just avoiding the constant)
@ -130,7 +131,7 @@ module Parfait
return_address: :Integer, return_value: :Object,
caller: :Message , name: :Word , arguments: :NamedList },
Integer: {next_integer: :Integer},
ReturnAddress: {next_integer: :Integer},
ReturnAddress: {next_integer: :ReturnAddress},
DataObject: {},
Data4: {},
Data8: {},
@ -141,7 +142,7 @@ module Parfait
BinaryCode: {next: :BinaryCode} ,
Space: {classes: :Dictionary , types: :Dictionary ,
first_message: :Message , next_integer: :Integer ,
true_object: :TrueClass,
true_object: :TrueClass, next_address: :ReturnAddress ,
false_object: :FalseClass , nil_object: :NilClass},
NamedList: {},
Type: {names: :List , types: :List ,