-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
threads: add polymorphism over
shared
Certain instructions accept both shared and unshared references: `ref.eq`, `i31.get_s`, `i31.get_u`, `array.len`, `any.convert_extern`, and `extern.convert_any`. Validation needs to handle these special cases to pass Binaryen's `polymorphism.wast` test. This change refactors the `pop_operand` family of functions with several helpers to add `pop_maybe_shared_ref`; `pop_maybe_shared_ref` lets the validator pass an unshared `RefType` expectation but adapts it to being shared if that is what is on the stack.
- Loading branch information
Showing
5 changed files
with
177 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/snapshots/local/shared-everything-threads/polymorphism.wast/0.print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(module | ||
(type (;0;) (func)) | ||
(type (;1;) (func (param (ref null (shared i31))))) | ||
(type (;2;) (func (param (ref null (shared array))))) | ||
(type (;3;) (func (param (ref null (shared extern))) (result (ref null (shared any))))) | ||
(type (;4;) (func (param (ref (shared extern))) (result (ref (shared any))))) | ||
(type (;5;) (func (param (ref null (shared any))) (result (ref null (shared extern))))) | ||
(type (;6;) (func (param (ref (shared any))) (result (ref (shared extern))))) | ||
(func (;0;) (type 0) | ||
ref.null (shared none) | ||
ref.null (shared none) | ||
ref.eq | ||
drop | ||
) | ||
(func (;1;) (type 1) (param (ref null (shared i31))) | ||
local.get 0 | ||
i31.get_s | ||
drop | ||
) | ||
(func (;2;) (type 1) (param (ref null (shared i31))) | ||
local.get 0 | ||
i31.get_u | ||
drop | ||
) | ||
(func (;3;) (type 2) (param (ref null (shared array))) | ||
local.get 0 | ||
array.len | ||
drop | ||
) | ||
(func (;4;) (type 3) (param (ref null (shared extern))) (result (ref null (shared any))) | ||
local.get 0 | ||
any.convert_extern | ||
) | ||
(func (;5;) (type 4) (param (ref (shared extern))) (result (ref (shared any))) | ||
local.get 0 | ||
any.convert_extern | ||
) | ||
(func (;6;) (type 5) (param (ref null (shared any))) (result (ref null (shared extern))) | ||
local.get 0 | ||
extern.convert_any | ||
) | ||
(func (;7;) (type 6) (param (ref (shared any))) (result (ref (shared extern))) | ||
local.get 0 | ||
extern.convert_any | ||
) | ||
) |