remove the last_object from chain
also tried to keep the first around as was done in space partially to not have to add the consrtants seperately didn't work, as chain gets broken also this has to be redone anyway
This commit is contained in:
@ -13,7 +13,7 @@ module Parfait
|
||||
# factory when the next (not current) is nil.
|
||||
# This is btw just as easy a check, as the next needs to be gotten to swap the list.
|
||||
class Factory < Object
|
||||
attr :type , :for_type , :next_object , :last_object , :reserve , :attribute_name
|
||||
attr :type , :for_type , :next_object , :reserve , :attribute_name
|
||||
|
||||
PAGE_SIZE = 1024
|
||||
RESERVE = 10
|
||||
@ -50,8 +50,8 @@ module Parfait
|
||||
# and rebuilt the reserve (get_next already instantiates the reserve)
|
||||
#
|
||||
def get_more
|
||||
chain = get_chain
|
||||
link = chain
|
||||
first_object = get_chain
|
||||
link = first_object
|
||||
count = RESERVE
|
||||
while(count > 0)
|
||||
link = get_next_for(link)
|
||||
@ -59,7 +59,8 @@ module Parfait
|
||||
end
|
||||
self.next_object = get_next_for(link)
|
||||
set_next_for( link , nil )
|
||||
self.reserve = chain
|
||||
self.reserve = first_object
|
||||
self
|
||||
end
|
||||
|
||||
# this initiates the syscall to get more memory.
|
||||
@ -111,6 +112,7 @@ module Parfait
|
||||
r_class = eval( "Parfait::#{type.object_class.name}" )
|
||||
obj = r_class.allocate
|
||||
obj.set_type(type)
|
||||
#puts "Factory #{type.object_class.name} at 0x#{obj.object_id.to_s(16)}"
|
||||
obj
|
||||
end
|
||||
end
|
||||
|
@ -1,12 +1,10 @@
|
||||
|
||||
# Integer class for representing maths on Integers
|
||||
# Integers are Objects, specifically DataObjects
|
||||
# - they have fixed value
|
||||
# - they are immutable
|
||||
# (both by implementation, not design.
|
||||
# Ie it would be possible to change the value, we just don't support that)
|
||||
|
||||
module Parfait
|
||||
# Integer class for representing maths on Integers
|
||||
# Integers are Objects, specifically DataObjects
|
||||
# - they have fixed value
|
||||
# - they are immutable
|
||||
# (both by implementation, not design.
|
||||
# Ie it would be possible to change the value, we just don't support that)
|
||||
class Integer < Data4
|
||||
|
||||
attr :type, :next_integer
|
||||
@ -55,6 +53,10 @@ module Parfait
|
||||
#
|
||||
# But the integer (address) needs to be adjusted by load address.
|
||||
class ReturnAddress < Integer
|
||||
|
||||
def to_s
|
||||
"ReturnAddress 0x#{object_id.to_s(16)}:#{value}"
|
||||
end
|
||||
end
|
||||
|
||||
# adding other base classes in here for now:
|
||||
|
@ -27,10 +27,8 @@ module Parfait
|
||||
|
||||
def self.new( *args )
|
||||
object = self.allocate
|
||||
|
||||
# have to grab the class, because we are in the ruby class not the parfait one
|
||||
cl = Parfait.object_space.get_class_by_name( self.name.split("::").last.to_sym)
|
||||
|
||||
# and have to set the type before we let the object do anything. otherwise boom
|
||||
object.set_type cl.instance_type
|
||||
object.send :initialize , *args
|
||||
|
Reference in New Issue
Block a user