From 51faaa63888f6f567aaf69f31d846a428913bee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 6 Mar 2025 00:00:14 +0100 Subject: [PATCH] Fix build breaks --- src/coreclr/nativeaot/Runtime/EHHelpers.cpp | 2 -- .../amd64/CachedInterfaceDispatchAot.S | 8 ------- .../amd64/CachedInterfaceDispatchAot.asm | 18 -------------- .../arm64/CachedInterfaceDispatchAot.S | 20 ---------------- .../arm64/CachedInterfaceDispatchAot.asm | 20 ---------------- src/coreclr/nativeaot/Runtime/portable.cpp | 6 ----- .../runtime/CachedInterfaceDispatch.cpp | 2 ++ src/coreclr/runtime/arm/StubDispatch.S | 24 ------------------- src/coreclr/runtime/i386/StubDispatch.asm | 16 ------------- .../runtime/loongarch64/StubDispatch.S | 20 ---------------- src/coreclr/runtime/riscv64/StubDispatch.S | 19 --------------- 11 files changed, 2 insertions(+), 153 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp index aff815a48170f5..a3643e32f5eaf7 100644 --- a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp +++ b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp @@ -266,7 +266,6 @@ EXTERN_C CODE_LOCATION RhpInterfaceDispatchAVLocation8; EXTERN_C CODE_LOCATION RhpInterfaceDispatchAVLocation16; EXTERN_C CODE_LOCATION RhpInterfaceDispatchAVLocation32; EXTERN_C CODE_LOCATION RhpInterfaceDispatchAVLocation64; -EXTERN_C CODE_LOCATION RhpVTableOffsetDispatchAVLocation; static bool InInterfaceDispatchHelper(uintptr_t faultingIP) { @@ -281,7 +280,6 @@ static bool InInterfaceDispatchHelper(uintptr_t faultingIP) (uintptr_t)&RhpInterfaceDispatchAVLocation16, (uintptr_t)&RhpInterfaceDispatchAVLocation32, (uintptr_t)&RhpInterfaceDispatchAVLocation64, - (uintptr_t)&RhpVTableOffsetDispatchAVLocation, }; // compare the IP against the list of known possible AV locations in the interface dispatch helpers diff --git a/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.S b/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.S index 2500ea41767266..378abf0f8ca912 100644 --- a/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.S +++ b/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.S @@ -8,14 +8,6 @@ // trick to avoid PLT relocation at runtime which corrupts registers #define REL_C_FUNC(name) C_FUNC(name)@gotpcrel -// Stub dispatch routine for dispatch to a vtable slot -LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - int 3 - // UNIXTODO: Implement this function - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - int 3 -LEAF_END RhpVTableOffsetDispatch, _TEXT - // Cache miss case, call the runtime to resolve the target and update the cache. // Use universal transition helper to allow an exception to flow out of resolution LEAF_ENTRY RhpInterfaceDispatchSlow, _TEXT diff --git a/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.asm b/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.asm index e1caae3adedbc0..b2f58cb4f31e39 100644 --- a/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.asm +++ b/src/coreclr/nativeaot/Runtime/amd64/CachedInterfaceDispatchAot.asm @@ -9,24 +9,6 @@ EXTERN RhpUniversalTransition_DebugStepTailCall : PROC EXTERN RhpCidResolve : PROC EXTERN RhpUniversalTransition_DebugStepTailCall : PROC - -;; Stub dispatch routine for dispatch to a vtable slot -LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - ;; r11 currently contains the indirection cell address. - ;; load rax to point to the vtable offset (which is stored in the m_pCache field). - mov rax, [r11 + OFFSETOF__InterfaceDispatchCell__m_pCache] - - ;; Load the MethodTable from the object instance in rcx, and add it to the vtable offset - ;; to get the address in the vtable of what we want to dereference - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - add rax, [rcx] - - ;; Load the target address of the vtable into rax - mov rax, [rax] - - TAILJMP_RAX -LEAF_END RhpVTableOffsetDispatch, _TEXT - ;; Cache miss case, call the runtime to resolve the target and update the cache. ;; Use universal transition helper to allow an exception to flow out of resolution LEAF_ENTRY RhpInterfaceDispatchSlow, _TEXT diff --git a/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.S b/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.S index d2a1131c2c8686..f759ac029aff85 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.S +++ b/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.S @@ -9,26 +9,6 @@ .extern RhpCidResolve .extern RhpUniversalTransition_DebugStepTailCall -// -// Stub dispatch routine for dispatch to a vtable slot -// - LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - // x11 contains the interface dispatch cell address. - // load x12 to point to the vtable offset (which is stored in the m_pCache field). - ldr x12, [x11, #OFFSETOF__InterfaceDispatchCell__m_pCache] - - // Load the MethodTable from the object instance in x0, and add it to the vtable offset - // to get the address in the vtable of what we want to dereference - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - ldr x13, [x0] - add x12, x12, x13 - - // Load the target address of the vtable into x12 - ldr x12, [x12] - - br x12 - LEAF_END RhpVTableOffsetDispatch, _TEXT - // // Cache miss case, call the runtime to resolve the target and update the cache. // Use universal transition helper to allow an exception to flow out of resolution. diff --git a/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.asm b/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.asm index 5b97f041f75f1d..7d6fb39a7c9c62 100644 --- a/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.asm +++ b/src/coreclr/nativeaot/Runtime/arm64/CachedInterfaceDispatchAot.asm @@ -10,26 +10,6 @@ EXTERN RhpCidResolve EXTERN RhpUniversalTransition_DebugStepTailCall -;; -;; Stub dispatch routine for dispatch to a vtable slot -;; - LEAF_ENTRY RhpVTableOffsetDispatch - ;; x11 contains the interface dispatch cell address. - ;; load x12 to point to the vtable offset (which is stored in the m_pCache field). - ldr x12, [x11, #OFFSETOF__InterfaceDispatchCell__m_pCache] - - ;; Load the MethodTable from the object instance in x0, and add it to the vtable offset - ;; to get the address in the vtable of what we want to dereference - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - ldr x13, [x0] - add x12, x12, x13 - - ;; Load the target address of the vtable into x12 - ldr x12, [x12] - - br x12 - LEAF_END RhpVTableOffsetDispatch - ;; ;; Cache miss case, call the runtime to resolve the target and update the cache. ;; Use universal transition helper to allow an exception to flow out of resolution. diff --git a/src/coreclr/nativeaot/Runtime/portable.cpp b/src/coreclr/nativeaot/Runtime/portable.cpp index d42a6ecc67efe8..f11a678e9027ee 100644 --- a/src/coreclr/nativeaot/Runtime/portable.cpp +++ b/src/coreclr/nativeaot/Runtime/portable.cpp @@ -323,12 +323,6 @@ FCIMPL0(void, RhpInterfaceDispatch64) } FCIMPLEND -FCIMPL0(void, RhpVTableOffsetDispatch) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -FCIMPLEND - // @TODO Implement UniversalTransition EXTERN_C void * ReturnFromUniversalTransition; void * ReturnFromUniversalTransition; diff --git a/src/coreclr/runtime/CachedInterfaceDispatch.cpp b/src/coreclr/runtime/CachedInterfaceDispatch.cpp index 891c2b94c0baa2..323210dd7e587d 100644 --- a/src/coreclr/runtime/CachedInterfaceDispatch.cpp +++ b/src/coreclr/runtime/CachedInterfaceDispatch.cpp @@ -241,12 +241,14 @@ static uint32_t CacheSizeToIndex(uint32_t cCacheEntries) // address of the interface dispatch stub associated with this size of cache is returned. static uintptr_t AllocateCache(uint32_t cCacheEntries, InterfaceDispatchCache * pExistingCache, const DispatchCellInfo *pNewCellInfo, void ** ppStub) { +#ifndef FEATURE_NATIVEAOT if (pNewCellInfo->CellType == DispatchCellType::VTableOffset) { *ppStub = (void *)&RhpVTableOffsetDispatch; ASSERT(!InterfaceDispatchCell::IsCache(pNewCellInfo->GetVTableOffset())); return pNewCellInfo->GetVTableOffset(); } +#endif ASSERT((cCacheEntries >= 1) && (cCacheEntries <= CID_MAX_CACHE_SIZE)); ASSERT((pExistingCache == NULL) || (pExistingCache->m_cEntries < cCacheEntries)); diff --git a/src/coreclr/runtime/arm/StubDispatch.S b/src/coreclr/runtime/arm/StubDispatch.S index 6b9344d3d748e2..c761df7b3f123e 100644 --- a/src/coreclr/runtime/arm/StubDispatch.S +++ b/src/coreclr/runtime/arm/StubDispatch.S @@ -77,30 +77,6 @@ DEFINE_INTERFACE_DISPATCH_STUB 16 DEFINE_INTERFACE_DISPATCH_STUB 32 DEFINE_INTERFACE_DISPATCH_STUB 64 -// Stub dispatch routine for dispatch to a vtable slot -LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - // On input we have the indirection cell data structure in r12. But we need more scratch registers and - // we may A/V on a null this. Both of these suggest we need a real prolog and epilog. - PROLOG_PUSH {r1} - - // r12 currently holds the indirection cell address. We need to update it to point to the vtable - // offset instead. - ldr r12, [r12, #OFFSETOF__InterfaceDispatchCell__m_pCache] - - // Load the MethodTable from the object instance in r0. - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - ldr r1, [r0] - - // add the vtable offset to the MethodTable pointer - add r12, r1, r12 - - // Load the target address of the vtable into r12 - ldr r12, [r12] - - EPILOG_POP {r1} - EPILOG_BRANCH_REG r12 -LEAF_END RhpVTableOffsetDispatch, _TEXT - // Initial dispatch on an interface when we don't have a cache yet. LEAF_ENTRY RhpInitialInterfaceDispatch, _TEXT // Just tail call to the cache miss helper. diff --git a/src/coreclr/runtime/i386/StubDispatch.asm b/src/coreclr/runtime/i386/StubDispatch.asm index 86dd2807fbc8aa..9b70dd727f5874 100644 --- a/src/coreclr/runtime/i386/StubDispatch.asm +++ b/src/coreclr/runtime/i386/StubDispatch.asm @@ -95,22 +95,6 @@ RhpInterfaceDispatchSlow proc jmp _RhpUniversalTransition_DebugStepTailCall@0 RhpInterfaceDispatchSlow endp -;; Stub dispatch routine for dispatch to a vtable slot -_RhpVTableOffsetDispatch@0 proc public - ;; eax currently contains the indirection cell address. We need to update it to point to the vtable offset (which is in the m_pCache field) - mov eax, [eax + OFFSETOF__InterfaceDispatchCell__m_pCache] - - ;; add the vtable offset to the MethodTable pointer - add eax, [ecx] - - ;; Load the target address of the vtable into eax - mov eax, [eax] - - ;; tail-jump to the target - jmp eax -_RhpVTableOffsetDispatch@0 endp - - ;; Initial dispatch on an interface when we don't have a cache yet. FASTCALL_FUNC RhpInitialDynamicInterfaceDispatch, 0 ALTERNATE_ENTRY _RhpInitialInterfaceDispatch diff --git a/src/coreclr/runtime/loongarch64/StubDispatch.S b/src/coreclr/runtime/loongarch64/StubDispatch.S index a85cafa3389e00..8bee1e035240b0 100644 --- a/src/coreclr/runtime/loongarch64/StubDispatch.S +++ b/src/coreclr/runtime/loongarch64/StubDispatch.S @@ -82,26 +82,6 @@ b C_FUNC(RhpInterfaceDispatchSlow) LEAF_END RhpInitialInterfaceDispatch, _TEXT -// -// Stub dispatch routine for dispatch to a vtable slot -// - LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - // t2 contains the interface dispatch cell address. - // load t3 to point to the vtable offset (which is stored in the m_pCache field). - ld.d $t3, $t2, OFFSETOF__InterfaceDispatchCell__m_pCache - - // Load the MethodTable from the object instance in a0, and add it to the vtable offset - // to get the address in the vtable of what we want to dereference - ALTERNATE_ENTRY RhpVTableOffsetDispatchAVLocation - ld.d $t4, $a0, 0 - add.d $t3, $t3, $t4 - - // Load the target address of the vtable into t3 - ld.d $t3, $t3, 0 - - jirl $r0, $t3, 0 - LEAF_END RhpVTableOffsetDispatch, _TEXT - // // Cache miss case, call the runtime to resolve the target and update the cache. // Use universal transition helper to allow an exception to flow out of resolution. diff --git a/src/coreclr/runtime/riscv64/StubDispatch.S b/src/coreclr/runtime/riscv64/StubDispatch.S index 3823c189e0e8c2..9e49c53fbe0f54 100644 --- a/src/coreclr/runtime/riscv64/StubDispatch.S +++ b/src/coreclr/runtime/riscv64/StubDispatch.S @@ -81,25 +81,6 @@ tail C_FUNC(RhpInterfaceDispatchSlow) LEAF_END RhpInitialInterfaceDispatch, _TEXT - // - // Stub dispatch routine for dispatch to a vtable slot - // - LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT - // t2 contains the interface dispatch cell address. - // Load t3 to point to the vtable offset (which is stored in the m_pCache field). - ld t3, OFFSETOF__InterfaceDispatchCell__m_pCache(t2) - - // Load the MethodTable from the object instance in a0, and add it to the vtable offset - // to get the address in the vtable of what we want to dereference - ld t4, 0(a0) - add t3, t3, t4 - - // Load the target address of the vtable into t3 - ld t3, 0(t3) - - jr t3 - LEAF_END RhpVTableOffsetDispatch, _TEXT - // // Cache miss case, call the runtime to resolve the target and update the cache. // Use universal transition helper to allow an exception to flow out of resolution.