Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5cd729c
allow async interruptions on safepoints
VSadov Dec 4, 2023
2434466
ARM64 TODO
VSadov Dec 4, 2023
cbaafbe
report GC ref/byref returns at partially interruptible callsites
VSadov Dec 9, 2023
ac41f7b
enable on all platforms
VSadov Dec 9, 2023
590a165
tweak
VSadov Dec 10, 2023
5b15ad6
fix after rebasing
VSadov Jan 27, 2024
372f268
do not record tailcalls
VSadov Feb 16, 2024
77aca7b
IsInterruptibleSafePoint
VSadov Feb 16, 2024
eed56d9
update gccover
VSadov Feb 17, 2024
8d85757
turn on new behavior on a gcinfo version
VSadov Feb 17, 2024
f7b7fc0
tailcalls tweak
VSadov Feb 18, 2024
8c7dd48
do not report unused returns
VSadov Feb 21, 2024
250f985
CORINFO_HELP_FAIL_FAST should not be a safepoint
VSadov Feb 21, 2024
1d78a87
treat tailcalls as emitNoGChelper
VSadov Feb 21, 2024
b9fccd4
versioning tweak
VSadov Feb 21, 2024
86a4fa4
enable in CoreCLR (not just for GC stress scenarios)
VSadov Feb 21, 2024
ccd5cc5
fix x86 build
VSadov Feb 22, 2024
fc0352a
other architectures
VSadov Feb 22, 2024
efe24c8
added a knob DOTNET_InterruptibleCallSites
VSadov Feb 22, 2024
1bab7f2
moved DOTNET_InterruptibleCallSites check to the code manager
VSadov Feb 23, 2024
dc56a7a
JIT_StackProbe should not be a safepoint (stack is not cleaned yet)
VSadov Feb 23, 2024
0cc6a4c
Hooked up GCInfo version to R2R file version
VSadov Feb 23, 2024
59a4baa
formatting
VSadov Feb 24, 2024
35d8e63
GCStress support for RISC architectures
VSadov Feb 25, 2024
55a06e1
Update src/coreclr/inc/gcinfo.h
VSadov Feb 25, 2024
4004d6d
make InterruptibleSafePointsEnabled static
VSadov Feb 25, 2024
c5b7296
fix linux-x86 build.
VSadov Feb 25, 2024
11425c5
ARM32 actually can`t return 2 GC references, so can filter out R1 early
VSadov Feb 27, 2024
0743c7b
revert unnecessary change
VSadov Feb 28, 2024
ef760e5
Update src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/Amd64/G…
VSadov Mar 2, 2024
854c3aa
removed GCINFO_VERSION cons from GcInfo.cs
VSadov Mar 2, 2024
4a117b1
Use RBM_INTRET/RBM_INTRET_1
VSadov Mar 2, 2024
5ae3e4b
Update src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/Amd64/G…
VSadov Mar 4, 2024
cae83d9
do not skip safe points twice (stress failure)
VSadov Mar 4, 2024
411f204
revert unnecessary change in gccover.
VSadov Mar 5, 2024
e0a31e1
fix after rebase
VSadov Mar 6, 2024
d68e094
make sure to check `idIsNoGC` on all codepaths in `emitOutputInstr`
VSadov Mar 7, 2024
7ed82b3
make CORINFO_HELP_CHECK_OBJ a no-gc helper (because we can)
VSadov Mar 7, 2024
a149e6a
mark a test that tests WaitForPendingFinalizers as GCStressIncompatible
VSadov Mar 9, 2024
ac126d0
NOP
VSadov Apr 9, 2024
2d4e2c4
these helpers should not form GC safe points
VSadov Apr 20, 2024
aa86a3e
require that the new block has BBF_HAS_LABEL
VSadov Apr 21, 2024
5b5fc28
update register liveness instead of emitting NOP
VSadov Apr 21, 2024
0cb5087
suppressed a few asserts
VSadov Apr 22, 2024
a6376db
update vars conditionally
VSadov Apr 22, 2024
94ffdb1
no need for NOP in fully interruptible case
VSadov Apr 24, 2024
089fd1b
Fix checks to accommodate register wraparounds in multi-reg ops
SwapnilGaikwad Apr 23, 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
Next Next commit
allow async interruptions on safepoints
  • Loading branch information
VSadov committed Apr 14, 2024
commit 5cd729cd70abf1129764b754e727f1514d4fd0a8
4 changes: 4 additions & 0 deletions src/coreclr/gcinfo/gcinfoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ bool GcInfoEncoder::IsAlwaysScratch(GcSlotDesc &slotDesc)
else
return FALSE;

// TODO: VS add ARM64

#elif defined(TARGET_AMD64)

_ASSERTE( m_SizeOfStackOutgoingAndScratchArea != (UINT32)-1 );
Expand All @@ -964,6 +966,8 @@ bool GcInfoEncoder::IsAlwaysScratch(GcSlotDesc &slotDesc)
| (1 << 14) // r14
| (1 << 15); // r15

PreservedRegMask |= 1; // rax - may contain return value

return !(PreservedRegMask & (1 << regNum));
}
else if (!slotDesc.IsUntracked() && (slotDesc.Slot.Stack.Base == GC_SP_REL) &&
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/inc/gcinfodecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ class GcInfoDecoder
bool IsInterruptible();

#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
bool IsSafePoint();

// This is used for gccoverage
bool IsSafePoint(UINT32 codeOffset);

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,7 @@ void CodeGen::genCodeForBBlist()
}
// Do likewise for blocks that end in DOES_NOT_RETURN calls
// that were not caught by the above rules. This ensures that
// gc register liveness doesn't change across call instructions
// in fully-interruptible mode.
// gc register liveness doesn't change to some random state after call instructions
else
{
GenTree* call = block->lastNode();
Expand Down
23 changes: 22 additions & 1 deletion src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ bool UnixNativeCodeManager::IsSafePoint(PTR_VOID pvAddress)
codeOffset
);

return decoder.IsInterruptible();
if (decoder.IsInterruptible())
return true;

if (decoder.IsSafePoint())
return true;

return false;
}

void UnixNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
Expand All @@ -219,6 +225,21 @@ void UnixNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
// the reasons for this adjustment are explained in EECodeManager::EnumGcRefs
codeOffset--;
}
else
{
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
// Or, better yet, maybe we should change the decoder to not require this adjustment.
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
// does not seem possible.
GcInfoDecoder decoder1(
GCInfoToken(gcInfo),
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
codeOffset
);

if (decoder1.IsSafePoint())
codeOffset--;
}

GcInfoDecoder decoder(
GCInfoToken(gcInfo),
Expand Down
25 changes: 23 additions & 2 deletions src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,13 @@ bool CoffNativeCodeManager::IsSafePoint(PTR_VOID pvAddress)
codeOffset
);

return decoder.IsInterruptible();
if (decoder.IsInterruptible())
return true;

if (decoder.IsSafePoint())
return true;

return false;
#else
// Extract the necessary information from the info block header
hdrInfo info;
Expand Down Expand Up @@ -452,12 +458,27 @@ void CoffNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
// the reasons for this adjustment are explained in EECodeManager::EnumGcRefs
codeOffset--;
}
else
{
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
// Or, better yet, maybe we should change the decoder to not require this adjustment.
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
// does not seem possible.
GcInfoDecoder decoder1(
GCInfoToken(gcInfo),
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
codeOffset
);

if (decoder1.IsSafePoint())
codeOffset--;
}

GcInfoDecoder decoder(
GCInfoToken(gcInfo),
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
codeOffset
);
);

if (!decoder.EnumerateLiveSlots(
pRegisterSet,
Expand Down
12 changes: 11 additions & 1 deletion src/coreclr/vm/gcinfodecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ GcInfoDecoder::GcInfoDecoder(
{
if(m_NumSafePoints)
{
m_SafePointIndex = FindSafePoint(m_InstructionOffset);
// Safepoints are encoded with a -1 adjustment
// DECODE_GC_LIFETIMES adjusts the offset accordingly, but DECODE_INTERRUPTIBILITY does not
// adjust here
UINT32 offset = flags & DECODE_INTERRUPTIBILITY ? m_InstructionOffset - 1 : m_InstructionOffset;
m_SafePointIndex = FindSafePoint(offset);
}
}
else if(flags & (DECODE_FOR_RANGES_CALLBACK | DECODE_INTERRUPTIBILITY))
Expand All @@ -393,6 +397,12 @@ bool GcInfoDecoder::IsInterruptible()
return m_IsInterruptible;
}

bool GcInfoDecoder::IsSafePoint()
{
_ASSERTE(m_Flags & (DECODE_INTERRUPTIBILITY | DECODE_GC_LIFETIMES));
return m_SafePointIndex != m_NumSafePoints;
}

bool GcInfoDecoder::HasMethodDescGenericsInstContext()
{
_ASSERTE( m_Flags & DECODE_GENERICS_INST_CONTEXT );
Expand Down