From d695d527e8d3f49e91aeefd8426dfcd8fc2f9c76 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:28:15 -0800 Subject: [PATCH] remove unnecessary now PTFF_RAX_IS_GCREF and similar. --- .../nativeaot/Runtime/amd64/AsmMacros.inc | 6 ++-- .../nativeaot/Runtime/arm64/AsmMacros.h | 4 +-- src/coreclr/nativeaot/Runtime/inc/rhbinder.h | 36 +++++-------------- .../Runtime/unix/unixasmmacrosamd64.inc | 4 +-- .../Runtime/unix/unixasmmacrosarm.inc | 4 +-- .../Runtime/unix/unixasmmacrosarm64.inc | 4 +-- .../Runtime/unix/unixasmmacrosloongarch64.inc | 2 +- 7 files changed, 19 insertions(+), 41 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/amd64/AsmMacros.inc b/src/coreclr/nativeaot/Runtime/amd64/AsmMacros.inc index 2e2ed058304d54..577a9967f446a7 100644 --- a/src/coreclr/nativeaot/Runtime/amd64/AsmMacros.inc +++ b/src/coreclr/nativeaot/Runtime/amd64/AsmMacros.inc @@ -356,10 +356,8 @@ PTFF_SAVE_ALL_PRESERVED equ 000000F7h ;; NOTE: RBP is not included in this set PTFF_SAVE_RSP equ 00008000h PTFF_SAVE_RAX equ 00000100h ;; RAX is saved in hijack handler - in case it contains a GC ref PTFF_SAVE_ALL_SCRATCH equ 00007F00h -PTFF_RAX_IS_GCREF equ 00010000h ;; iff PTFF_SAVE_RAX: set -> eax is Object, clear -> eax is scalar -PTFF_RAX_IS_BYREF equ 00020000h ;; iff PTFF_SAVE_RAX: set -> eax is ByRef, clear -> eax is Object or scalar -PTFF_THREAD_ABORT equ 00100000h ;; indicates that ThreadAbortException should be thrown when returning from the transition -PTFF_THREAD_HIJACK equ 00200000h ;; indicates that this is a frame for a hijacked call +PTFF_THREAD_ABORT equ 00010000h ;; indicates that ThreadAbortException should be thrown when returning from the transition +PTFF_THREAD_HIJACK equ 00020000h ;; indicates that this is a frame for a hijacked call ;; These must match the TrapThreadsFlags enum TrapThreadsFlags_None equ 0 diff --git a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h index 0796e14d42b631..90e1b5d7779947 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h +++ b/src/coreclr/nativeaot/Runtime/arm64/AsmMacros.h @@ -60,10 +60,10 @@ PTFF_SAVE_ALL_SCRATCH equ 0x3FFFF800 ;; NOTE: X0-X18 PTFF_SAVE_FP equ 0x40000000 PTFF_SAVE_LR equ 0x80000000 -PTFF_THREAD_HIJACK_HI equ 0x00000020 // upper 32 bits of the PTFF_THREAD_HIJACK +PTFF_THREAD_HIJACK_HI equ 0x00000002 // upper 32 bits of the PTFF_THREAD_HIJACK ;; Bit position for the flags above, to be used with tbz / tbnz instructions -PTFF_THREAD_ABORT_BIT equ 36 +PTFF_THREAD_ABORT_BIT equ 32 ;; These must match the TrapThreadsFlags enum TrapThreadsFlags_None equ 0 diff --git a/src/coreclr/nativeaot/Runtime/inc/rhbinder.h b/src/coreclr/nativeaot/Runtime/inc/rhbinder.h index 93a53af23f1434..8268f192933a06 100644 --- a/src/coreclr/nativeaot/Runtime/inc/rhbinder.h +++ b/src/coreclr/nativeaot/Runtime/inc/rhbinder.h @@ -271,12 +271,9 @@ enum PInvokeTransitionFrameFlags // a return address pointing into the hijacked method and that method's // lr register, which may hold a gc pointer - PTFF_R0_IS_GCREF = 0x00004000, // used by hijack handler to report return value of hijacked method - PTFF_R0_IS_BYREF = 0x00008000, // used by hijack handler to report return value of hijacked method + PTFF_THREAD_ABORT = 0x00004000, // indicates that ThreadAbortException should be thrown when returning from the transition - PTFF_THREAD_ABORT = 0x00010000, // indicates that ThreadAbortException should be thrown when returning from the transition - - PTFF_THREAD_HIJACK = 0x00020000, // indicates that this is a frame for a hijacked call + PTFF_THREAD_HIJACK = 0x00008000, // indicates that this is a frame for a hijacked call }; #elif defined(TARGET_ARM64) enum PInvokeTransitionFrameFlags : uint64_t @@ -331,15 +328,9 @@ enum PInvokeTransitionFrameFlags : uint64_t // a return address pointing into the hijacked method and that method's // lr register, which may hold a gc pointer - // used by hijack handler to report return value of hijacked method - PTFF_X0_IS_GCREF = 0x0000000100000000, - PTFF_X0_IS_BYREF = 0x0000000200000000, - PTFF_X1_IS_GCREF = 0x0000000400000000, - PTFF_X1_IS_BYREF = 0x0000000800000000, - - PTFF_THREAD_ABORT = 0x0000001000000000, // indicates that ThreadAbortException should be thrown when returning from the transition + PTFF_THREAD_ABORT = 0x0000000100000000, // indicates that ThreadAbortException should be thrown when returning from the transition - PTFF_THREAD_HIJACK = 0x0000002000000000, // indicates that this is a frame for a hijacked call + PTFF_THREAD_HIJACK = 0x0000000200000000, // indicates that this is a frame for a hijacked call }; #elif defined(TARGET_LOONGARCH64) @@ -394,15 +385,9 @@ enum PInvokeTransitionFrameFlags : uint64_t // a return address pointing into the hijacked method and that method's // ra register, which may hold a gc pointer - // used by hijack handler to report return value of hijacked method - PTFF_R4_IS_GCREF = 0x0000000080000000, - PTFF_R4_IS_BYREF = 0x0000000100000000, - PTFF_R5_IS_GCREF = 0x0000000200000000, - PTFF_R5_IS_BYREF = 0x0000000400000000, + PTFF_THREAD_ABORT = 0x0000000080000000, // indicates that ThreadAbortException should be thrown when returning from the transition - PTFF_THREAD_ABORT = 0x0000000800000000, // indicates that ThreadAbortException should be thrown when returning from the transition - - PTFF_THREAD_HIJACK = 0x0000001000000000, // indicates that this is a frame for a hijacked call + PTFF_THREAD_HIJACK = 0x0000000100000000, // indicates that this is a frame for a hijacked call }; #else // TARGET_ARM @@ -440,14 +425,9 @@ enum PInvokeTransitionFrameFlags PTFF_SAVE_R10 = 0x00002000, PTFF_SAVE_R11 = 0x00004000, - PTFF_RAX_IS_GCREF = 0x00010000, // used by hijack handler to report return value of hijacked method - PTFF_RAX_IS_BYREF = 0x00020000, - PTFF_RDX_IS_GCREF = 0x00040000, - PTFF_RDX_IS_BYREF = 0x00080000, - - PTFF_THREAD_ABORT = 0x00100000, // indicates that ThreadAbortException should be thrown when returning from the transition + PTFF_THREAD_ABORT = 0x00010000, // indicates that ThreadAbortException should be thrown when returning from the transition - PTFF_THREAD_HIJACK = 0x00200000, // indicates that this is a frame for a hijacked call + PTFF_THREAD_HIJACK = 0x00020000, // indicates that this is a frame for a hijacked call }; #endif // TARGET_ARM diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc index e4195ac8ac8311..5d71f7dc344f70 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc @@ -262,8 +262,8 @@ C_FUNC(\Name): #define PTFF_SAVE_RAX 0x00000100 // RAX is saved in hijack handler - in case it contains a GC ref #define PTFF_SAVE_RDX 0x00000400 // RDX is saved in hijack handler - in case it contains a GC ref #define PTFF_SAVE_ALL_SCRATCH 0x00007F00 -#define PTFF_THREAD_ABORT 0x00100000 // indicates that ThreadAbortException should be thrown when returning from the transition -#define PTFF_THREAD_HIJACK 0x00200000 // indicates that this is a frame for a hijacked call +#define PTFF_THREAD_ABORT 0x00010000 // indicates that ThreadAbortException should be thrown when returning from the transition +#define PTFF_THREAD_HIJACK 0x00020000 // indicates that this is a frame for a hijacked call // These must match the TrapThreadsFlags enum #define TrapThreadsFlags_None 0 diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm.inc index eb3205b66d1d37..8aeb084f8e3cd7 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm.inc @@ -18,8 +18,8 @@ #define PTFF_SAVE_R9 0x00000020 #define PTFF_SAVE_SP 0x00000100 #define PTFF_SAVE_R0 0x00000200 -#define PTFF_THREAD_ABORT 0x00100000 -#define PTFF_THREAD_HIJACK 0x00200000 // indicates that this is a frame for a hijacked call +#define PTFF_THREAD_ABORT 0x00004000 +#define PTFF_THREAD_HIJACK 0x00008000 // indicates that this is a frame for a hijacked call #define DEFAULT_FRAME_SAVE_FLAGS (PTFF_SAVE_ALL_PRESERVED + PTFF_SAVE_SP) diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc index a016bf7f7c03fe..36698fece5050b 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc @@ -306,7 +306,7 @@ C_FUNC(\Name): #define PTFF_SAVE_X0 0x00000800 #define PTFF_SAVE_X1 0x00001000 #define PTFF_SAVE_ALL_PRESERVED 0x000003FF // NOTE: x19-x28 -#define PTFF_THREAD_HIJACK_HI 0x00000020 // upper 32 bits of the PTFF_THREAD_HIJACK +#define PTFF_THREAD_HIJACK_HI 0x00000002 // upper 32 bits of the PTFF_THREAD_HIJACK #define DEFAULT_FRAME_SAVE_FLAGS (PTFF_SAVE_ALL_PRESERVED + PTFF_SAVE_SP) @@ -346,7 +346,7 @@ C_FUNC(\Name): .endm // Bit position for the flags above, to be used with tbz / tbnz instructions -#define PTFF_THREAD_ABORT_BIT 36 +#define PTFF_THREAD_ABORT_BIT 32 // // CONSTANTS -- INTEGER diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosloongarch64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosloongarch64.inc index a035a3558cc632..f8b9d1aa633351 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosloongarch64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosloongarch64.inc @@ -309,7 +309,7 @@ C_FUNC(\Name): .endm // Bit position for the flags above, to be used with bstrpick.d+beq/bne instructions -#define PTFF_THREAD_ABORT_BIT 35 +#define PTFF_THREAD_ABORT_BIT 31 // // CONSTANTS -- INTEGER