start by moving positioned(module) to position(class)
This commit is contained in:
@ -47,12 +47,12 @@ 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 = Positioned.position(@first) - Positioned.position(self) - 8
|
||||
arg = Risc::Position.position(@first) - Risc::Position.position(self) - 8
|
||||
when Parfait::BinaryCode
|
||||
# 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 method object for methods
|
||||
arg = Positioned.position(@first) - Positioned.position(self) + 4
|
||||
arg = Risc::Position.position(@first) - Risc::Position.position(self) + 4
|
||||
else
|
||||
arg = @first
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ module Arm
|
||||
end
|
||||
|
||||
def set_position( position , count )
|
||||
Positioned.set_position(self,position)
|
||||
Risc::Position.set_position(self,position)
|
||||
position += byte_length
|
||||
if self.next
|
||||
count += 1 #assumes 4 byte instructions, as does the whole setup
|
||||
|
@ -95,7 +95,7 @@ module Arm
|
||||
(@left.is_a?(Symbol) and !Risc::RiscValue.look_like_reg(@left)))
|
||||
# do pc relative addressing with the difference to the instuction
|
||||
# 8 is for the funny pipeline adjustment (ie pointing to fetch and not execute)
|
||||
right = Positioned.position(@left) - Positioned.position(self) - 8
|
||||
right = Risc::Position.position(@left) - Risc::Position.position(self) - 8
|
||||
if( (right < 0) && ((opcode == :add) || (opcode == :sub)) )
|
||||
right *= -1 # this works as we never issue sub only add
|
||||
set_opcode :sub # so (as we can't change the sign permanently) we can change the opcode
|
||||
|
Reference in New Issue
Block a user