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

Fold WTF-8 policy into instructions #46

Merged
merged 3 commits into from
Sep 12, 2022
Merged

Fold WTF-8 policy into instructions #46

merged 3 commits into from
Sep 12, 2022

Conversation

wingo
Copy link
Collaborator

@wingo wingo commented Sep 12, 2022

Instead of having e.g. string.encode_wtf8 taking a policy immediate, just make a separate instruction for each policy. Fixes #35.

Instead of having e.g. `string.encode_wtf8` taking a policy immediate,
just make a separate instruction for each policy.  Fixes #35.
Copy link
Collaborator

@jakobkummerow jakobkummerow left a comment

Choose a reason for hiding this comment

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

No strong feelings either way on the overall concept.

I do notice that part of the motivation given in #35 is outdated: there's a rather concrete plan to refactor ref.as_data and friends to take a heap type immediate instead of being a whole family of instructions, which is a change in the opposite direction. That said, the same set of reasonings doesn't necessarily apply to both sets of instructions, and I don't think it's important enough to argue about.

As a minor nit, I think we could keep the encoding space a bit less fragmented: we have existing gaps, e.g. 0x94..0x97 and 0xb4..0xbf, that we could fill up before starting several new blocks (0xc0, 0xd0, 0xe0). Doesn't matter much as we'll clean up instruction encodings before finalizing the proposal anyway, so whatever you find convenient is fine.

@wingo wingo merged commit a64917c into main Sep 12, 2022
@wingo wingo deleted the inline-policy branch September 12, 2022 14:47
pull bot pushed a commit to jamlee-t/v8 that referenced this pull request Sep 13, 2022
Instead of having e.g. `string.new_wtf8` that takes an immediate
specifying the particular UTF-8 flavor to parse, make one instruction
per flavor.

See WebAssembly/stringref#46.

Bug: v8:12868
Change-Id: I2e9f2735c557b2352b6e75314037e473710d87a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3892695
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Andy Wingo <wingo@igalia.com>
Cr-Commit-Position: refs/heads/main@{#83170}
vouillon added a commit to vouillon/binaryen that referenced this pull request May 10, 2023
And rename StringNewReplaceArray to StringNewLossyUTF8Array.

Following changes to the stringref proposals (WebAssembly/stringref#46)
vouillon added a commit to vouillon/binaryen that referenced this pull request May 10, 2023
vouillon added a commit to vouillon/binaryen that referenced this pull request May 10, 2023
vouillon added a commit to vouillon/binaryen that referenced this pull request May 10, 2023
And rename StringNewReplaceArray to StringNewLossyUTF8Array.

Following changes to the stringref proposals (WebAssembly/stringref#46)
vouillon added a commit to vouillon/binaryen that referenced this pull request May 10, 2023
kripken pushed a commit to WebAssembly/binaryen that referenced this pull request May 12, 2023
See WebAssembly/stringref#46.

This format is already adopted by V8: https://chromium-review.googlesource.com/c/v8/v8/+/3892695.
The text format is left unchanged (see #5607 for a discussion on the subject).

I have also added support for string.encode_lossy_utf8 and
string.encode_lossy_utf8 array (by allowing the replace policy for
Binaryen's string.encode_wtf8 instruction).
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
See WebAssembly/stringref#46.

This format is already adopted by V8: https://chromium-review.googlesource.com/c/v8/v8/+/3892695.
The text format is left unchanged (see WebAssembly#5607 for a discussion on the subject).

I have also added support for string.encode_lossy_utf8 and
string.encode_lossy_utf8 array (by allowing the replace policy for
Binaryen's string.encode_wtf8 instruction).
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.

Policy immediates
2 participants