Skip to content

[spec] Normative: Remove ahead of time bounds checks from instantiation - #820

Closed
conrad-watt wants to merge 2 commits into
WebAssembly:masterfrom
conrad-watt:instantiation-no-aot-bounds
Closed

conrad-watt wants to merge 2 commits into
WebAssembly:masterfrom
conrad-watt:instantiation-no-aot-bounds

Conversation

@conrad-watt

@conrad-watt conrad-watt commented Jun 9, 2018 •

Copy link
Copy Markdown
Contributor

See WebAssembly/threads#94 for background. The current specification does not extend neatly to the multi-threaded case.

This PR corresponds to potential solution 2, which received a broadly positive initial response, and would allow data initialisers to be used with shared memories.

I choose to make the per-initialiser bounds checks result in a Trap/RuntimeError rather than a Fail/LinkError, since this makes the behaviour indistinguishable from using bulk memory operations in the start function, and I believe users might expect LinkError to guarantee no side effects have taken place.

@rossberg rossberg left a comment

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.

Looks good to me, but I think we need approval from the CG before we can land it. Maybe put it on the agenda of one of the next meeting?

Comment thread document/core/exec/modules.rst Outdated
@@ -613,10 +613,6 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep

h. Let :math:`\X{eend}_i` be :math:`\X{eo}_i` plus the length of :math:`\elem_i.\EINIT`.

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.

Nit: Maybe move this down to where it is actually used first now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread document/core/exec/modules.rst Outdated
@@ -635,17 +631,17 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep

h. Let :math:`\X{dend}_i` be :math:`\X{do}_i` plus the length of :math:`\data_i.\DINIT`.

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.

Same here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@conrad-watt

Copy link
Copy Markdown
Contributor Author

12th is probably too soon, so maybe the meeting on the 26th?

@rossberg

Copy link
Copy Markdown
Member

Sounds good. I won't be able to attend the 12th anyway.

@binji

binji commented Jun 11, 2018

Copy link
Copy Markdown
Member

Added future meeting item here

@conrad-watt

Copy link
Copy Markdown
Contributor Author

I'll keep this open until at least the next CG, but it seems the consensus from this week's meeting was that we should go with this solution, but bundle it with the bulk memory proposal.

@AndrewScheidecker

Copy link
Copy Markdown
Contributor

Is it practical to further relax this to do the bounds check for each byte/element copied?

As noted in the original issue, an extension that adds shrinking memories/tables or page protection makes it impractical to ensure the copy will be all-or-nothing.

@conrad-watt

Copy link
Copy Markdown
Contributor Author

After @jfbastien pointed this out, we concluded in WebAssembly/threads#96 that we would need to do basically as you propose. The current idea is that segment initialization and bulk operations will (observably) perform writes from low to high addresses in order at byte/element granularity until oob. I think this still needs to be fleshed out in the proposal repo, however.

@binji

binji commented Apr 9, 2019

Copy link
Copy Markdown
Member

Closing, as this behavior is moved to the bulk memory proposal.

@binji binji closed this Apr 9, 2019
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