File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,7 @@ def is_git_repo():
362362 'type-ssa-shared.wast' ,
363363 'shared-ref_eq.wast' ,
364364 'shared-types-no-gc.wast' ,
365+ 'shared-ref-i31.wast' ,
365366]
366367
367368
Original file line number Diff line number Diff line change @@ -2727,6 +2727,12 @@ void FunctionValidator::visitCallRef(CallRef* curr) {
27272727void FunctionValidator::visitRefI31 (RefI31* curr) {
27282728 shouldBeTrue (
27292729 getModule ()->features .hasGC (), curr, " ref.i31 requires gc [--enable-gc]" );
2730+ if (curr->type .isRef () && curr->type .getHeapType ().isShared ()) {
2731+ shouldBeTrue (
2732+ getModule ()->features .hasSharedEverything (),
2733+ curr,
2734+ " ref.i31_shared requires shared-everything [--enable-shared-everything]" );
2735+ }
27302736 shouldBeSubType (curr->value ->type ,
27312737 Type::i32 ,
27322738 curr->value ,
Original file line number Diff line number Diff line change 1+ ;; Test that ref.i31_shared requires shared-everything threads
2+
3+ ;; RUN: not wasm-opt %s -all --disable-shared-everything 2>&1 | filecheck %s --check-prefix NO-SHARED
4+ ;; RUN: wasm-opt %s --enable-reference-types --enable-gc --enable-shared-everything -o - -S | filecheck %s --check-prefix SHARED
5+
6+ ;; NO-SHARED: ref.i31_shared requires shared-everything [--enable-shared-everything]
7+ ;; SHARED: (ref.i31_shared
8+ ;; SHARED-NEXT: (i32.const 0)
9+
10+ (module
11+ (func (drop (ref.i31_shared (i32.const 0 ))))
12+ )
You can’t perform that action at this time.
0 commit comments