Skip to content

Commit

Permalink
Fix AllocateRegularStaticBox for FOH (#81857)
Browse files Browse the repository at this point in the history
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
  • Loading branch information
EgorBo and SingleAccretion authored Feb 9, 2023
1 parent d067431 commit 7f73d0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/jit/morphblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ GenTree* MorphInitBlockHelper::MorphCommaBlock(Compiler* comp, GenTreeOp* firstC

GenTree* effectiveVal = lastComma->gtGetOp2();

if (!effectiveVal->OperIsIndir() && !effectiveVal->IsLocal())
{
return firstComma;
}

assert(effectiveVal == firstComma->gtEffectiveVal());

GenTree* effectiveValAddr = comp->gtNewOperNode(GT_ADDR, TYP_BYREF, effectiveVal);
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/frozenobjectheap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ Object* FrozenObjectHeapManager::TryAllocateObject(PTR_MethodTable type, size_t
_ASSERT(FOH_COMMIT_SIZE >= MIN_OBJECT_SIZE);

#ifdef FEATURE_64BIT_ALIGNMENT
_ASSERT(!type->RequiresAlign8());
if (type->RequiresAlign8())
{
// Align8 objects are not supported yet
return nullptr;
}
#endif

// NOTE: objectSize is expected be the full size including header
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/vm/methodtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3531,7 +3531,8 @@ void MethodTable::AllocateRegularStaticBox(FieldDesc* pField, Object** boxedStat
if (VolatileLoad(boxedStaticHandle) == nullptr)
{
LOG((LF_CLASSLOADER, LL_INFO10000, "\tInstantiating static of type %s\n", pFieldMT->GetDebugClassName()));
OBJECTREF obj = AllocateStaticBox(pFieldMT, hasFixedAddr, NULL, false);
const bool canBeFrozen = !pFieldMT->ContainsPointers() && !Collectible();
OBJECTREF obj = AllocateStaticBox(pFieldMT, hasFixedAddr, NULL, canBeFrozen);
SetObjectReference((OBJECTREF*)(boxedStaticHandle), obj);
}
}
Expand Down

0 comments on commit 7f73d0c

Please sign in to comment.