fix elf test

This commit is contained in:
Torsten Ruger 2016-12-15 17:57:45 +02:00
parent 1571c796bb
commit 884bf23e5f
6 changed files with 13 additions and 9 deletions

View File

@ -48,7 +48,7 @@ module Arm
# relative addressing for jumps/calls # relative addressing for jumps/calls
# but because of the arm "theoretical" 3- stage pipeline, # but because of the arm "theoretical" 3- stage pipeline,
# we have to subtract 2 words (fetch/decode) # we have to subtract 2 words (fetch/decode)
arg = arg.position - self.position - 8 arg = @first.position - self.position - 8
when Parfait::TypedMethod when Parfait::TypedMethod
# But, for methods, this happens to be the size of the object header, # But, for methods, this happens to be the size of the object header,
# so there it balances out, but not blocks # so there it balances out, but not blocks

View File

@ -49,7 +49,7 @@ module Arm
val |= instruction_code val |= instruction_code
val |= condition_code val |= condition_code
io.write_uint32 val io.write_uint32 val
assemble_extra assemble_extra(io)
end end
def result def result
@ -104,7 +104,7 @@ module Arm
end end
# by now we have the extra add so assemble that # by now we have the extra add so assemble that
def assemble_extra def assemble_extra(io)
return unless @extra return unless @extra
if(@extra == 1) # unles things have changed and then we add a noop (to keep the length same) if(@extra == 1) # unles things have changed and then we add a noop (to keep the length same)
@extra = ArmMachine.mov( :r1 , :r1 ) @extra = ArmMachine.mov( :r1 , :r1 )

View File

@ -74,6 +74,7 @@ module Register
cl = object_with_type Parfait::Class cl = object_with_type Parfait::Class
cl.instance_type = @types[name] cl.instance_type = @types[name]
@types[name].object_class = cl @types[name].object_class = cl
@types[name].instance_methods = object_with_type Parfait::List
cl.instance_methods = object_with_type Parfait::List cl.instance_methods = object_with_type Parfait::List
#puts "instance_methods is #{cl.instance_methods.class}" #puts "instance_methods is #{cl.instance_methods.class}"
cl.name = name cl.name = name

View File

@ -27,8 +27,8 @@ module Register
def translate_arm def translate_arm
translator = Arm::Translator.new translator = Arm::Translator.new
methods = [] methods = []
@space.classes.values.each do |c| self.space.types.each do |hash , t|
c.instance_methods.each do |f| t.instance_methods.each do |f|
methods << f methods << f
end end
end end

View File

@ -90,7 +90,7 @@ module Parfait
end end
def inspect def inspect
"#{self.for_class.name}:#{name}(#{arguments.inspect})" "#{self.for_type.object_class.name}:#{name}(#{arguments.inspect})"
end end
end end

View File

@ -13,8 +13,11 @@ class HelloTest < MiniTest::Test
end end
def test_string_put def test_string_put
@input = s(:statements, s(:class, :Object, s(:derives, nil), s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters), s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments), s(:receiver, s(:string, "Hello again\\n"))))))))) @input = s(:statements, s(:class, :Object, s(:derives, nil),
s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters),
s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments),
s(:receiver, s(:string, "Hello again\\n")))))))))
#FIXME: some more assembly tests need to get to the bottom of this one #FIXME: some more assembly tests need to get to the bottom of this one
# check check
end end
end end