Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

array_init_elem on dropped element segment #577

Answered by rossberg
CharlieTap asked this question in Q&A
Discussion options

You must be logged in to vote

Semantically, dropping a segment shrinks its size to zero, so a zero-length bulk op at offset 0 still succeeds (modulo null references). In this case, see the execution rule, steps 20-21.

This behaviour is inherited from prior bulk ops like table.init and memory.init, though I cannot find corresponding tests for those with a quick search.

The original motivation for this semantics is that the drop check becomes subsumed by the bounds check this way, so that an extra runtime check is avoided. This PR links to some of the history of bulk op boundary conditions.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CharlieTap
Comment options

Answer selected by CharlieTap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants