Skip to content

Commit 90b7be3

Browse files
shushanhfqiaopengcheng
andauthored
[LoongArch64] JIT/EE interface for getting ABI-info (#62893)
* [LoongArch64] add ToolBox directory about jitinterace for getting ABI-info. (#59561) Co-authored-by: Loongson's .NET-teams * [LoongArch64] add new interace for getting ABI-info. (#59561) * [LoongArch64] add the linking page for LoongArch64 ABI-info. (#59561) * [LoongArch64] moved ThunkInput.txt to #62885. * [LoongArch64] moved vm/jitinterface.cpp to #62885. * remove the JIT/EE interface back from #62885.. * [LoongArch64] Fix the compiling error after merge. * [LoongArch64] add comments for the returned value of `getFieldTypeByHnd`. * [LoongArch64] rename getFieldTypeByHnd to getFieldSizeClassificationByHnd. Also add macro define for returned value of `getFieldSizeClassificationByHnd`. * [LoongArch64] Delete the interface `getArgType2`. And refactor the returned values of `getFieldSizeClassificationByHnd`. * [LoongArch64] delete `GetArgType` within `ToolBox/superpmi`. * [LoongArch64] rename `getFieldSizeClassificationByHnd` to `getLoongArch64PassStructInRegisterFlags`. * [LoongArch64] amend the floating-ABI for native-struct. * [LoongArch64] update all related `GetFieldSizeClassificationByHnd` by `GetLoongArch64PassStructInRegisterFlags` and amend some comments. * [LoongArch64] replace `LookupApproxFieldTypeHandle()` by `GetFieldTypeHandleThrowing()`. * [LoongArch64] implements the crossgen2 for LoongArch64. * Revert "[LoongArch64] implements the crossgen2 for LoongArch64." This reverts commit b05a2b9. The crossgen2 for LoongArch64 will be submitted by a new PR. * [LoongArch64] update the `GUID JITEEVersionIdentifier`. Also delete some unused comments. Co-authored-by: qiaopengcheng <[email protected]>
1 parent d59bfff commit 90b7be3

File tree

18 files changed

+658
-61
lines changed

18 files changed

+658
-61
lines changed

docs/design/coreclr/botr/clr-abi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Arm corporation ABI documentation (for ARM32 and ARM64) is [here](https://develo
2626

2727
The Linux System V x86_64 ABI is documented in [System V Application Binary Interface / AMD64 Architecture Processor Supplement](https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf), with document source material [here](https://gitlab.com/x86-psABIs/x86-64-ABI).
2828

29+
The LoongArch64 ABI documentation is [here](https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc)
30+
2931
# General Unwind/Frame Layout
3032

3133
For all non-x86 platforms, all methods must have unwind information so the garbage collector (GC) can unwind them (unlike native code in which a leaf method may be omitted).

src/coreclr/inc/corinfo.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,45 @@ struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
316316
}
317317
};
318318

319+
// StructFloadFieldInfoFlags: used on LoongArch64 architecture by `getLoongArch64PassStructInRegisterFlags` API
320+
// to convey struct argument passing information.
321+
//
322+
// `STRUCT_NO_FLOAT_FIELD` means structs are not passed using the float register(s).
323+
//
324+
// Otherwise, and only for structs with no more than two fields and a total struct size no larger
325+
// than two pointers:
326+
//
327+
// The lowest four bits denote the floating-point info:
328+
// bit 0: `1` means there is only one float or double field within the struct.
329+
// bit 1: `1` means only the first field is floating-point type.
330+
// bit 2: `1` means only the second field is floating-point type.
331+
// bit 3: `1` means the two fields are both floating-point type.
332+
// The bits[5:4] denoting whether the field size is 8-bytes:
333+
// bit 4: `1` means the first field's size is 8.
334+
// bit 5: `1` means the second field's size is 8.
335+
//
336+
// Note that bit 0 and 3 cannot both be set.
337+
enum StructFloatFieldInfoFlags
338+
{
339+
STRUCT_NO_FLOAT_FIELD = 0x0,
340+
STRUCT_FLOAT_FIELD_ONLY_ONE = 0x1,
341+
STRUCT_FLOAT_FIELD_ONLY_TWO = 0x8,
342+
STRUCT_FLOAT_FIELD_FIRST = 0x2,
343+
STRUCT_FLOAT_FIELD_SECOND = 0x4,
344+
STRUCT_FIRST_FIELD_SIZE_IS8 = 0x10,
345+
STRUCT_SECOND_FIELD_SIZE_IS8 = 0x20,
346+
347+
STRUCT_FIRST_FIELD_DOUBLE = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FIRST_FIELD_SIZE_IS8),
348+
STRUCT_SECOND_FIELD_DOUBLE = (STRUCT_FLOAT_FIELD_SECOND | STRUCT_SECOND_FIELD_SIZE_IS8),
349+
STRUCT_FIELD_TWO_DOUBLES = (STRUCT_FIRST_FIELD_SIZE_IS8 | STRUCT_SECOND_FIELD_SIZE_IS8 | STRUCT_FLOAT_FIELD_ONLY_TWO),
350+
351+
STRUCT_MERGE_FIRST_SECOND = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_ONLY_TWO),
352+
STRUCT_MERGE_FIRST_SECOND_8 = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_ONLY_TWO | STRUCT_SECOND_FIELD_SIZE_IS8),
353+
354+
STRUCT_HAS_FLOAT_FIELDS_MASK = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_SECOND | STRUCT_FLOAT_FIELD_ONLY_TWO | STRUCT_FLOAT_FIELD_ONLY_ONE),
355+
STRUCT_HAS_8BYTES_FIELDS_MASK = (STRUCT_FIRST_FIELD_SIZE_IS8 | STRUCT_SECOND_FIELD_SIZE_IS8),
356+
};
357+
319358
#include "corinfoinstructionset.h"
320359

