fix elf test
This commit is contained in:
parent
1571c796bb
commit
884bf23e5f
@ -48,7 +48,7 @@ module Arm
|
||||
# relative addressing for jumps/calls
|
||||
# but because of the arm "theoretical" 3- stage pipeline,
|
||||
# we have to subtract 2 words (fetch/decode)
|
||||
arg = arg.position - self.position - 8
|
||||
arg = @first.position - self.position - 8
|
||||
when Parfait::TypedMethod
|
||||
# But, for methods, this happens to be the size of the object header,
|
||||
# so there it balances out, but not blocks
|
||||
|
@ -49,7 +49,7 @@ module Arm
|
||||
val |= instruction_code
|
||||
val |= condition_code
|
||||
io.write_uint32 val
|
||||
assemble_extra
|
||||
assemble_extra(io)
|
||||
end
|
||||
|
||||
def result
|
||||
@ -104,7 +104,7 @@ module Arm
|
||||
end
|
||||
|
||||
# by now we have the extra add so assemble that
|
||||
def assemble_extra
|
||||
def assemble_extra(io)
|
||||
return unless @extra
|
||||
if(@extra == 1) # unles things have changed and then we add a noop (to keep the length same)
|
||||
@extra = ArmMachine.mov( :r1 , :r1 )
|
||||
|
@ -74,8 +74,9 @@ module Register
|
||||
cl = object_with_type Parfait::Class
|
||||
cl.instance_type = @types[name]
|
||||
@types[name].object_class = cl
|
||||
@types[name].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
|
||||
classes[name] = cl
|
||||
end
|
||||
|
@ -27,8 +27,8 @@ module Register
|
||||
def translate_arm
|
||||
translator = Arm::Translator.new
|
||||
methods = []
|
||||
@space.classes.values.each do |c|
|
||||
c.instance_methods.each do |f|
|
||||
self.space.types.each do |hash , t|
|
||||
t.instance_methods.each do |f|
|
||||
methods << f
|
||||
end
|
||||
end
|
||||
|
@ -90,7 +90,7 @@ module Parfait
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#{self.for_class.name}:#{name}(#{arguments.inspect})"
|
||||
"#{self.for_type.object_class.name}:#{name}(#{arguments.inspect})"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -13,8 +13,11 @@ class HelloTest < MiniTest::Test
|
||||
end
|
||||
|
||||
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
|
||||
# check
|
||||
check
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user