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

Rename CORINFO_FLG_CONTAINS_STACK_PTR to CORINFO_FLG_BYREF_LIKE #61907

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ std::string SpmiDumpHelper::DumpCorInfoFlag(CorInfoFlag flags)
AddFlag(CORINFO_FLG_CUSTOMLAYOUT);
AddFlag(CORINFO_FLG_CONTAINS_GC_PTR);
AddFlag(CORINFO_FLG_DELEGATE);
AddFlag(CORINFO_FLG_CONTAINS_STACK_PTR);
AddFlag(CORINFO_FLG_BYREF_LIKE);
AddFlag(CORINFO_FLG_VARIANCE);
AddFlag(CORINFO_FLG_BEFOREFIELDINIT);
AddFlag(CORINFO_FLG_GENERIC_TYPE_VARIABLE);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ enum CorInfoFlag
CORINFO_FLG_CONTAINS_GC_PTR = 0x01000000, // does the class contain a gc ptr ?
CORINFO_FLG_DELEGATE = 0x02000000, // is this a subclass of delegate or multicast delegate ?
// CORINFO_FLG_UNUSED = 0x04000000,
CORINFO_FLG_CONTAINS_STACK_PTR = 0x08000000, // This class has a stack pointer inside it
CORINFO_FLG_BYREF_LIKE = 0x08000000, // it is byref-like value type
CORINFO_FLG_VARIANCE = 0x10000000, // MethodTable::HasVariance (sealed does *not* mean uncast-able)
CORINFO_FLG_BEFOREFIELDINIT = 0x20000000, // Additional flexibility for when to run .cctor (see code:#ClassConstructionFlags)
CORINFO_FLG_GENERIC_TYPE_VARIABLE = 0x40000000, // This is really a handle for a variable type
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ var_types Compiler::impNormStructType(CORINFO_CLASS_HANDLE structHnd, CorInfoTyp
const DWORD structFlags = info.compCompHnd->getClassAttribs(structHnd);

// Don't bother if the struct contains GC references of byrefs, it can't be a SIMD type.
if ((structFlags & (CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_CONTAINS_STACK_PTR)) == 0)
if ((structFlags & (CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_BYREF_LIKE)) == 0)
{
unsigned originalSize = info.compCompHnd->getClassSize(structHnd);

Expand Down Expand Up @@ -5876,7 +5876,7 @@ bool Compiler::verIsByRefLike(const typeInfo& ti)
{
return false;
}
return info.compCompHnd->getClassAttribs(ti.GetClassHandleForValueClass()) & CORINFO_FLG_CONTAINS_STACK_PTR;
return info.compCompHnd->getClassAttribs(ti.GetClassHandleForValueClass()) & CORINFO_FLG_BYREF_LIKE;
}

bool Compiler::verIsSafeToReturnByRef(const typeInfo& ti)
Expand All @@ -5897,7 +5897,7 @@ bool Compiler::verIsBoxable(const typeInfo& ti)
|| ti.IsUnboxedGenericTypeVar() ||
(ti.IsType(TI_STRUCT) &&
// exclude byreflike structs
!(info.compCompHnd->getClassAttribs(ti.GetClassHandleForValueClass()) & CORINFO_FLG_CONTAINS_STACK_PTR)));
!(info.compCompHnd->getClassAttribs(ti.GetClassHandleForValueClass()) & CORINFO_FLG_BYREF_LIKE)));
}

