Skip to content

[DRAFT] Write barrier without any RWX pages #114982

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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Apr 23, 2025

Add a new config switch DOTNET_UseGCWriteBarrierCopy to control whether or not to use a copy of the WriteBarrier code instead of assembly code embedded in the coreclr binary. Typically we do this to improve performance, but this change enables a new path where we just have the barrier as assembly code in the coreclr binary. Also, with this change, the 1 copy of the code which is used for this scenario is shared between NativeAOT and coreclr.

DRAFT Because...

  • The DOTNET_UseGCWriteBarrierCopy flag is set to 0 by default now, but when this is checked in it should be set to 1
  • Linux-X86 builds are broken
  • Other builds are probably broken (WinX64 and WinArm64 are known to build)
  • Testing of scenarios like GC shadow has not been done
  • Testing of general GC behavior has not been done
  • Functional correctness has not been tested (WinX64 is known to not crash on helloworld)

Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@@ -179,6 +179,10 @@ GLOBAL_LABEL RhpCheckedAssignRefAVLocation
LEAF_END RhpCheckedAssignRef\EXPORT_REG_NAME, _TEXT
.endm

LEAF_ENTRY RhpWriteBarriers, _TEXT
Copy link
Member

Choose a reason for hiding this comment

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

FWIW this would not work anyway... we compile all code on Apple platforms as .subsections_via_symbols and the Apple linker is free to reorder the functions (or discard unused ones if told to). Compiling without subsections_via_symbols is not an option due to various bugs in different linker versions. The only other option to keep the desired order is to mark the successive symbols as .alt_entry, which also happens to run into linker bugs if not done extremely carefully...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants