Skip to content

Commit b1f63db

Browse files
authored
[LoongArch64] Implement 'JIT_GetDynamicNonGCStaticBase_SingleAppDomain', 'JIT_GetDynamicGCStaticBase_SingleAppDomain' after PR#99183. (#103467)
* Implement `JIT_GetDynamicNonGCStaticBase_SingleAppDomain`, `JIT_GetDynamicGCStaticBase_SingleAppDomain` for LoongArch64 after PR #99183. * Also fix the build error for LA64. Change-Id: Ifb9ee599bca3971270a5bc654770dfcc7e931955
1 parent 3099f31 commit b1f63db

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

src/coreclr/vm/loongarch64/asmconstants.h

+8
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ ASMCONSTANTS_C_ASSERT((1<<FixupPrecode_ALIGNMENT_SHIFT_1) == sizeof(FixupPrecode
206206
ASMCONSTANTS_C_ASSERT(ResolveCacheElem__target == offsetof(ResolveCacheElem, target));
207207
ASMCONSTANTS_C_ASSERT(ResolveCacheElem__pNext == offsetof(ResolveCacheElem, pNext));
208208

209+
#define OFFSETOF__DynamicStaticsInfo__m_pNonGCStatics 0x8
210+
ASMCONSTANTS_C_ASSERT(OFFSETOF__DynamicStaticsInfo__m_pNonGCStatics
211+
== offsetof(DynamicStaticsInfo, m_pNonGCStatics));
212+
213+
#define OFFSETOF__DynamicStaticsInfo__m_pGCStatics 0
214+
ASMCONSTANTS_C_ASSERT(OFFSETOF__DynamicStaticsInfo__m_pGCStatics
215+
== offsetof(DynamicStaticsInfo, m_pGCStatics));
216+
209217
// For JIT_PInvokeBegin and JIT_PInvokeEnd helpers
210218
#define Frame__m_Next 0x08
211219
ASMCONSTANTS_C_ASSERT(Frame__m_Next == offsetof(Frame, m_Next))

src/coreclr/vm/loongarch64/asmhelpers.S

+23-16
Original file line numberDiff line numberDiff line change
@@ -944,28 +944,35 @@ LEAF_END setFPReturn, _TEXT
944944

945945
#endif // FEATURE_COMINTEROP
946946

947-
//
948-
// JIT Static access helpers when coreclr host specifies single appdomain flag
949-
//
950-
951947
// ------------------------------------------------------------------
952-
// void* JIT_GetSharedNonGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
948+
// void* JIT_GetDynamicNonGCStaticBase(DynamicStaticsInfo* pStaticsInfo)
953949

954-
LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
950+
LEAF_ENTRY JIT_GetDynamicNonGCStaticBase_SingleAppDomain, _TEXT
955951
// If class is not initialized, bail to C++ helper
956-
//dext $a1, $a1, 0, 32
957-
addi.d $a2, $a0, DomainLocalModule__m_pDataBlob
952+
ld.d $a1, $a0, OFFSETOF__DynamicStaticsInfo__m_pNonGCStatics
953+
bnez $a1, LOCAL_LABEL(JIT_GetDynamicNonGCStaticBase_SingleAppDomain_CallHelper)
954+
ori $a0, $a1, 0
955+
jirl $r0, $ra, 0
958956

959-
ldx.b $a2, $a2, $a1
960-
andi $t4, $a2, 1
961-
beq $t4, $zero, LOCAL_LABEL(JIT_GetSharedNonGCStaticBase_SingleAppDomain_CallHelper)
957+
LOCAL_LABEL(JIT_GetDynamicNonGCStaticBase_SingleAppDomain_CallHelper):
958+
// Tail call JIT_GetDynamicNonGCStaticBase_Portable
959+
b JIT_GetDynamicNonGCStaticBase_Portable
960+
LEAF_END JIT_GetDynamicNonGCStaticBase_SingleAppDomain, _TEXT
962961

963-
jirl $r0, $ra, 0
962+
// ------------------------------------------------------------------
963+
// void* JIT_GetDynamicGCStaticBase(DynamicStaticsInfo* pStaticsInfo)
964+
965+
LEAF_ENTRY JIT_GetDynamicGCStaticBase_SingleAppDomain, _TEXT
966+
// If class is not initialized, bail to C++ helper
967+
ld.d $a1, $a0, OFFSETOF__DynamicStaticsInfo__m_pGCStatics
968+
bnez $a1, LOCAL_LABEL(JIT_GetDynamicGCStaticBase_SingleAppDomain_CallHelper)
969+
ori $a0, $a1, 0
970+
jirl $r0, $ra, 0
964971

965-
LOCAL_LABEL(JIT_GetSharedNonGCStaticBase_SingleAppDomain_CallHelper):
966-
// Tail call JIT_GetSharedNonGCStaticBase_Helper
967-
b JIT_GetSharedNonGCStaticBase_Helper
968-
LEAF_END JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
972+
LOCAL_LABEL(JIT_GetDynamicGCStaticBase_SingleAppDomain_CallHelper):
973+
// Tail call JIT_GetDynamicGCStaticBase_Portable
974+
b JIT_GetDynamicGCStaticBase_Portable
975+
LEAF_END JIT_GetDynamicGCStaticBase_SingleAppDomain, _TEXT
969976

970977
#ifdef FEATURE_READYTORUN
971978

src/coreclr/vm/loongarch64/cgencpu.h

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ inline unsigned StackElemSize(unsigned parmSize, bool isValueType, bool isFloatH
9898
//
9999
// Create alias for optimized implementations of helpers provided on this platform
100100
//
101+
#define JIT_GetDynamicGCStaticBase JIT_GetDynamicGCStaticBase_SingleAppDomain
102+
#define JIT_GetDynamicNonGCStaticBase JIT_GetDynamicNonGCStaticBase_SingleAppDomain
101103

102104
//**********************************************************************
103105
// Frames

0 commit comments

Comments
 (0)