Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from
Closed

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

wants to merge 2 commits into from

Conversation

conrad-watt
Copy link
Contributor

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

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.

Copy link
Member

@rossberg rossberg left a comment

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?

@@ -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
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
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -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
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
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
Contributor Author

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

@rossberg
Copy link
Member

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

@binji
Copy link
Member

binji commented Jun 11, 2018

Added future meeting item here

@conrad-watt
Copy link
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
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
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
Copy link
Member

binji commented Apr 9, 2019

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