Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c2c2bba
First, add a bunch of failing tests
tomeksowi May 2, 2024
03d4b23
Reduce empty megabyte field to 32k as msvc caps size of arguments at 64k
tomeksowi May 6, 2024
4403c4b
Don't stop calculating flags if struct size > 16 bytes
tomeksowi May 6, 2024
bf81116
Classify empty structs on x64 like padding
tomeksowi May 8, 2024
60ad834
Quell C-linkage warnings just in case
tomeksowi May 8, 2024
9064784
Add Pack=1 to bypass a known problem with field alignment requirement…
tomeksowi May 9, 2024
002c4b2
Merge branch 'main' into empty-struct-passing
tomeksowi May 10, 2024
b02c913
Check `size > 16` only when passing parameters according to integer c…
tomeksowi May 10, 2024
0fde22d
Don't assume struct size > 16 means return by implicit ref to a retur…
tomeksowi May 13, 2024
f89a68d
Don't assume if struct size > 16, IsArgPassedByRef should return true…
tomeksowi May 13, 2024
f5e3930
Adjust ArgIterator.GetNextOffset() for crossgen2 to be the same as th…
tomeksowi May 14, 2024
0a5ce05
Adjust crossgen2 version of ComputeReturnFlags (ComputeReturnValueTre…
tomeksowi May 14, 2024
6a3118b
Adjust IsArgPassedByRef for crossgen2 with native version for VM. Als…
tomeksowi May 14, 2024
0a1a7ff
Don't assume struct (size > 16) means pass by reference in Compiler::…
tomeksowi May 14, 2024
9aa2d10
Add a test for a single-float struct padded with empty struct field
tomeksowi May 14, 2024
9d9d0e2
Relax checks so the new test cases JIT without false positive assertions
tomeksowi May 16, 2024
983d423
New structure to store information about passing structs according to…
tomeksowi May 16, 2024
8366470
Implement GetRiscV64PassFPStructInfo for now with checks against exis…
tomeksowi May 17, 2024
c3e8578
Rename to match similar functions on other architectures
tomeksowi May 20, 2024
c2dd449
Use bitfields to keep the most important flags for decision making pa…
tomeksowi May 20, 2024
0d81d68
Fix JIT for structs with single float padded with empty structs
tomeksowi May 20, 2024
ec8d404
Replace bitfields with manual flags to avoid potential portability pr…
tomeksowi May 21, 2024
98e1861
Update C# version of GetRiscV64PassFpStructInRegistersInfo
tomeksowi May 21, 2024
623a2a6
Replace getRISCV64PassStructInRegisterFlags with getRiscV64PassFpStru…
tomeksowi May 21, 2024
f550c22
Fix offset assignment in C# GetRiscV64PassFpStructInRegistersInfo
tomeksowi May 22, 2024
338e244
Use enregistered struct field offsets in JIT new ABI classifiers
tomeksowi May 22, 2024
894fccd
Merge branch 'main' into empty-struct-passing
tomeksowi May 22, 2024
4cdd228
Fix build: formatting and using static ordering
tomeksowi May 22, 2024
99ec678
Include GC info in FpStructInRegistersInfo like on System V. While it…
tomeksowi May 23, 2024
b5e1cdc
Nicer size shift calculation routine
tomeksowi May 23, 2024
95e787d
Fix build
tomeksowi May 24, 2024
48e7944
Fix Empty8Float test
tomeksowi May 28, 2024
7102f31
Add EmptyFloatEmpty5(U)Byte tests
tomeksowi May 28, 2024
e5d67cd
Increase field visibility to match other tests
tomeksowi May 29, 2024
e25552e
Fix EmptyFloatEmpty5(U)Byte and LongEmptyDouble tests by using correc…
tomeksowi May 31, 2024
28a88b3
Fix LongEmptyGDoubleByImplicitRef and the rest of tests in StructABI …
tomeksowi Jun 4, 2024
123eaaf
Make tests harder
tomeksowi Jun 4, 2024
1a85e0b
Improve logging for GetRiscV64PassFpStructInRegistersInfo, similar to…
tomeksowi Jun 5, 2024
6163536
Format fix
tomeksowi Jun 5, 2024
6dc499d
Fix test EchoArrayOfEmptiesFloatDouble by returning FpStruct{ UseIntC…
tomeksowi Jun 5, 2024
afd95cd
Fix false positive marking a struct split between register and stack
tomeksowi Jun 6, 2024
de83bc7
Add more tests for cases where structs eligible for hardware floating…
tomeksowi Jun 6, 2024
978e851
Fix test EchoEmptyFloatEmpty5ByteSplitRiscV
tomeksowi Jun 6, 2024
dab9167
Remove LclVarDsc::lvIs4Field{1,2} because they were write-only
tomeksowi Jun 6, 2024
2d24bee
Fix ArgIteratorTemplate::GetNextOffset() for struct{Arr[], float}
tomeksowi Jun 6, 2024
9eb6b00
Merge branch 'main' into getnextoffset-for-struct-ptr-float
tomeksowi Jun 7, 2024
d3e974c
Merge branch 'getnextoffset-for-struct-ptr-float' into empty-struct-p…
tomeksowi Jun 7, 2024
a0ccb2a
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 7, 2024
f469ef5
Fix arm32 build by reverting to using cSlotsToEnregister in lclvars.
tomeksowi Jun 10, 2024
811f947
Add failing tests for hardware floating-point calling convention by r…
tomeksowi Jun 10, 2024
b6bef68
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 10, 2024
ac2670b
Fix small struct passing to calls by reflection: CopyStructToRegister…
tomeksowi Jun 11, 2024
76533b6
Fix FP structs returned from calls by reflection
tomeksowi Jun 12, 2024
c7e8a11
Fix the rest of the reflection tests by properly determining whether …
tomeksowi Jun 12, 2024
16b549f
Update crossgen2 C# version of ArgIterator to changes on the native side
tomeksowi Jun 14, 2024
3389bcf
Fix copying structs returned by hardware floating-point calling conve…
tomeksowi Jun 14, 2024
d4f81be
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 14, 2024
7551d35
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 18, 2024
4d2e2cb
Add signedness to integer field FpStructPassInRegistersInfo
tomeksowi Jun 21, 2024
907ac95
Better flag names
tomeksowi Jun 21, 2024
892ec22
Improve explanation why RISC-V can't use genActualType in genParamSta…
tomeksowi Jun 21, 2024
e73450e
Take signedness into account in CopyStructToRegisters
tomeksowi Jun 21, 2024
717cd59
Remove IsSize(1st|2nd)8 because they weren't used much
tomeksowi Jun 21, 2024
64de193
Improve getter names in FpStructInRegistersInfo
tomeksowi Jun 21, 2024
d2d1841
Add comment to fix JIT to AssignClassifiedEightByteTypes
tomeksowi Jun 21, 2024
47f9d87
Add helpers for IntKind and flag names to FpStructInRegistersInfo
tomeksowi Jun 21, 2024
09c0b38
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 21, 2024
8d6a102
Fix C# build: Enum values should be on separate lines
tomeksowi Jun 21, 2024
5ebd2af
Merge branch 'main' into empty-struct-passing
tomeksowi Jun 21, 2024
7036dc0
Make a logging wrapper Compiler::GetPassFpStructInRegistersInfo, simi…
tomeksowi Jun 21, 2024
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
Prev Previous commit
Next Next commit
Rename to match similar functions on other architectures
  • Loading branch information
tomeksowi committed May 20, 2024
commit c3e85787601d29350fd25c2b31b57096e98ac4c1
6 changes: 3 additions & 3 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ enum StructFloatFieldInfoFlags
};

// On RISC-V and LoongArch a struct with up to two non-empty fields, at least one of them floating,
// can be passed in registers. FPStructInfo represents passing information for such structs.
struct FPStructInfo
// can be passed in registers. FpStructInRegistersInfo represents passing information for such structs.
struct FpStructInRegistersInfo
{
struct Field
{
Expand Down Expand Up @@ -390,7 +390,7 @@ struct FPStructInfo
return !fields[0].Empty() + !fields[1].Empty();
}

// TODO: Remove, unless there are places where field offsets are unnecessary and it's difficult to pass FPStructInfo (CallDescrWorker?)
// TODO: Remove, unless there are places where field offsets are unnecessary and it's difficult to pass FpStructInRegistersInfo (CallDescrWorker?)
StructFloatFieldInfoFlags ToFlags() const
{
int flags =
Expand Down
14 changes: 5 additions & 9 deletions src/coreclr/vm/callingconvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class ArgIteratorTemplate : public ARGITERATOR_BASE

// Struct larger than 16 can still be passed in registers according to FP call conv if it has empty fields or
// more padding, so make sure it's passed according to integer call conv which bounds struct to 16 bytes.
return MethodTable::GetRiscV64PassFPStructInfo(th).IsPassedWithIntegerCallConv();
return MethodTable::GetRiscV64PassFpStructInRegistersInfo(th).IsPassedWithIntegerCallConv();
}
return FALSE;
#else
Expand Down Expand Up @@ -601,7 +601,7 @@ class ArgIteratorTemplate : public ARGITERATOR_BASE
if (m_argSize <= ENREGISTERED_PARAMTYPE_MAXSIZE)
return FALSE;

return MethodTable::GetRiscV64PassFPStructInfo(m_argTypeHandle).IsPassedWithIntegerCallConv();
return MethodTable::GetRiscV64PassFpStructInRegistersInfo(m_argTypeHandle).IsPassedWithIntegerCallConv();
#else
return (m_argSize > ENREGISTERED_PARAMTYPE_MAXSIZE);
#endif
Expand Down Expand Up @@ -1795,7 +1795,7 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
#elif defined(TARGET_RISCV64)
assert(!this->IsVarArg()); // Varargs on RISC-V not supported yet
int cFPRegs = 0;
FPStructInfo info = {};
FpStructInRegistersInfo info = {};

switch (argType)
{
Expand All @@ -1806,12 +1806,8 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
break;

case ELEMENT_TYPE_VALUETYPE:
info = MethodTable::GetRiscV64PassFPStructInfo(thValueType);
if (!info.IsPassedWithIntegerCallConv())
{
// Struct may be passed according to hardware floating-point calling convention
cFPRegs = info.fields[0].isFloating + info.fields[1].isFloating;
}
info = MethodTable::GetRiscV64PassFpStructInRegistersInfo(thValueType);
cFPRegs = info.fields[0].isFloating + info.fields[1].isFloating;
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9653,7 +9653,7 @@ uint32_t CEEInfo::getRISCV64PassStructInRegisterFlags(CORINFO_CLASS_HANDLE cls)
uint32_t size = STRUCT_NO_FLOAT_FIELD;

#if defined(TARGET_RISCV64)
size = (uint32_t)MethodTable::GetRiscV64PassFPStructInfo(TypeHandle(cls)).ToFlags();
size = (uint32_t)MethodTable::GetRiscV64PassFpStructInRegistersInfo(TypeHandle(cls)).ToFlags();
#endif // TARGET_RISCV64

EE_TO_JIT_TRANSITION_LEAF();
Expand Down
26 changes: 13 additions & 13 deletions src/coreclr/vm/methodtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,7 @@ int MethodTable::GetRiscV64PassStructInRegisterFlags(TypeHandle th)
#endif

#if defined(TARGET_RISCV64) || defined(TARGET_LOONGARCH64)
static bool HandleInlineArray(int elementTypeIndex, int nElements, FPStructInfo& info DEBUG_ARG(const char* fieldNames[2]))
static bool HandleInlineArray(int elementTypeIndex, int nElements, FpStructInRegistersInfo& info DEBUG_ARG(const char* fieldNames[2]))
{
int typeIndex = info.NumFields();
int nFlattenedFieldsPerElement = typeIndex - elementTypeIndex;
Expand All @@ -3040,7 +3040,7 @@ static bool HandleInlineArray(int elementTypeIndex, int nElements, FPStructInfo&
return true;
}

static bool FlattenFields(TypeHandle th, uint32_t offset, FPStructInfo& info DEBUG_ARG(const char* fieldNames[2]))
static bool FlattenFields(TypeHandle th, uint32_t offset, FpStructInRegistersInfo& info DEBUG_ARG(const char* fieldNames[2]))
{
bool isManaged = !th.IsTypeDesc();
MethodTable* pMT = isManaged ? th.AsMethodTable() : th.AsNativeValueType();
Expand Down Expand Up @@ -3137,14 +3137,14 @@ static bool FlattenFields(TypeHandle th, uint32_t offset, FPStructInfo& info DEB
#endif

#if defined(TARGET_RISCV64)
static void LogFPStructInfo(TypeHandle th, FPStructInfo info, const char* fieldNames[2], const char* message)
static void LogFpStructInRegistersInfo(TypeHandle th, FpStructInRegistersInfo info, const char* fieldNames[2], const char* message)
{
if (!LoggingOn(LF_JIT, LL_EVERYTHING))
return;

SString name;
th.GetName(name);
LOG((LF_JIT, LL_EVERYTHING, "GetRiscV64PassFPStructInfo: Struct %s %s, %u fields%s\n",
LOG((LF_JIT, LL_EVERYTHING, "GetRiscV64PassFpStructInRegistersInfo: Struct %s %s, %u fields%s\n",
name.GetUTF8(), message, info.NumFields(), (info.NumFields() > 0 ? ":" : "")));

if (!info.fields[0].Empty())
Expand All @@ -3159,31 +3159,31 @@ static void LogFPStructInfo(TypeHandle th, FPStructInfo info, const char* fieldN
}
}

static FPStructInfo GetRiscV64PassFPStructInfoImpl(TypeHandle th)
static FpStructInRegistersInfo GetRiscV64PassFpStructInRegistersInfoImpl(TypeHandle th)
{
FPStructInfo info = {};
FpStructInRegistersInfo info = {};
INDEBUG(const char* fieldNames[2] = {};)
if (!FlattenFields(th, 0, info DEBUG_ARG(fieldNames)))
{
INDEBUG(LogFPStructInfo(th, info, fieldNames, "cannot be passed according to floating-point calling convention");)
return FPStructInfo{};
INDEBUG(LogFpStructInRegistersInfo(th, info, fieldNames, "cannot be passed according to floating-point calling convention");)
return FpStructInRegistersInfo{};
}

assert(!(info.fields[0].Empty() && !info.fields[1].Empty()));

if (!info.fields[0].isFloating && !info.fields[1].isFloating)
{
INDEBUG(LogFPStructInfo(th, info, fieldNames, "does not have any floating fields");)
return FPStructInfo{};
INDEBUG(LogFpStructInRegistersInfo(th, info, fieldNames, "does not have any floating fields");)
return FpStructInRegistersInfo{};
}

INDEBUG(LogFPStructInfo(th, info, fieldNames, "can be passed according to floating-point calling convention");)
INDEBUG(LogFpStructInRegistersInfo(th, info, fieldNames, "can be passed according to floating-point calling convention");)
return info;
}

FPStructInfo MethodTable::GetRiscV64PassFPStructInfo(TypeHandle th)
FpStructInRegistersInfo MethodTable::GetRiscV64PassFpStructInRegistersInfo(TypeHandle th)
{
FPStructInfo info = GetRiscV64PassFPStructInfoImpl(th);
FpStructInRegistersInfo info = GetRiscV64PassFpStructInRegistersInfoImpl(th);
int flags = GetRiscV64PassStructInRegisterFlags(th);

if (info.IsPassedWithIntegerCallConv())
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/methodtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class MethodTable
static int GetLoongArch64PassStructInRegisterFlags(TypeHandle th);
#elif defined(TARGET_RISCV64)
static int GetRiscV64PassStructInRegisterFlags(TypeHandle th);
static FPStructInfo GetRiscV64PassFPStructInfo(TypeHandle th);
static FpStructInRegistersInfo GetRiscV64PassFpStructInRegistersInfo(TypeHandle th);
#endif

#if defined(UNIX_AMD64_ABI_ITF)
Expand Down