diff options
author | Thomas Lively <tlively@google.com> | 2024-07-17 12:42:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-17 09:42:57 -0700 |
commit | 55d888acac2e78f110e298e2502517db1523a67e (patch) | |
tree | c0118d749d245788fca05b2e4ad8391c03e02b96 /src | |
parent | 994d8d31381dbc9dbaa89809c75b2c8d804e0d7f (diff) | |
download | binaryen-55d888acac2e78f110e298e2502517db1523a67e.tar.gz binaryen-55d888acac2e78f110e298e2502517db1523a67e.tar.bz2 binaryen-55d888acac2e78f110e298e2502517db1523a67e.zip |
[threads] Validate all features required by ref.null (#6758)
`ref.null` of shared types should only be allowed when shared-everything
is enabled, but we were previously checking only that reference types
were enabled when validating `ref.null`. Update the code to check all
features required by the null type and factor out shared logic for
printing lists of missing feature options in error messages.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-builder.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 1e768b11c..6663417f8 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -1217,8 +1217,10 @@ public: if (type.isFunction()) { return makeRefFunc(value.getFunc(), type.getHeapType()); } - if (type.isRef() && type.getHeapType() == HeapType::i31) { - return makeRefI31(makeConst(value.geti31())); + if (type.isRef() && type.getHeapType().isBasic() && + type.getHeapType().getBasic(Unshared) == HeapType::i31) { + return makeRefI31(makeConst(value.geti31()), + type.getHeapType().getShared()); } if (type.isString()) { // The string is already WTF-16, but we need to convert from `Literals` to |