Skip to content

Commit

Permalink
JIT: Support custom ClassLayout instances with GC pointers in them (#…
Browse files Browse the repository at this point in the history
…112064)

- Add a `ClassLayoutBuilder` that can be used to build new `ClassLayout` instances with arbitrary GC pointers
- Add support for GC types to `LCL_FLD` stress to test some of this new support

Subsumes #111942
Fixes #103362
  • Loading branch information
jakobbotsch authored Feb 5, 2025
1 parent 2faef6d commit fae05be
Show file tree
Hide file tree
Showing 6 changed files with 424 additions and 129 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8292,7 +8292,7 @@ const StructSegments& Compiler::GetSignificantSegments(ClassLayout* layout)

StructSegments* newSegments = new (this, CMK_Promotion) StructSegments(getAllocator(CMK_Promotion));

if (layout->IsBlockLayout())
if (layout->IsCustomLayout())
{
newSegments->Add(StructSegments::Segment(0, layout->GetSize()));
}
Expand Down
12 changes: 7 additions & 5 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9246,7 +9246,7 @@ class Compiler

bool isOpaqueSIMDType(ClassLayout* layout) const
{
if (layout->IsBlockLayout())
if (layout->IsCustomLayout())
{
return true;
}
Expand Down Expand Up @@ -11104,14 +11104,16 @@ class Compiler
ClassLayout* typGetLayoutByNum(unsigned layoutNum);
// Get the layout number of the specified layout.
unsigned typGetLayoutNum(ClassLayout* layout);
// Get the layout for the specified class handle.
ClassLayout* typGetObjLayout(CORINFO_CLASS_HANDLE classHandle);
// Get the number of a layout for the specified class handle.
unsigned typGetObjLayoutNum(CORINFO_CLASS_HANDLE classHandle);
ClassLayout* typGetCustomLayout(const ClassLayoutBuilder& builder);
unsigned typGetCustomLayoutNum(const ClassLayoutBuilder& builder);
// Get the layout having the specified size but no class handle.
ClassLayout* typGetBlkLayout(unsigned blockSize);
// Get the number of a layout having the specified size but no class handle.
unsigned typGetBlkLayoutNum(unsigned blockSize);
// Get the layout for the specified class handle.
ClassLayout* typGetObjLayout(CORINFO_CLASS_HANDLE classHandle);
// Get the number of a layout for the specified class handle.
unsigned typGetObjLayoutNum(CORINFO_CLASS_HANDLE classHandle);

var_types TypeHandleToVarType(CORINFO_CLASS_HANDLE handle, ClassLayout** pLayout = nullptr);
var_types TypeHandleToVarType(CorInfoType jitType, CORINFO_CLASS_HANDLE handle, ClassLayout** pLayout = nullptr);
Expand Down
Loading

0 comments on commit fae05be

Please sign in to comment.