diff --git a/src/coreclr/inc/gcinfo.h b/src/coreclr/inc/gcinfo.h index 66933b10f0445..2a6ba1914f0b3 100644 --- a/src/coreclr/inc/gcinfo.h +++ b/src/coreclr/inc/gcinfo.h @@ -15,22 +15,21 @@ #include "daccess.h" #include "windef.h" // For BYTE -// Some declarations in this file are used on non-x86 platforms, but most are x86-specific. - // Use the lower 2 bits of the offsets stored in the tables // to encode properties const unsigned OFFSET_MASK = 0x3; // mask to access the low 2 bits // -// Note for untracked locals the flags allowed are "pinned" and "byref" -// and for tracked locals the flags allowed are "this" and "byref" // Note that these definitions should also match the definitions of // GC_CALL_INTERIOR and GC_CALL_PINNED in VM/gc.h // const unsigned byref_OFFSET_FLAG = 0x1; // the offset is an interior ptr const unsigned pinned_OFFSET_FLAG = 0x2; // the offset is a pinned ptr -#if !defined(TARGET_X86) || !defined(FEATURE_EH_FUNCLETS) +#if defined(TARGET_X86) && !defined(FEATURE_EH_FUNCLETS) +// JIT32_ENCODER has additional restriction on x86 without funclets: +// - for untracked locals the flags allowed are "pinned" and "byref" +// - for tracked locals the flags allowed are "this" and "byref" const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this" #endif diff --git a/src/coreclr/jit/emit.cpp b/src/coreclr/jit/emit.cpp index ecbfe659be103..bb323584467e5 100644 --- a/src/coreclr/jit/emit.cpp +++ b/src/coreclr/jit/emit.cpp @@ -8609,9 +8609,10 @@ void emitter::emitGCvarLiveSet(int offs, GCtype gcType, BYTE* addr, ssize_t disp desc->vpdNext = nullptr; -#if !defined(JIT32_GCENCODER) || !defined(FEATURE_EH_FUNCLETS) /* the lower 2 bits encode props about the stk ptr */ + CLANG_FORMAT_COMMENT_ANCHOR; +#if defined(JIT32_GCENCODER) && !defined(FEATURE_EH_FUNCLETS) if (offs == emitSyncThisObjOffs) { desc->vpdVarNum |= this_OFFSET_FLAG; diff --git a/src/coreclr/jit/gcencode.cpp b/src/coreclr/jit/gcencode.cpp index 96005e6057662..22382c317ed87 100644 --- a/src/coreclr/jit/gcencode.cpp +++ b/src/coreclr/jit/gcencode.cpp @@ -4698,7 +4698,7 @@ void GCInfo::gcMakeVarPtrTable(GcInfoEncoder* gcInfoEncoder, MakeRegPtrMode mode // unused by alignment C_ASSERT((OFFSET_MASK + 1) <= sizeof(int)); -#ifdef DEBUG +#if defined(DEBUG) && defined(JIT32_GCENCODER) && !defined(FEATURE_EH_FUNCLETS) if (mode == MAKE_REG_PTR_MODE_ASSIGN_SLOTS) { // Tracked variables can't be pinned, and the encoding takes @@ -4712,7 +4712,7 @@ void GCInfo::gcMakeVarPtrTable(GcInfoEncoder* gcInfoEncoder, MakeRegPtrMode mode assert((flags & this_OFFSET_FLAG) == 0); } } -#endif // DEBUG +#endif // Only need to do this once, and only if we have EH. if ((mode == MAKE_REG_PTR_MODE_ASSIGN_SLOTS) && compiler->ehAnyFunclets())