Skip to content

Conversation

tlively
Copy link
Member

@tlively tlively commented Jul 12, 2024

Implement ref.i31_shared the new instruction for creating references
to shared i31s. Implement binary and text parsing and emitting as well
as interpretation. Copy the upstream spec test for i31 and modify it so
that all the heap types are shared. Comment out some parts that we do
not yet support.

@tlively tlively requested a review from kripken July 12, 2024 00:33
@tlively
Copy link
Member Author

tlively commented Jul 12, 2024

The test failures here and in #6736 will be resolved by #6737.

src/wasm.h Outdated
RefI31() = default;
RefI31(MixedArena& allocator) {}

Shareability share;
Copy link
Member

Choose a reason for hiding this comment

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

Can this not be part of the type? We don't seem to have such a field on anything else.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I guess it could.

Copy link
Member Author

Choose a reason for hiding this comment

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

See the last commmit for this change.

tlively added 2 commits July 12, 2024 10:04
Implement `ref.i31_shared` the new instruction for creating references to shared i31s. Implement binary and text parsing and emitting as well as interpretation. Copy the upstream spec test for i31 and modify it so that all the heap types are shared. Comment out some parts that we do not yet support.
@tlively tlively force-pushed the threads-shared-i31 branch from 6fadc97 to f05017d Compare July 12, 2024 17:23
void visitRefI31(RefI31* curr) { printMedium(o, "ref.i31"); }
void visitRefI31(RefI31* curr) {
printMedium(
o, curr->type.getHeapType().isShared() ? "ref.i31_shared" : "ref.i31");
Copy link
Member

Choose a reason for hiding this comment

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

I think you may need to guard here against curr->type being unreachable (when the i32 child is unreachable), in which case getHeapType errors.

@tlively tlively merged commit eda6530 into main Jul 12, 2024
@tlively tlively deleted the threads-shared-i31 branch July 12, 2024 20:48
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants