Skip to content

[StackSwitching] Error properly on an unhandled resume during start - #8787

Merged
kripken merged 7 commits into
WebAssembly:mainfrom
kripken:cont.start.unhandle
May 28, 2026
Merged

[StackSwitching] Error properly on an unhandled resume during start#8787
kripken merged 7 commits into
WebAssembly:mainfrom
kripken:cont.start.unhandle

Conversation

@kripken

@kripken kripken commented May 28, 2026

Copy link
Copy Markdown
Member

Before, we asserted on stale state.

Fix the auto-updater script to not crash on such output (an exec
line before any function). That happens to improve one existing
test output.

@kripken
kripken requested a review from tlively May 28, 2026 16:39
@kripken
kripken requested a review from a team as a code owner May 28, 2026 16:39
Comment thread scripts/update_lit_checks.py Outdated
Comment on lines +199 to +202
# Early output before any export was executed. Associate it with
# the start function if we can find it, otherwise the first named
# item as a fallback.
start_item = next((item for item in named_items if item[0] == 'start'), None)

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.

Output lines cannot be reordered like this in general; filecheck won't know to skip around as it compares the actual output to the expectations.

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.

Can you explain the issue more? I'm not sure what the actual symptom is of the problem you describe. I verified the following:

  1. Auto-update changes nothing but what is in this PR.
  2. Lit tests pass.
  3. The interesting lit tests modified here both fail if I manually modify the new CHECK line.

And I'm not sure what else I can verify here 😄

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.

A test where this logic reorders the start function checks after the checks for some previous exported function should demonstrate the problem.

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.

Now I see, thanks. Ok, I removed the part attaching to start. Now it always attaches at the very front.

Comment thread scripts/update_lit_checks.py Outdated
# the first named item, so it appears before everything else
# (which is when it executes).
if named_items:
items.append((named_items[0], [line]))

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.

Passing in all of the items just to get the first one seems overly complicated. Can we either use None as the sentinel for output not tied to an item or just pass in the first named item?

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.

Refactored to pass in the first named item.

Comment thread scripts/update_lit_checks.py Outdated
if named_items:
items.append((named_items[0], [line]))
else:
items.append((('module', 'trap'), [line]))

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.

Or if this works, maybe we can just unconditionally do this? (Although using a separate sentinel like None to avoid the risk of collisions seems nicer.)

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.

This doens't work, but the opposite does. I made it unconditionally use the first named item.

@kripken
kripken merged commit ab2d66c into WebAssembly:main May 28, 2026
16 checks passed
@kripken
kripken deleted the cont.start.unhandle branch May 28, 2026 20:50
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