fix the address for calls to jump past the method object header

This commit is contained in:
Torsten Ruger 2014-09-09 17:36:33 +03:00
parent e3fdbb30a5
commit 7036a87678

View File

@ -35,8 +35,11 @@ module Arm
arg = Virtual::IntegerConstant.new( arg )
end
if arg.is_a?(Virtual::Block) or arg.is_a?(Virtual::CompiledMethod)
diff = arg.position - 8
diff -= self.position
#relative addressing for jumps/calls
diff = arg.position - self.position
# but because of the arm "theoretical" 3- stage pipeline, we have to subtract 2 words (fetch/decode)
# But, for methods, this happens to be the size of the object header, so there it balances out, but not blocks
diff -= 8 if arg.is_a?(Virtual::Block)
arg = Virtual::IntegerConstant.new(diff)
end
if (arg.is_a?(Virtual::IntegerConstant))