Skip to content

JIT: capture all write barrier helper addresses for SPMI #97535

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

Merged
merged 2 commits into from
Jan 26, 2024
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
15 changes: 15 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,8 @@ void CodeGen::genGenerateCode(void** codePtr, uint32_t* nativeSizeOfCode)
printf("*************** In genGenerateCode()\n");
compiler->fgDispBasicBlocks(compiler->verboseTrees);
}

genWriteBarrierUsed = false;
#endif

this->codePtr = codePtr;
Expand All @@ -1696,6 +1698,17 @@ void CodeGen::genGenerateCode(void** codePtr, uint32_t* nativeSizeOfCode)
DoPhase(this, PHASE_GENERATE_CODE, &CodeGen::genGenerateMachineCode);
DoPhase(this, PHASE_EMIT_CODE, &CodeGen::genEmitMachineCode);
DoPhase(this, PHASE_EMIT_GCEH, &CodeGen::genEmitUnwindDebugGCandEH);

#ifdef DEBUG
if (genWriteBarrierUsed && JitConfig.EnableExtraSuperPmiQueries())
{
void* ignored;
for (int i = CORINFO_HELP_ASSIGN_REF; i <= CORINFO_HELP_ASSIGN_STRUCT; i++)
{
compiler->compGetHelperFtn((CorInfoHelpFunc)i, &ignored);
}
}
#endif
}

//----------------------------------------------------------------------
Expand Down Expand Up @@ -2693,6 +2706,8 @@ bool CodeGenInterface::genUseOptimizedWriteBarriers(GenTreeStoreInd* store)
//
CorInfoHelpFunc CodeGenInterface::genWriteBarrierHelperForWriteBarrierForm(GCInfo::WriteBarrierForm wbf)
{
INDEBUG(genWriteBarrierUsed = true);

switch (wbf)
{
case GCInfo::WBF_BarrierChecked:
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/codegeninterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ class CodeGenInterface
bool genUseOptimizedWriteBarriers(GenTreeStoreInd* store);
CorInfoHelpFunc genWriteBarrierHelperForWriteBarrierForm(GCInfo::WriteBarrierForm wbf);

#ifdef DEBUG
bool genWriteBarrierUsed;
#endif

// The following property indicates whether the current method sets up
// an explicit stack frame or not.
private:
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTreeStoreInd* stor
}

// Ignore any assignments of NULL.
GenTree* data = store->Data()->gtSkipReloadOrCopy();
GenTree* const data = store->Data()->gtSkipReloadOrCopy();
if ((data->GetVN(VNK_Liberal) == ValueNumStore::VNForNull()) || data->IsIntegralConst(0))
{
return WBF_NoBarrier;
}

if ((store->gtFlags & GTF_IND_TGT_NOT_HEAP) != 0)
{
// This indirection is not from to the heap.
// This indirection is not storing to the heap.
// This case occurs for stack-allocated objects.
return WBF_NoBarrier;
}
Expand Down