diff --git a/src/coreclr/inc/gcinfotypes.h b/src/coreclr/inc/gcinfotypes.h index b60ef374adc942..ee46330119baed 100644 --- a/src/coreclr/inc/gcinfotypes.h +++ b/src/coreclr/inc/gcinfotypes.h @@ -59,7 +59,7 @@ inline UINT32 CeilOfLog2(size_t x) return (UINT32)result; #else // _MSC_VER // LZCNT returns index starting from MSB, whereas BSR gives the index from LSB. - // 63 ^ BSR here is equivalent to 63 - BSR since the BSR result is always between 0 and 63. + // 63 ^ LZCNT here is equivalent to 63 - LZCNT since the LZCNT result is always between 0 and 63. // This saves an instruction, as subtraction from constant requires either MOV/SUB or NEG/ADD. return (UINT32)63 ^ (UINT32)__builtin_clzl((unsigned long)x); #endif // _MSC_VER diff --git a/src/coreclr/vm/gcinfodecoder.cpp b/src/coreclr/vm/gcinfodecoder.cpp index 636c42c54d9ead..a03d96b1dd1661 100644 --- a/src/coreclr/vm/gcinfodecoder.cpp +++ b/src/coreclr/vm/gcinfodecoder.cpp @@ -350,6 +350,7 @@ GcInfoDecoder::GcInfoDecoder( #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED m_NumSafePoints = (UINT32) DENORMALIZE_NUM_SAFE_POINTS(m_Reader.DecodeVarLengthUnsigned(NUM_SAFE_POINTS_ENCBASE)); + m_SafePointIndex = m_NumSafePoints; #endif if (slimHeader) @@ -362,18 +363,14 @@ GcInfoDecoder::GcInfoDecoder( } #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED - if(flags & (DECODE_INTERRUPTIBILITY | DECODE_GC_LIFETIMES)) + if(flags & (DECODE_GC_LIFETIMES)) { if(m_NumSafePoints) { m_SafePointIndex = FindSafePoint(m_InstructionOffset); } - else - { - m_SafePointIndex = 0; - } } - else if(flags & DECODE_FOR_RANGES_CALLBACK) + else if(flags & (DECODE_FOR_RANGES_CALLBACK | DECODE_INTERRUPTIBILITY)) { // Note that normalization as a code offset can be different than // normalization as code length