Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup comments and ifdefs around this_OFFSET_FLAG #99092

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/coreclr/inc/gcinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 Windows x86:
jkotas marked this conversation as resolved.
Show resolved Hide resolved
// - 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

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8609,9 +8609,9 @@ 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 */

#if defined(JIT32_GCENCODER) && !defined(FEATURE_EH_FUNCLETS)
if (offs == emitSyncThisObjOffs)
{
desc->vpdVarNum |= this_OFFSET_FLAG;
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gcencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
Expand Down
Loading