Skip to content

[wasm-ctor-eval] Avoid local and global state getting out of sync#8776

Open
kripken wants to merge 8 commits into
WebAssembly:mainfrom
kripken:ctor.partial.local
Open

[wasm-ctor-eval] Avoid local and global state getting out of sync#8776
kripken wants to merge 8 commits into
WebAssembly:mainfrom
kripken:ctor.partial.local

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented May 26, 2026

Simplify this by clearing before any serialization. Before, if we partially
evalled, the local and global state could diverge, leading to locals
referring to the wrong globals.

Changes to the existing test are NFC, just reordering of names (sadly).

@kripken kripken requested a review from a team as a code owner May 26, 2026 19:10
@kripken kripken requested review from tlively and removed request for a team May 26, 2026 19:10
Comment on lines +535 to +537
// information into the module. This must be done before we start to serialize
// content. After this, serialization can happen, and after that, a call to
// applyToModule() can be done.
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.

Can you explain more why "this must be done before we start to serialize content?"


// We are about to serialize content (the code paths below call
// getSerialization). Clear the state.
interface.clearApplyState();
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.

Can we make it so getSerialization automatically calls this as necessary?

Comment on lines +31 to +33
(drop
(global.get $gimport)
)
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.

Is it expected that this global.get is absent in the output?

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