Skip to content

Process passive element segments in compiled code#13444

Merged
cfallin merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:refactor-passive-element-segments
May 21, 2026
Merged

Process passive element segments in compiled code#13444
cfallin merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:refactor-passive-element-segments

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit is targeted at implementing the bulk of the table.init, array.init_elem, and array.new_elem instructions in compiled wasm code. This means that these instructions can also more naturally insert fuel/epoch checks described in #13387.

Support in this commit is heavily built on previous refactorings where the goal here is to a new kind of entity, an element segment, and then just fill out all the various places that match is needed. The main refactoring needed to support this is that the element size of the src/dst of a copy can now differ. This is because element segments have a 16-byte element size (ValRaw's size), but tables and arrays have a different size of each element.

Closes #13258

This commit is targeted at implementing the bulk of the `table.init`,
`array.init_elem`, and `array.new_elem` instructions in compiled wasm
code. This means that these instructions can also more naturally insert
fuel/epoch checks described in bytecodealliance#13387.

Support in this commit is heavily built on previous refactorings where
the goal here is to a new kind of entity, an element segment, and then
just fill out all the various places that `match` is needed. The main
refactoring needed to support this is that the element size of the
src/dst of a copy can now differ. This is because element segments have
a 16-byte element size (`ValRaw`'s size), but tables and arrays have a
different size of each element.

Closes bytecodealliance#13258
Copy link
Copy Markdown
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

LGTM!

@cfallin cfallin added this pull request to the merge queue May 21, 2026
Merged via the queue into bytecodealliance:main with commit aed0abc May 21, 2026
51 checks passed
@alexcrichton alexcrichton deleted the refactor-passive-element-segments branch May 22, 2026 06:04
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.

<Performance> fuzzbug: table.init has a very slow non-empty path in a minimal repeated microbenchmark

2 participants