change binary labels

This commit is contained in:
Torsten Ruger 2018-05-13 17:21:48 +03:00
parent 39902401b9
commit 866467ee5e
4 changed files with 16 additions and 5 deletions

View File

@ -27,7 +27,11 @@ module Elf
type.each_method do |f|
f.cpu_instructions.each do |label|
next unless label.is_a?(Risc::Label)
add_symbol "#{type.name}::#{f.name}:#{label.name}" , Risc::Position.get(label).at
add_symbol "#{type.name}@#{f.name}:#{label.name}" , Risc::Position.get(label).at
end
f.binary.each do |code|
label = "BinaryCode@#{Risc::Position.get(code).method.name}"
add_symbol label , Risc::Position.get(code).at
end
end
end
@ -41,9 +45,6 @@ module Elf
end
label += "=#{slot}" if slot.is_a?(Symbol) or slot.is_a?(String)
add_symbol label , Risc::Position.get(slot).at
if slot.is_a?(Parfait::TypedMethod)
add_symbol slot.name.to_s , Risc::Position.get(slot.binary).at
end
end
end

View File

@ -27,6 +27,11 @@ module Parfait
Risc::Position.reset(self) if Risc::Position.set?(self)
end
def each( &block )
block.call( self )
@next.each( &block ) if @next
end
def to_s
"BinaryCode #{Risc::Position.set?(self) ? Risc::Position.get(self): self.object_id.to_s(16)}"
end

View File

@ -35,7 +35,7 @@ module Parfait
@classes = classes
@types = Dictionary.new
message = Message.new(nil)
100.times { @next_integer = Integer.new(0,@next_integer) }
101.times { @next_integer = Integer.new(0,@next_integer) }
50.times do
@first_message = Message.new message
#puts "INIT caller #{message.object_id} to #{@first_message.object_id}"

View File

@ -103,5 +103,10 @@ module Parfait
@code.set_word(1 , 1)
assert_equal 1, @code.get_internal_word(@code.data_start + 1)
end
def test_has_each
sum = 0
@code.each{ sum += 1}
assert_equal sum , 1
end
end
end