From f1c323b0a23cd76d5e739ec84c7bcf221e168789 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Thu, 24 Dec 2015 10:34:01 +0000 Subject: [PATCH] Add (untested!) updates to the MIPS / ARM asm paths. --- objc_msgSend.arm.S | 22 +++++++++------------- objc_msgSend.mips.S | 18 ++++-------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/objc_msgSend.arm.S b/objc_msgSend.arm.S index a7c48ac..0100dba 100644 --- a/objc_msgSend.arm.S +++ b/objc_msgSend.arm.S @@ -1,8 +1,3 @@ -#define DTABLE_OFFSET 32 -#define SMALLOBJ_MASK 1 -#define SHIFT_OFFSET 4 -#define DATA_OFFSET 12 -#define SLOT_OFFSET 16 .syntax unified .fpu neon @@ -44,16 +39,17 @@ teq r6, #0 beq 2f - and r6, r5, #0xff0000 - ldr r4, [r4, r6, asr#14] - ldr r4, [r4, #DATA_OFFSET] + ubfx r6, r5, #16, #8 // Put byte 3 of the sel id in r6 + add r6, r4, r6, lsl #2 // r6 = dtable address + dtable data offset + ldr r4, [r6, #DATA_OFFSET] // Load, adding in the data offset 1: // dtable16 - and r6, r5, #0xff00 - ldr r4, [r4, r6, asr#6] - ldr r4, [r4, #DATA_OFFSET] + ubfx r6, r5, #8, #8 // Put byte 2 of the sel id in r6 + add r6, r4, r6, lsl #2 // r6 = dtable address + dtable data offset + ldr r4, [r6, #DATA_OFFSET] // Load, adding in the data offset 2: // dtable8 - and r6, r5, #0xff - ldr ip, [r4, r6, asl#2] + uxtb r6, r5 // Low byte of sel id into r5 + add r6, r4, r6, lsl #2 // r6 = dtable address + dtable data offset + ldr r4, [r6, #DATA_OFFSET] // Load, adding in the data offset teq ip, #0 // If the slot is nil beq 5f // Go to the slow path and do the forwarding stuff diff --git a/objc_msgSend.mips.S b/objc_msgSend.mips.S index 4fb8607..5248d6c 100644 --- a/objc_msgSend.mips.S +++ b/objc_msgSend.mips.S @@ -3,20 +3,10 @@ #ifdef _ABI64 #define LP ld #define SP sd -#define DTABLE_OFFSET 64 -#define SMALLOBJ_MASK 7 -#define SHIFT_OFFSET 4 -#define DATA_OFFSET 16 -#define SLOT_OFFSET 32 #else #warning N32 is untested, O32 is unsupported. #define LP lw #define SP sw -#define DTABLE_OFFSET 32 -#define SMALLOBJ_MASK 1 -#define SHIFT_OFFSET 4 -#define DATA_OFFSET 12 -#define SLOT_OFFSET 16 #endif .macro dump_and_crash reg @@ -64,8 +54,8 @@ lw $zero, ($zero) 1: # class loaded, stored in $t4 LP $t4, DTABLE_OFFSET($t4) # Load the dtable from the class lw $t6, SHIFT_OFFSET($t4) # Load the shift (dtable size) - # $t4 = dtable, $t5 = sel index - LP $t7, DATA_OFFSET($t4) # Load the address of the start of the array + # $t4 = dtable, $t5 = sel index + daddi $t7, $t4, DATA_OFFSET # Compute the address of the start of the array beq $0, $t6, 3f # If this is a small dtable, jump to the small dtable handlers @@ -81,7 +71,7 @@ lw $zero, ($zero) #endif dadd $t6, $t6, $t7 LP $t7, ($t6) - LP $t7, DATA_OFFSET($t7) + daddi $t7, $t7, DATA_OFFSET # Compute the address of the start of the array 2: # dtable16: andi $t6, $t5, 0xff00 # mask the selector #ifdef _ABI64 @@ -91,7 +81,7 @@ lw $zero, ($zero) #endif dadd $t6, $t6, $t7 LP $t7, ($t6) - LP $t7, DATA_OFFSET($t7) + daddi $t7, $t7, DATA_OFFSET # Compute the address of the start of the array 3: # dtable8: andi $t6, $t5, 0xff # mask the selector #ifdef _ABI64