Skip to content

Conversation

@RReverser
Copy link
Collaborator

I noticed that acorn-optimizer transforms for ASan, SAFE_HEAP and GROWABLE_HEAP didn't cover the 64-bit integer support enabled by WASM_BIGINT (HEAP64 and HEAPU64 memory views).

This PR adds demos of failing transforms in one commit, and actual support in the next one so that it's easier to see the diff between incorrectly generated code and the fixed one.

I've only tested on these snapshots for now, so waiting for CI to see if I missed any other tests that need to be updated.

@RReverser RReverser requested review from kripken and sbc100 May 8, 2025 00:43
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for working on this!

I'll wait for @kripken to approve but lgtm.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Thanks!


HeAp[x];

// but not this
Copy link
Member

Choose a reason for hiding this comment

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

Please move this comment in the test so it is before the code, which should make it remain in the right place, I hope.

@RReverser RReverser enabled auto-merge (squash) May 8, 2025 18:51
@RReverser RReverser merged commit 45e60d8 into emscripten-core:main May 8, 2025
28 checks passed
@RReverser RReverser deleted the transform-heap64 branch May 8, 2025 20:16
RReverser added a commit to RReverser/emscripten that referenced this pull request May 9, 2025
This streamlines the `SAFE_HEAP` transform in acorn-optimizer. I was going
to send this as a separate cleanup PR as part of my other work on
acorn-optimizer, but it happens to also be the easy fix for a regression
mentioned in emscripten-core#24289
and caused by emscripten-core#24283
which added support for 64-bit integers to acorn-optimizer passes.

I could fix that issue separately by tweaking `unSign`, but this way we
don't need to bother - the values with correct sign are now
automatically retrieved by accessing the correct `HEAP*` array.

I've added a regression test for the linked issue as well, which
fails before this PR and passes after.
RReverser added a commit to RReverser/emscripten that referenced this pull request May 9, 2025
This streamlines the `SAFE_HEAP` transform in acorn-optimizer. I was going
to send this as a separate cleanup PR as part of my other work on
acorn-optimizer, but it happens to also be the easy fix for a regression
mentioned in emscripten-core#24289
and caused by emscripten-core#24283
which added support for 64-bit integers to acorn-optimizer passes.

I could fix that issue separately by tweaking `unSign`, but this way we
don't need to bother - the values with correct sign are now
automatically retrieved by accessing the correct `HEAP*` array.

I've added a regression test for the linked issue as well, which
fails before this PR and passes after.
@brendandahl
Copy link
Collaborator

This has caused test/runner core2s.test_embind_i64_val to fail on the rollers. Does the simplify PR linked above fix that?

@RReverser
Copy link
Collaborator Author

Yes, that's the failure it refers to in the PR description.

RReverser added a commit that referenced this pull request May 13, 2025
This streamlines the `SAFE_HEAP` transform in acorn-optimizer. I was
going to send this as a separate cleanup PR as part of my other work on
acorn-optimizer, but it happens to also be the easy fix for a regression
mentioned in #24289
and caused by #24283
which added support for 64-bit integers to acorn-optimizer passes.

I could fix that issue separately by tweaking `unSign`, but this way we
don't need to bother - the values with correct sign are now
automatically retrieved by accessing the correct `HEAP*` array.

I've added a regression test for the linked issue as well, which fails
before this PR and passes after.
juj pushed a commit that referenced this pull request Sep 10, 2025
This PR fixes issues with big endian support introduced in the following
PRs:
- #24295 - The change did not consider the `littleEndianHeap` transform
implications,
- #24283 - The new LE_HEAP* functions were not added to link.py, causing
runtime failure on BE system.

The `littleEndianHeap` transform code is simplified and updated to
detect the code introduced by `growableHeap` pass.
A new test was added to verify the combined transformation generates
working code.
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.

4 participants