Skip to content

Commit 05b269b

Browse files
committed
no need to search for safepoints when asked only for interruptibility
1 parent 14ef9e1 commit 05b269b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/coreclr/inc/gcinfotypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ inline UINT32 CeilOfLog2(size_t x)
5959
return (UINT32)result;
6060
#else // _MSC_VER
6161
// LZCNT returns index starting from MSB, whereas BSR gives the index from LSB.
62-
// 63 ^ BSR here is equivalent to 63 - BSR since the BSR result is always between 0 and 63.
62+
// 63 ^ LZCNT here is equivalent to 63 - LZCNT since the LZCNT result is always between 0 and 63.
6363
// This saves an instruction, as subtraction from constant requires either MOV/SUB or NEG/ADD.
6464
return (UINT32)63 ^ (UINT32)__builtin_clzl((unsigned long)x);
6565
#endif // _MSC_VER

src/coreclr/vm/gcinfodecoder.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ GcInfoDecoder::GcInfoDecoder(
350350

351351
#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
352352
m_NumSafePoints = (UINT32) DENORMALIZE_NUM_SAFE_POINTS(m_Reader.DecodeVarLengthUnsigned(NUM_SAFE_POINTS_ENCBASE));
353+
m_SafePointIndex = m_NumSafePoints;
353354
#endif
354355

355356
if (slimHeader)
@@ -362,18 +363,14 @@ GcInfoDecoder::GcInfoDecoder(
362363
}
363364

364365
#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
365-
if(flags & (DECODE_INTERRUPTIBILITY | DECODE_GC_LIFETIMES))
366+
if(flags & (DECODE_GC_LIFETIMES))
366367
{
367368
if(m_NumSafePoints)
368369
{
369370
m_SafePointIndex = FindSafePoint(m_InstructionOffset);
370371
}
371-
else
372-
{
373-
m_SafePointIndex = 0;
374-
}
375372
}
376-
else if(flags & DECODE_FOR_RANGES_CALLBACK)
373+
else if(flags & (DECODE_FOR_RANGES_CALLBACK | DECODE_INTERRUPTIBILITY))
377374
{
378375
// Note that normalization as a code offset can be different than
379376
// normalization as code length

0 commit comments

Comments
 (0)