use arm shift at runtime
arm indexes are in bytes (x4) at compile time but at runtime we only have the array indexes, iw word indexes arm has the nice barrel shifter to save us an extra instruction
This commit is contained in:
parent
4871a52d37
commit
a8453c126d
@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/salama/salama-arm.git
|
||||
revision: 0a950de25a9d286fccf7d33834534a0c3a6d2682
|
||||
revision: 00beb3703b57702e6d8d4743abf7eac2504a3c83
|
||||
specs:
|
||||
salama-arm (0.3.0)
|
||||
|
||||
|
@ -38,20 +38,18 @@ module Arm
|
||||
end
|
||||
|
||||
def translate_GetSlot code
|
||||
# times 4 because arm works in bytes, but vm in words
|
||||
if(code.index.is_a? Numeric)
|
||||
ArmMachine.ldr( code.register , code.array , arm_index(code) )
|
||||
else
|
||||
ArmMachine.ldr( code.register , code.array , code.index )
|
||||
ArmMachine.ldr( code.register , code.array , code.index , :shift_lsl => 2 )
|
||||
end
|
||||
end
|
||||
|
||||
def translate_SetSlot code
|
||||
# times 4 because arm works in bytes, but vm in words
|
||||
if(code.index.is_a? Numeric)
|
||||
ArmMachine.str( code.register , code.array , arm_index(code) )
|
||||
else
|
||||
ArmMachine.str( code.register , code.array , code.index )
|
||||
ArmMachine.str( code.register , code.array , code.index , :shift_lsl => 2 )
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user