// Is it a boxed value type?
Expand Down Expand Up @@ -14698,7 +14698,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
info.compCompHnd->getChildType(resolvedToken.hClass, &elemTypeHnd);
assert(!(elemTypeHnd == nullptr && corType == CORINFO_TYPE_VALUECLASS));
Verify(elemTypeHnd == nullptr ||
!(info.compCompHnd->getClassAttribs(elemTypeHnd) & CORINFO_FLG_CONTAINS_STACK_PTR),
!(info.compCompHnd->getClassAttribs(elemTypeHnd) & CORINFO_FLG_BYREF_LIKE),
"newarr of byref-like objects");
verVerifyCall(opcode, &resolvedToken, nullptr, ((prefixFlags & PREFIX_TAILCALL_EXPLICIT) != 0),
((prefixFlags & PREFIX_READONLY) != 0), delegateCreateStart, codeAddr - 1,
Expand Down Expand Up @@ -15816,7 +15816,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
CORINFO_CLASS_HANDLE elemTypeHnd;
info.compCompHnd->getChildType(resolvedToken.hClass, &elemTypeHnd);
Verify(elemTypeHnd == nullptr ||
!(info.compCompHnd->getClassAttribs(elemTypeHnd) & CORINFO_FLG_CONTAINS_STACK_PTR),
!(info.compCompHnd->getClassAttribs(elemTypeHnd) & CORINFO_FLG_BYREF_LIKE),
"array of byref-like type");
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void ClassLayout::InitializeGCPtrs(Compiler* compiler)
unsigned gcPtrCount = compiler->info.compCompHnd->getClassGClayout(m_classHandle, gcPtrs);

assert((gcPtrCount == 0) || ((compiler->info.compCompHnd->getClassAttribs(m_classHandle) &
(CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_CONTAINS_STACK_PTR)) != 0));
(CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_BYREF_LIKE)) != 0));

// Since class size is unsigned there's no way we could have more than 2^30 slots
// so it should be safe to fit this into a 30 bits bit field.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,9 +1835,9 @@ bool Compiler::StructPromotionHelper::CanPromoteStructType(CORINFO_CLASS_HANDLE
}

// If we saw any GC pointer or by-ref fields above then CORINFO_FLG_CONTAINS_GC_PTR or
// CORINFO_FLG_CONTAINS_STACK_PTR has to be set!
// CORINFO_FLG_BYREF_LIKE has to be set!
noway_assert((containsGCpointers == false) ||
((typeFlags & (CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_CONTAINS_STACK_PTR)) != 0));
((typeFlags & (CORINFO_FLG_CONTAINS_GC_PTR | CORINFO_FLG_BYREF_LIKE)) != 0));

// If we have "Custom Layout" then we might have an explicit Size attribute
// Managed C++ uses this for its structs, such C++ types will not contain GC pointers.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ private uint getClassAttribsInternal(TypeDesc type)
result |= CorInfoFlag.CORINFO_FLG_VALUECLASS;

if (metadataType.IsByRefLike)
result |= CorInfoFlag.CORINFO_FLG_CONTAINS_STACK_PTR;
result |= CorInfoFlag.CORINFO_FLG_BYREF_LIKE;

// The CLR has more complicated rules around CUSTOMLAYOUT, but this will do.
if (metadataType.IsExplicitLayout || (metadataType.IsSequentialLayout && metadataType.GetClassLayout().Size != 0) || metadataType.IsWellKnownType(WellKnownType.TypedReference))
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public enum CorInfoFlag : uint
CORINFO_FLG_CONTAINS_GC_PTR = 0x01000000, // does the class contain a gc ptr ?
CORINFO_FLG_DELEGATE = 0x02000000, // is this a subclass of delegate or multicast delegate ?
// CORINFO_FLG_UNUSED = 0x04000000,
CORINFO_FLG_CONTAINS_STACK_PTR = 0x08000000, // This class has a stack pointer inside it
CORINFO_FLG_BYREF_LIKE = 0x08000000, // it is byref-like value type
CORINFO_FLG_VARIANCE = 0x10000000, // MethodTable::HasVariance (sealed does *not* mean uncast-able)
CORINFO_FLG_BEFOREFIELDINIT = 0x20000000, // Additional flexibility for when to run .cctor (see code:#ClassConstructionFlags)
CORINFO_FLG_GENERIC_TYPE_VARIABLE = 0x40000000, // This is really a handle for a variable type
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3689,7 +3689,7 @@ uint32_t CEEInfo::getClassAttribsInternal (CORINFO_CLASS_HANDLE clsHnd)
ret |= CORINFO_FLG_VALUECLASS;

if (pMT->IsByRefLike())
ret |= CORINFO_FLG_CONTAINS_STACK_PTR;
ret |= CORINFO_FLG_BYREF_LIKE;

if ((pClass->IsNotTightlyPacked() && (!pClass->IsManagedSequential() || pClass->HasExplicitSize())) ||
pMT == g_TypedReferenceMT ||
Expand Down