Skip to content

[LoongArch64] JIT/EE interface for getting ABI-info #62893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
47d106f
Merge pull request #1 from dotnet/main
shushanhf Apr 27, 2021
411b59e
Merge branch 'dotnet:main' into master
shushanhf Oct 25, 2021
7eed4eb
Merge branch 'dotnet:main' into master
shushanhf Dec 6, 2021
0d7c9e4
Merge branch 'dotnet:main' into master
shushanhf Dec 10, 2021
2c534c5
Merge branch 'dotnet:main' into master
shushanhf Dec 14, 2021
6e14d76
Merge branch 'dotnet:main' into master
shushanhf Dec 15, 2021
359875d
Merge branch 'dotnet:main' into master
shushanhf Dec 15, 2021
192b095
Merge branch 'dotnet:main' into main
shushanhf Dec 16, 2021
485a681
[LoongArch64] add ToolBox directory about jitinterace for getting ABI…
shushanhf Dec 16, 2021
42667b3
[LoongArch64] add new interace for getting ABI-info. (#59561)
shushanhf Dec 17, 2021
7e518a8
[LoongArch64] add the linking page for LoongArch64 ABI-info. (#59561)
Dec 17, 2021
db97aa7
[LoongArch64] moved ThunkInput.txt to #62885.
Dec 20, 2021
4e3eeb2
[LoongArch64] moved vm/jitinterface.cpp to #62885.
Dec 20, 2021
f722a3b
remove the JIT/EE interface back from #62885..
Dec 24, 2021
c896413
Merge branch 'main' into main_loongarch64_3a
shushanhf Jan 12, 2022
948a822
[LoongArch64] Fix the compiling error after merge.
shushanhf Jan 12, 2022
a723e85
[LoongArch64] add comments for the returned value of `getFieldTypeByH…
Jan 13, 2022
adb9570
[LoongArch64] rename getFieldTypeByHnd to getFieldSizeClassificationB…
shushanhf Jan 13, 2022
02ff4bf
[LoongArch64] Delete the interface `getArgType2`.
shushanhf Jan 14, 2022
f28774a
[LoongArch64] delete `GetArgType` within `ToolBox/superpmi`.
shushanhf Jan 14, 2022
73d158a
[LoongArch64] rename `getFieldSizeClassificationByHnd` to
shushanhf Jan 14, 2022
7d5d052
[LoongArch64] amend the floating-ABI for native-struct.
shushanhf Jan 17, 2022
b8534b2
[LoongArch64] update all related `GetFieldSizeClassificationByHnd`
Jan 19, 2022
47c81cc
Merge branch 'main' into main_loongarch64_3a
Jan 19, 2022
a3688bf
[LoongArch64] replace `LookupApproxFieldTypeHandle()`
shushanhf Feb 15, 2022
b05a2b9
[LoongArch64] implements the crossgen2 for LoongArch64.
shushanhf Feb 15, 2022
6a179ff
Revert "[LoongArch64] implements the crossgen2 for LoongArch64."
Feb 16, 2022
a6cbbcc
[LoongArch64] update the `GUID JITEEVersionIdentifier`.
Feb 18, 2022
a5d6bcd
Merge branch 'main' into main_loongarch64_3a
Feb 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/design/coreclr/botr/clr-abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Arm corporation ABI documentation (for ARM32 and ARM64) is [here](https://develo

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).

The LoongArch64 ABI documentation is [here](https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc)

# General Unwind/Frame Layout

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).
Expand Down
40 changes: 40 additions & 0 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,45 @@ struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
}
};

// StructFloadFieldInfoFlags: used on LoongArch64 architecture by `getLoongArch64PassStructInRegisterFlags` API
// to convey struct argument passing information.
//
// `STRUCT_NO_FLOAT_FIELD` means structs are not passed using the float register(s).
//
// Otherwise, and only for structs with no more than two fields and a total struct size no larger
// than two pointers:
//
// The lowest four bits denote the floating-point info:
// bit 0: `1` means there is only one float or double field within the struct.
// bit 1: `1` means only the first field is floating-point type.
// bit 2: `1` means only the second field is floating-point type.
// bit 3: `1` means the two fields are both floating-point type.
// The bits[5:4] denoting whether the field size is 8-bytes:
// bit 4: `1` means the first field's size is 8.
// bit 5: `1` means the second field's size is 8.
//
// Note that bit 0 and 3 cannot both be set.
enum StructFloatFieldInfoFlags
{
STRUCT_NO_FLOAT_FIELD = 0x0,
STRUCT_FLOAT_FIELD_ONLY_ONE = 0x1,
STRUCT_FLOAT_FIELD_ONLY_TWO = 0x8,
STRUCT_FLOAT_FIELD_FIRST = 0x2,
STRUCT_FLOAT_FIELD_SECOND = 0x4,
STRUCT_FIRST_FIELD_SIZE_IS8 = 0x10,
STRUCT_SECOND_FIELD_SIZE_IS8 = 0x20,

STRUCT_FIRST_FIELD_DOUBLE = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FIRST_FIELD_SIZE_IS8),
STRUCT_SECOND_FIELD_DOUBLE = (STRUCT_FLOAT_FIELD_SECOND | STRUCT_SECOND_FIELD_SIZE_IS8),
STRUCT_FIELD_TWO_DOUBLES = (STRUCT_FIRST_FIELD_SIZE_IS8 | STRUCT_SECOND_FIELD_SIZE_IS8 | STRUCT_FLOAT_FIELD_ONLY_TWO),

STRUCT_MERGE_FIRST_SECOND = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_ONLY_TWO),
STRUCT_MERGE_FIRST_SECOND_8 = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_ONLY_TWO | STRUCT_SECOND_FIELD_SIZE_IS8),

STRUCT_HAS_FLOAT_FIELDS_MASK = (STRUCT_FLOAT_FIELD_FIRST | STRUCT_FLOAT_FIELD_SECOND | STRUCT_FLOAT_FIELD_ONLY_TWO | STRUCT_FLOAT_FIELD_ONLY_ONE),
STRUCT_HAS_8BYTES_FIELDS_MASK = (STRUCT_FIRST_FIELD_SIZE_IS8 | STRUCT_SECOND_FIELD_SIZE_IS8),
};

#include "corinfoinstructionset.h"

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

virtual uint32_t getLoongArch64PassStructInRegisterFlags(CORINFO_CLASS_HANDLE cls) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment stating what the uint32_t return type returns.

If the argument type must be a struct handle, maybe use structHnd instead of cls, as getSystemVAmd64PassStructInRegisterDescriptor does?

Is the return actually StructFloatFieldInfoFlags? If so, can you just use StructFloatFieldInfoFlags instead of uint32_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment stating what the uint32_t return type returns.

If the argument type must be a struct handle, maybe use structHnd instead of cls, as getSystemVAmd64PassStructInRegisterDescriptor does?

OK, Thanks for guidance.

Is the return actually StructFloatFieldInfoFlags? If so, can you just use StructFloatFieldInfoFlags instead of uint32_t?

Here using uint32_t instead of StructFloatFieldInfoFlags is for composition of different StructFloatFieldInfoFlags.

};

/*****************************************************************************
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ bool getSystemVAmd64PassStructInRegisterDescriptor(
CORINFO_CLASS_HANDLE structHnd,
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) override;

uint32_t getLoongArch64PassStructInRegisterFlags(
CORINFO_CLASS_HANDLE structHnd) override;

uint32_t getThreadTLSIndex(
void** ppIndirection) override;

Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/ICorJitInfo_API_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ DEF_CLR_API(getMethodNameFromMetadata)
DEF_CLR_API(getMethodHash)
DEF_CLR_API(findNameOfToken)
DEF_CLR_API(getSystemVAmd64PassStructInRegisterDescriptor)
DEF_CLR_API(getLoongArch64PassStructInRegisterFlags)
DEF_CLR_API(getThreadTLSIndex)
DEF_CLR_API(getInlinedCallFrameVptr)
DEF_CLR_API(getAddrOfCaptureThreadGlobal)
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/jit/ICorJitInfo_API_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,15 @@ bool WrapICorJitInfo::getSystemVAmd64PassStructInRegisterDescriptor(
return temp;
}

uint32_t WrapICorJitInfo::getLoongArch64PassStructInRegisterFlags(
CORINFO_CLASS_HANDLE structHnd)
{
API_ENTER(getLoongArch64PassStructInRegisterFlags);
uint32_t temp = wrapHnd->getLoongArch64PassStructInRegisterFlags(structHnd);
API_LEAVE(getLoongArch64PassStructInRegisterFlags);
return temp;
}

uint32_t WrapICorJitInfo::getThreadTLSIndex(
void** ppIndirection)
{
Expand Down
Loading