fix method call addresses

was jumping to the method
but needs to jump to the code of the method
This commit is contained in:
Torsten Ruger 2015-06-10 11:10:46 +02:00
parent 6f111a5ae0
commit d8fa266b5d

View File

@ -35,12 +35,16 @@ module Arm
#puts "BLAB #{arg.inspect}" #puts "BLAB #{arg.inspect}"
if arg.is_a?(Virtual::Block) or arg.is_a?(Parfait::Method) if arg.is_a?(Virtual::Block) or arg.is_a?(Parfait::Method)
#relative addressing for jumps/calls #relative addressing for jumps/calls
diff = arg.position - self.position
# 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)
# But, for methods, this happens to be the size of the object header, if(arg.is_a? Virtual::Block)
# so there it balances out, but not blocks diff = arg.position - self.position - 8
diff -= 8 if arg.is_a?(Virtual::Block) else
# But, for methods, this happens to be the size of the object header,
# so there it balances out, but not blocks
# have to use the code, not the mthod object for methods
diff = arg.code.position - self.position
end
arg = diff arg = diff
end end
if (arg.is_a?(Numeric)) if (arg.is_a?(Numeric))