Skip to content

Commit d569006

Browse files
committed
tweak
1 parent 309c75d commit d569006

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
@@ -221,31 +221,29 @@ void UnixNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
221221
// code is recorded with -1 skew, so we must adjust accordingly.
222222
codeOffset--;
223223
}
224-
else
224+
225+
GcInfoDecoder decoder(
226+
GCInfoToken(gcInfo),
227+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
228+
codeOffset
229+
);
230+
231+
if (isActiveStackFrame)
225232
{
226233
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
227234
// Or, better yet, maybe we should change the decoder to not require this adjustment.
228235
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
229236
// does not seem possible.
230-
GcInfoDecoder decoder1(
231-
GCInfoToken(gcInfo),
232-
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
233-
codeOffset
234-
);
235-
236-
if (!decoder1.IsInterruptible())
237+
if (!decoder.HasInterruptibleRanges())
237238
{
238-
assert(decoder1.IsSafePoint());
239-
codeOffset--;
239+
decoder = GcInfoDecoder(
240+
GCInfoToken(gcInfo),
241+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
242+
codeOffset - 1
243+
);
240244
}
241245
}
242246

243-
GcInfoDecoder decoder(
244-
GCInfoToken(gcInfo),
245-
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
246-
codeOffset
247-
);
248-
249247
ICodeManagerFlags flags = (ICodeManagerFlags)0;
250248
if (((UnixNativeMethodInfo*)pMethodInfo)->executionAborted)
251249
flags = ICodeManagerFlags::ExecutionAborted;

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -387,31 +387,29 @@ void CoffNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
387387
// code is recorded with -1 skew, so we must adjust accordingly.
388388
codeOffset--;
389389
}
390-
else
390+
391+
GcInfoDecoder decoder(
392+
GCInfoToken(gcInfo),
393+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
394+
codeOffset
395+
);
396+
397+
if (isActiveStackFrame)
391398
{
392399
// CONSIDER: We can optimize this by remembering the need to adjust in IsSafePoint and propagating into here.
393400
// Or, better yet, maybe we should change the decoder to not require this adjustment.
394401
// The scenario that adjustment tries to handle (fallthrough into BB with random liveness)
395402
// does not seem possible.
396-
GcInfoDecoder decoder1(
397-
GCInfoToken(gcInfo),
398-
GcInfoDecoderFlags(DECODE_INTERRUPTIBILITY),
399-
codeOffset
400-
);
401-
402-
if (!decoder1.IsInterruptible())
403+
if (!decoder.HasInterruptibleRanges())
403404
{
404-
assert(decoder1.IsSafePoint());
405-
codeOffset--;
405+
decoder = GcInfoDecoder(
406+
GCInfoToken(gcInfo),
407+
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
408+
codeOffset - 1
409+
);
406410
}
407411
}
408412

409-
GcInfoDecoder decoder(
410-
GCInfoToken(gcInfo),
411-
GcInfoDecoderFlags(DECODE_GC_LIFETIMES | DECODE_SECURITY_OBJECT | DECODE_VARARG),
412-
codeOffset
413-
);
414-
415413
ICodeManagerFlags flags = (ICodeManagerFlags)0;
416414
if (((CoffNativeMethodInfo *)pMethodInfo)->executionAborted)
417415
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)