Skip to content

Initial support for publish - #9072

Open
tlively wants to merge 2 commits into
mainfrom
publish
Open

Initial support for publish#9072
tlively wants to merge 2 commits into
mainfrom
publish

Conversation

@tlively

@tlively tlively commented Sep 3, 2026

Copy link
Copy Markdown
Member

As proposed in WebAssembly/shared-everything-threads#119. Add parsing, printing, and validation. The optimization passes will not yet preserve the semantics of publish instructions in general; a future change will have to augment EffectAnalyzer to model its effects correctly.

As proposed in WebAssembly/shared-everything-threads#119. Add parsing, printing, and validation. The optimization passes will not yet preserve the semantics of publish instructions in general; a future change will have to augment EffectAnalyzer to model its effects correctly.
@tlively
tlively requested a review from a team as a code owner September 3, 2026 05:52
@tlively
tlively requested review from kripken and removed request for a team September 3, 2026 05:52
Comment thread src/ir/effects.h Outdated
// (local.set $p (publish (local.get $s)))
// (local.set $x (local.get $s))
// `SimplifyLocals` could sink `publish` past `local.set $x`, moving
// the write of `$s` to `$x` before `publish`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait, I'm not following. The write of s to x is fine, isn't it? Isn't the danger only writes to the heap object a local refers to?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Possibly. I was thinking about this this morning and I'm actually not sure how this should work with respect to aliasing in locals. It's a question for Conrad, probably.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, no, thinking about this more, writes to locals are definitely not a problem. The chain of address dependencies, data dependencies, and happens-before edges leading up to a read on another thread must start with a write of the published object that happens after the publish, not with the publish itself. So it's ok if that write after the publish has no data dependency on the publish, which means it's fine to move local.set of the published object before the publish.

I'll update the comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants