Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
da7b00b
initial port from the prototype
VSadov Feb 25, 2023
170a306
parse the attribute in MT builder
VSadov Feb 26, 2023
bb1c3db
validate replicated size
VSadov Feb 26, 2023
0a4cd78
aot changes
VSadov Feb 26, 2023
6eeb887
refmap
VSadov Feb 27, 2023
f0d156b
validate total size in ilc
VSadov Feb 27, 2023
470aee2
add the actual attribute
VSadov Feb 28, 2023
78ab523
Apply suggestions from code review
VSadov Feb 28, 2023
a452be7
add a small use of InlineArray in CoreLib - to get some crossgen cove…
VSadov Feb 28, 2023
2801f50
a few more uses in CorLib
VSadov Mar 1, 2023
e3284d1
fix for sequential layout
VSadov Mar 1, 2023
4ff0a25
Standardize on use of "InlineArray" in the implementation
VSadov Mar 2, 2023
b406dfe
simpler layout replication
VSadov Mar 2, 2023
7f197d6
some initial tests (will add more)
VSadov Mar 3, 2023
1852993
more tests
VSadov Mar 4, 2023
295caf1
limit the max size of array instance to 1MiB
VSadov Mar 4, 2023
e7738ea
fix an assert in importercalls.cpp
VSadov Mar 4, 2023
065467b
"result" in GC layout should track the pointer count, not the size
VSadov Mar 4, 2023
62b20c8
error messages
VSadov Mar 8, 2023
01e2e17
fixed uses of "value array" in comments.
VSadov Mar 8, 2023
f844772
PR feedback on StackAllocedArguments
VSadov Mar 8, 2023
1b5f608
use the same size limit for inline arrays in the typeloader
VSadov Mar 8, 2023
bf676e4
more PR feedback
VSadov Mar 8, 2023
7d42fbc
remove SetCannotBeBlittedByObjectCloner
VSadov Mar 8, 2023
7fff2be
moving GetInlineArrayLength to MetadataType and related changes
VSadov Mar 10, 2023
2d403ee
use type.Context.Target.PointerSize
VSadov Mar 10, 2023
f6f6acc
lost resources change
VSadov Mar 10, 2023
d68cfa2
fix for x86
VSadov Mar 12, 2023
ebc698b
Do not make InlineArrayType an inline array just yet.
VSadov Mar 13, 2023
9373c77
CORINFO_FLG_INDEXABLE_FIELDS
VSadov Mar 13, 2023
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
simpler layout replication
  • Loading branch information
VSadov committed Mar 10, 2023
commit b406dfeb6f62439195e4297d2b35e30bcf4a8762
55 changes: 24 additions & 31 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2162,28 +2162,6 @@ static unsigned MarkGCField(BYTE* gcPtrs, CorInfoGCType type)
return 0;
}

static unsigned ComputeGCLayout(MethodTable* pMT, BYTE* gcPtrs);

static unsigned ComputeGCLayout(FieldDesc* pFD, BYTE* gcPtrs)
{
unsigned result = 0;
if (pFD->GetFieldType() == ELEMENT_TYPE_VALUETYPE)
{
MethodTable* pFieldMT = pFD->GetApproxFieldTypeHandleThrowing().AsMethodTable();
result += ComputeGCLayout(pFieldMT, gcPtrs);
}
else if (pFD->IsObjRef())
{
result += MarkGCField(gcPtrs, TYPE_GC_REF);
}
else if (pFD->IsByRef())
{
result += MarkGCField(gcPtrs, TYPE_GC_BYREF);
}

return result;
}

static unsigned ComputeGCLayout(MethodTable* pMT, BYTE* gcPtrs)
{
STANDARD_VM_CONTRACT;
Expand All @@ -2195,20 +2173,35 @@ static unsigned ComputeGCLayout(MethodTable* pMT, BYTE* gcPtrs)
ApproxFieldDescIterator fieldIterator(pMT, ApproxFieldDescIterator::INSTANCE_FIELDS);
for (FieldDesc *pFD = fieldIterator.Next(); pFD != NULL; pFD = fieldIterator.Next())
{
int fieldStartIndex = pFD->GetOffset() / TARGET_POINTER_SIZE;

if (pFD->GetFieldType() == ELEMENT_TYPE_VALUETYPE)
{
MethodTable* pFieldMT = pFD->GetApproxFieldTypeHandleThrowing().AsMethodTable();
result += ComputeGCLayout(pFieldMT, gcPtrs + fieldStartIndex);
}
else if (pFD->IsObjRef())
{
result += MarkGCField(gcPtrs + fieldStartIndex, TYPE_GC_REF);
}
else if (pFD->IsByRef())
{
result += MarkGCField(gcPtrs + fieldStartIndex, TYPE_GC_BYREF);
}

if (isInlineArray)
{
_ASSERTE(pFD->GetOffset() == 0);
DWORD totalSize = pMT->GetNumInstanceFieldBytes();
DWORD elementSize = pFD->GetSize();
for (DWORD offset = 0; offset < totalSize; offset += elementSize)
DWORD totalLayoutSize = pMT->GetNumInstanceFieldBytes() / TARGET_POINTER_SIZE;
DWORD elementLayoutSize = pFD->GetSize() / TARGET_POINTER_SIZE;
for (DWORD offset = elementLayoutSize; offset < totalLayoutSize; offset += elementLayoutSize)
{
result += ComputeGCLayout(pFD, gcPtrs + (offset / TARGET_POINTER_SIZE));
memcpy(gcPtrs + offset, gcPtrs, elementLayoutSize);
result += elementLayoutSize;
}
}
else
{
int fieldStartIndex = pFD->GetOffset() / TARGET_POINTER_SIZE;
result += ComputeGCLayout(pFD, gcPtrs + fieldStartIndex);

// value array has only one element field
break;
}
}
return result;
Expand Down