321360
// CorInfoHelpFunc defines the set of helpers (accessed via the ICorDynamicInfo::getHelperFtn())
@@ -2843,6 +2882,7 @@ class ICorStaticInfo
28432882
/* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
28442883
) = 0;
28452884

2885+
virtual uint32_t getLoongArch64PassStructInRegisterFlags(CORINFO_CLASS_HANDLE cls) = 0;
28462886
};
28472887

28482888
/*****************************************************************************

src/coreclr/inc/icorjitinfoimpl_generated.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,9 @@ bool getSystemVAmd64PassStructInRegisterDescriptor(
480480
CORINFO_CLASS_HANDLE structHnd,
481481
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) override;
482482

483+
uint32_t getLoongArch64PassStructInRegisterFlags(
484+
CORINFO_CLASS_HANDLE structHnd) override;
485+
483486
uint32_t getThreadTLSIndex(
484487
void** ppIndirection) override;
485488

src/coreclr/inc/jiteeversionguid.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ typedef const GUID *LPCGUID;
4343
#define GUID_DEFINED
4444
#endif // !GUID_DEFINED
4545

46-
constexpr GUID JITEEVersionIdentifier = { /* e6a73797-0cbe-4cf8-b4ad-724a25466211 */
47-
0xe6a73797,
48-
0x0cbe,
49-
0x4cf8,
50-
{0xb4, 0xad, 0x72, 0x4a, 0x25, 0x46, 0x62, 0x11}
51-
};
46+
constexpr GUID JITEEVersionIdentifier = { /* 80a6aaf7-7fb3-44b2-8fe5-95fd47308798 */
47+
0x80a6aaf7,
48+
0x7fb3,
49+
0x44b2,
50+
{0x8f, 0xe5, 0x95, 0xfd, 0x47, 0x30, 0x87, 0x98}
51+
};
5252

5353
//////////////////////////////////////////////////////////////////////////////////////////////////////////
5454
//

src/coreclr/jit/ICorJitInfo_API_names.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ DEF_CLR_API(getMethodNameFromMetadata)
122122
DEF_CLR_API(getMethodHash)
123123
DEF_CLR_API(findNameOfToken)
124124
DEF_CLR_API(getSystemVAmd64PassStructInRegisterDescriptor)
125+
DEF_CLR_API(getLoongArch64PassStructInRegisterFlags)
125126
DEF_CLR_API(getThreadTLSIndex)
126127
DEF_CLR_API(getInlinedCallFrameVptr)
127128
DEF_CLR_API(getAddrOfCaptureThreadGlobal)

src/coreclr/jit/ICorJitInfo_API_wrapper.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,15 @@ bool WrapICorJitInfo::getSystemVAmd64PassStructInRegisterDescriptor(
11541154
return temp;
11551155
}
11561156

1157+
uint32_t WrapICorJitInfo::getLoongArch64PassStructInRegisterFlags(
1158+
CORINFO_CLASS_HANDLE structHnd)
1159+
{
1160+
API_ENTER(getLoongArch64PassStructInRegisterFlags);
1161+
uint32_t temp = wrapHnd->getLoongArch64PassStructInRegisterFlags(structHnd);
1162+
API_LEAVE(getLoongArch64PassStructInRegisterFlags);
1163+
return temp;
1164+
}
1165+
11571166
uint32_t WrapICorJitInfo::getThreadTLSIndex(
11581167
void** ppIndirection)
11591168
{

0 commit comments

Comments
 (0)