Skip to content

[mono][interp] Add missing intrinsic for Volatile.ReadBarrier/WriteBarrier - #124538

Merged
BrzVlad merged 1 commit into
dotnet:mainfrom
BrzVlad:fix-interp-barrier
Feb 18, 2026
Merged

BrzVlad merged 1 commit into
dotnet:mainfrom
BrzVlad:fix-interp-barrier

Conversation

@BrzVlad

@BrzVlad BrzVlad commented Feb 18, 2026

Copy link
Copy Markdown
Member

For simplicity, this just adds full memory barriers. Previously, calling this code would lead to stack overflow due to recursively calling itself.

…rrier

For simplicity, this just adds full memory barriers. Previously, calling this code would lead to stack overflow due to recursively calling itself.
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @vitek-karas, @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Mono’s interpreter intrinsic handling to recognize System.Threading.Volatile.ReadBarrier and System.Threading.Volatile.WriteBarrier, preventing infinite recursion/stack overflow when these [Intrinsic] stub methods are executed under the interpreter.

Changes:

  • Add interpreter intrinsic mapping for Volatile.ReadBarrier() and Volatile.WriteBarrier().
  • Implement the intrinsic by emitting an existing interpreter memory-barrier opcode.

Comment thread src/mono/mono/mini/interp/transform.c
@BrzVlad
BrzVlad merged commit d29eec6 into dotnet:main Feb 18, 2026
80 of 82 checks passed
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
…rrier (dotnet#124538)

For simplicity, this just adds full memory barriers. Previously, calling
this code would lead to stack overflow due to recursively calling
itself.
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 21, 2026
@vitek-karas

Copy link
Copy Markdown
Member

@BrzVlad Should we consider backporting this to 10 given this feedback: #130265

@BrzVlad

BrzVlad commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/backport to release/10.0

@github-actions github-actions Bot unlocked this conversation Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (link to workflow run)

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants