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

JIT: Don't use write barriers for frozen objects #76135

Merged
merged 1 commit into from
Sep 26, 2022
Merged
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
6 changes: 6 additions & 0 deletions src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTreeStoreInd* stor
return WBF_NoBarrier;
}

if (store->Data()->IsIconHandle(GTF_ICON_OBJ_HDL))
Copy link
Member

@VSadov VSadov Sep 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not an expert in GTF_ things, but I assume this condition will not hold if an object was allocated on POH.

For POH objects we need to run the barrier, if POH literals can get collected.
(do we have collectible literals?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, this flag is only used for these:

  1. string literals (only in non-collectible contexts)
  2. RuntimeType (only in non-collectible contexts)

and only for FOH, we don't special case POH

{
// Ignore frozen objects
return WBF_NoBarrier;
}

WriteBarrierForm wbf = gcWriteBarrierFormFromTargetAddress(store->Addr());

if (wbf == WBF_BarrierUnknown)
Expand Down