unify space collection attribute naming

currently space is still acting as a sort of memory manager.
For proper linking, all objects must be reachable from space, hence the plural versions like messages and addresses (even they are instances, it is the list that is important)
To dish out instance to use, the head must be kept, ie next_XXX for intergers, return addresses and messages
This commit is contained in:
Torsten Ruger
2018-07-02 15:49:51 +03:00
parent 07a154be70
commit 1132309f6a
13 changed files with 38 additions and 34 deletions

View File

@ -5,7 +5,7 @@ module Parfait
def setup
super
@mess = @space.first_message
@mess = @space.next_message
@type = @mess.get_type
end

View File

@ -5,7 +5,7 @@ module Parfait
def setup
super
@mess = @space.first_message
@mess = @space.next_message
end
def test_length
assert_equal 9 , @mess.get_type.instance_length , @mess.get_type.inspect

View File

@ -5,7 +5,7 @@ module Parfait
def setup
super
@named_list = @space.first_message.frame
@named_list = @space.next_message.frame
@type = @named_list.get_type
end

View File

@ -10,7 +10,7 @@ module Parfait
end
def test_space_length
assert_equal 9 , @space.get_type.instance_length , @space.get_type.inspect
assert_equal 12 , @space.get_type.instance_length , @space.get_type.inspect
end
def test_singletons
assert @space.true_object , "No truth"
@ -98,7 +98,7 @@ module Parfait
assert_equal Parfait::ReturnAddress , @space.next_address.next_integer.class
end
def test_address_count
addr = @space.get_address
addr = @space.addresses
count = 0
while(addr)
count += 1
@ -108,7 +108,7 @@ module Parfait
end
def test_messages
mess = @space.first_message
mess = @space.messages
all = []
while mess
all << mess
@ -120,7 +120,7 @@ module Parfait
assert_equal 50 + 1 , all.length
end
def test_message_vars
mess = @space.first_message
mess = @space.next_message
all = mess.get_instance_variables
assert all
assert all.include?(:next_message)

View File

@ -5,7 +5,7 @@ module Parfait
def setup
super
@mess = @space.first_message
@mess = @space.next_message
assert @mess
@type = @mess.get_type()
end

View File

@ -5,7 +5,7 @@ module Parfait
def setup
super
@mess = @space.first_message
@mess = @space.next_message
end
def test_message_type

View File

@ -44,14 +44,14 @@ module Risc
def test_returns_slot
r2 = RegisterValue.new(:r2 , :Message)
r2.builder = @builder
built = @builder.build{ r2 << space[:first_message] }
built = @builder.build{ r2 << space[:next_message] }
assert_equal SlotToReg , built.class
assert_equal :r1 , built.array.symbol
end
def test_returns_slot_reverse
r2 = RegisterValue.new(:r2 , :Message)
r2.builder = @builder
built = @builder.build{ r2 << space[:first_message] }
built = @builder.build{ r2 << space[:next_message] }
assert_equal SlotToReg , built.class
assert_equal :r1 , built.array.symbol
end

View File

@ -36,20 +36,20 @@ module Risc
assert_equal Transfer , builder.built.class
end
def test_index_op
message = @r0[:first_message]
message = @r0[:next_message]
assert_equal RValue , message.class
assert_equal :first_message , message.index
assert_equal :next_message , message.index
assert_equal @r0 , message.register
end
def test_slot_to_reg
instr = @r0 << @r1[:first_message]
instr = @r0 << @r1[:next_message]
assert_equal SlotToReg , instr.class
assert_equal @r1 , instr.array
assert_equal @r0 , instr.register
assert_equal 3 , instr.index
end
def test_reg_to_slot
instr = @r1[:first_message] << @r0
instr = @r1[:next_message] << @r0
assert_equal RegToSlot , instr.class
assert_equal @r1 , instr.array
assert_equal @r0 , instr.register