fixes outstanding misc, All green

Well. it's been a while, positioning is fixed (again)
apart from the upcoming BranchListener
This commit is contained in:
Torsten Ruger 2018-06-10 13:19:55 +03:00
parent e1683938ed
commit 5ec235d049
7 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@ module Elf
add_symbol "#{type.name}@#{meth.name}:Label=#{label.name}" , Risc::Position.get(label).at add_symbol "#{type.name}@#{meth.name}:Label=#{label.name}" , Risc::Position.get(label).at
end end
meth.binary.each_block do |code| meth.binary.each_block do |code|
label = "BinaryCode@#{Risc::Position.get(code).method.name}" label = "BinaryCode@#{meth.name}"
add_symbol label , Risc::Position.get(code).at add_symbol label , Risc::Position.get(code).at
end end
end end

View File

@ -225,7 +225,7 @@ module Risc
def execute_FunctionReturn def execute_FunctionReturn
link = get_register( @instruction.register ) link = get_register( @instruction.register )
log.debug "Return to #{link}" log.debug "Return to #{link} #{link.class}"
set_pc link set_pc link
false false
end end

View File

@ -89,7 +89,7 @@ module Arm
assert_code code.next , :add , [0x22,0x10,0x91,0xe2] #e2 91 10 22 assert_code code.next , :add , [0x22,0x10,0x91,0xe2] #e2 91 10 22
end end
def label( pos = 0x12 + 8) def label( pos = 0x22 + 8)
label = Risc::Label.new("some" , "Label" , FakeAddress.new(pos)) label = Risc::Label.new("some" , "Label" , FakeAddress.new(pos))
Risc::Position.new(label , pos) Risc::Position.new(label , pos)
#Risc::Position.set(l , pos , @binary) #Risc::Position.set(l , pos , @binary)
@ -98,7 +98,7 @@ module Arm
def test_move_object def test_move_object
code = @machine.add( :r1 , label) code = @machine.add( :r1 , label)
Risc::Position.new(code,12) Risc::Position.new(code,0)
assert_code code , :add , [0x22,0x10,0x9f,0xe2] #e2 9f 10 22 assert_code code , :add , [0x22,0x10,0x9f,0xe2] #e2 9f 10 22
end end

View File

@ -43,7 +43,7 @@ module Risc
def test_get_args_type #from method in r1 def test_get_args_type #from method in r1
sl = @produced.next( 5 ) sl = @produced.next( 5 )
assert_slot_to_reg( sl , :r1 , 6 , :r4 ) assert_slot_to_reg( sl , :r1 , 5 , :r4 )
end end
def test_get_args #from message def test_get_args #from message
sl = @produced.next( 6 ) sl = @produced.next( 6 )
@ -56,7 +56,7 @@ module Risc
def test_get_frame_type #from method in r1 def test_get_frame_type #from method in r1
sl = @produced.next( 8 ) sl = @produced.next( 8 )
assert_slot_to_reg( sl , :r1 , 8 , :r4 ) assert_slot_to_reg( sl , :r1 , 7 , :r4 )
end end
def test_get_frame #from message def test_get_frame #from message
sl = @produced.next( 9 ) sl = @produced.next( 9 )

View File

@ -46,7 +46,7 @@ module Risc
ret = main_ticks(63) ret = main_ticks(63)
assert_equal FunctionReturn , ret.class assert_equal FunctionReturn , ret.class
assert_equal :r1 , ret.register.symbol assert_equal :r1 , ret.register.symbol
assert_equal 20612 , @interpreter.get_register(ret.register) assert_equal 20580 , @interpreter.get_register(ret.register)
end end
def test_sys def test_sys
sys = main_ticks(65) sys = main_ticks(65)

View File

@ -12,11 +12,11 @@ module Risc
def test_bin_propagates_existing def test_bin_propagates_existing
@binary.extend_to(16) @binary.extend_to(16)
CodeListener.init( @binary , 0 ) CodeListener.init( @binary).set(0)
assert_equal @binary.padded_length , Position.get(@binary.next).at assert_equal @binary.padded_length , Position.get(@binary.next).at
end end
def test_bin_propagates_after def test_bin_propagates_after
CodeListener.init( @binary , 0 ) CodeListener.init( @binary).set(0)
@binary.extend_to(16) @binary.extend_to(16)
assert_equal @binary.padded_length , Position.get(@binary.next).at assert_equal @binary.padded_length , Position.get(@binary.next).at
end end

View File

@ -32,7 +32,7 @@ module Risc
sorted_objects = @text_writer.sorted_objects sorted_objects = @text_writer.sorted_objects
sorted_objects.each_slice(2) do |l,r| sorted_objects.each_slice(2) do |l,r|
next unless r next unless r
assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.class}, #{r.class}" assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.object_id.to_s(16)}, #{r.object_id.to_s(16)}"
end end
end end
def test_sorted_positions2 def test_sorted_positions2
@ -40,7 +40,7 @@ module Risc
sorted_objects.shift sorted_objects.shift
sorted_objects.each_slice(2) do |l,r| sorted_objects.each_slice(2) do |l,r|
next unless r next unless r
assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.class}, #{r.class}" assert Position.get(l).at < Position.get(r).at , "#{Position.get(l)} < #{Position.get(r)} , #{l.object_id.to_s(16)}, #{r.object_id.to_s(16)}"
end end
end end
end end