Skip to content

Commit 9863bf1

Browse files
authored
Cleanup comments and ifdefs around this_OFFSET_FLAG (#99092)
Contributes to #35748 (comment)
1 parent 8806af9 commit 9863bf1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/coreclr/inc/gcinfo.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@
1515
#include "daccess.h"
1616
#include "windef.h" // For BYTE
1717

18-
// Some declarations in this file are used on non-x86 platforms, but most are x86-specific.
19-
2018
// Use the lower 2 bits of the offsets stored in the tables
2119
// to encode properties
2220

2321
const unsigned OFFSET_MASK = 0x3; // mask to access the low 2 bits
2422

2523
//
26-
// Note for untracked locals the flags allowed are "pinned" and "byref"
27-
// and for tracked locals the flags allowed are "this" and "byref"
2824
// Note that these definitions should also match the definitions of
2925
// GC_CALL_INTERIOR and GC_CALL_PINNED in VM/gc.h
3026
//
3127
const unsigned byref_OFFSET_FLAG = 0x1; // the offset is an interior ptr
3228
const unsigned pinned_OFFSET_FLAG = 0x2; // the offset is a pinned ptr
33-
#if !defined(TARGET_X86) || !defined(FEATURE_EH_FUNCLETS)
29+
#if defined(TARGET_X86) && !defined(FEATURE_EH_FUNCLETS)
30+
// JIT32_ENCODER has additional restriction on x86 without funclets:
31+
// - for untracked locals the flags allowed are "pinned" and "byref"
32+
// - for tracked locals the flags allowed are "this" and "byref"
3433
const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this"
3534
#endif
3635

src/coreclr/jit/emit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8609,9 +8609,10 @@ void emitter::emitGCvarLiveSet(int offs, GCtype gcType, BYTE* addr, ssize_t disp
86098609

86108610
desc->vpdNext = nullptr;
86118611

8612-
#if !defined(JIT32_GCENCODER) || !defined(FEATURE_EH_FUNCLETS)
86138612
/* the lower 2 bits encode props about the stk ptr */
8613+
CLANG_FORMAT_COMMENT_ANCHOR;
86148614

8615+
#if defined(JIT32_GCENCODER) && !defined(FEATURE_EH_FUNCLETS)
86158616
if (offs == emitSyncThisObjOffs)
86168617
{
86178618
desc->vpdVarNum |= this_OFFSET_FLAG;

src/coreclr/jit/gcencode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,7 +4698,7 @@ void GCInfo::gcMakeVarPtrTable(GcInfoEncoder* gcInfoEncoder, MakeRegPtrMode mode
46984698
// unused by alignment
46994699
C_ASSERT((OFFSET_MASK + 1) <= sizeof(int));
47004700

4701-
#ifdef DEBUG
4701+
#if defined(DEBUG) && defined(JIT32_GCENCODER) && !defined(FEATURE_EH_FUNCLETS)
47024702
if (mode == MAKE_REG_PTR_MODE_ASSIGN_SLOTS)
47034703
{
47044704
// Tracked variables can't be pinned, and the encoding takes
@@ -4712,7 +4712,7 @@ void GCInfo::gcMakeVarPtrTable(GcInfoEncoder* gcInfoEncoder, MakeRegPtrMode mode
47124712
assert((flags & this_OFFSET_FLAG) == 0);
47134713
}
47144714
}
4715-
#endif // DEBUG
4715+
#endif
47164716

47174717
// Only need to do this once, and only if we have EH.
47184718
if ((mode == MAKE_REG_PTR_MODE_ASSIGN_SLOTS) && compiler->ehAnyFunclets())

0 commit comments

Comments
 (0)