Skip to content

Commit 711bab7

Browse files
committed
tweak
1 parent 420fb38 commit 711bab7

File tree

4 files changed

+35
-32
lines changed

4 files changed

+35
-32
lines changed

src/coreclr/inc/gcinfodecoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ class GcInfoDecoder
499499
//------------------------------------------------------------------------
500500

501501
bool IsInterruptible();
502+
bool HasInterruptibleRanges();
502503

503504
#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
504505
bool IsSafePoint();

src/coreclr/nativeaot/Runtime/unix/UnixNativeCodeManager.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -224,31 +224,29 @@ void UnixNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
224224
// code is recorded with -1 skew, so we must adjust accordingly.
225225
codeOffset--;
226226
}
227-
else
227+
228+
GcInfoDecoder decoder(
229+
GCInfoToken(gcInfo),
230+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
231+
codeOffset
232+
);
233+
234+
if (isActiveStackFrame)
228235
{
229236
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
230237
// Or, better yet, maybe we should change the decoder to not require this adjustment.
231238
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
232239
// does not seem possible.
233-
GcInfoDecoder decoder1(
234-
GCInfoToken(gcInfo),
235-
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
236-
codeOffset
237-
);
238-
239-
if (!decoder1.IsInterruptible())
240+
if (!decoder.HasInterruptibleRanges())
240241
{
241-
assert(decoder1.IsSafePoint());
242-
codeOffset--;
242+
decoder = GcInfoDecoder(
243+
GCInfoToken(gcInfo),
244+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
245+
codeOffset - 1
246+
);
243247
}
244248
}
245249

246-
GcInfoDecoder decoder(
247-
GCInfoToken(gcInfo),
248-
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
249-
codeOffset
250-
);
251-
252250
ICodeManagerFlags flags = (ICodeManagerFlags)0;
253251
if (((UnixNativeMethodInfo*)pMethodInfo)->executionAborted)
254252
flags = ICodeManagerFlags::ExecutionAborted;

src/coreclr/nativeaot/Runtime/windows/CoffNativeCodeManager.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -397,31 +397,29 @@ void CoffNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
397397
// code is recorded with -1 skew, so we must adjust accordingly.
398398
codeOffset--;
399399
}
400-
else
400+
401+
GcInfoDecoder decoder(
402+
GCInfoToken(gcInfo),
403+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
404+
codeOffset
405+
);
406+
407+
if (isActiveStackFrame)
401408
{
402409
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
403410
// Or, better yet, maybe we should change the decoder to not require this adjustment.
404411
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
405412
// does not seem possible.
406-
GcInfoDecoder decoder1(
407-
GCInfoToken(gcInfo),
408-
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
409-
codeOffset
410-
);
411-
412-
if (!decoder1.IsInterruptible())
413+
if (!decoder.HasInterruptibleRanges())
413414
{
414-
assert(decoder1.IsSafePoint());
415-
codeOffset--;
415+
decoder = GcInfoDecoder(
416+
GCInfoToken(gcInfo),
417+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
418+
codeOffset - 1
419+
);
416420
}
417421
}
418422

419-
GcInfoDecoder decoder(
420-
GCInfoToken(gcInfo),
421-
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
422-
codeOffset
423-
);
424-
425423
ICodeManagerFlags flags = (ICodeManagerFlags)0;
426424
if (((CoffNativeMethodInfo *)pMethodInfo)->executionAborted)
427425
flags = ICodeManagerFlags::ExecutionAborted;

src/coreclr/vm/gcinfodecoder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ bool GcInfoDecoder::IsInterruptible()
397397
return m_IsInterruptible;
398398
}
399399

400+
bool GcInfoDecoder::HasInterruptibleRanges()
401+
{
402+
_ASSERTE(m_Flags & (DECODE_INTERRUPTIBILITY | DECODE_GC_LIFETIMES));
403+
return m_NumInterruptibleRanges > 0;
404+
}
405+
400406
bool GcInfoDecoder::IsSafePoint()
401407
{
402408
_ASSERTE(m_Flags & (DECODE_INTERRUPTIBILITY | DECODE_GC_LIFETIMES));

0 commit comments

Comments
 (0)