Skip to content

Commit 8c64a30

Browse files
authored
[WebAssembly] Disable reference types in generic CPU (#90792)
#80923 newly enabled multivalue and reference-types in the generic CPU. But enabling reference-types ended up breaking up Wasm's Chromium CI (https://chromium-review.googlesource.com/c/emscripten-releases/+/5500231) because the way the table index is encoded is different from MVP (u32) vs. reference-types (LEB), which caused different encodings for `call_indirect`. And Chromium CI's and Emscripten's minimum required node version is v16, which does not yet support reference-types, which does not recognize that table index encoding. reference-types is first supported in node v17.2. We knew the current minimum required node for Emscripten (v16) did not support reference-types, but thought it was fine because unless you explicitly use `__funcref` or `__externref` things would be fine, and if you want to use them explicitly, you would have a newer node. But it turned out it also affected the encoding of `call_indirect`. While we are discussing the potential solutions, I will disable reference-types to unblock the rolls.
1 parent 56e4111 commit 8c64a30

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clang/docs/ReleaseNotes.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,10 @@ AIX Support
742742
WebAssembly Support
743743
^^^^^^^^^^^^^^^^^^^
744744

745-
The -mcpu=generic configuration now enables multivalue and reference-types.These
746-
proposals are standardized and available in all major engines. Enabling
747-
multivalue here only enables the language feature but does not turn on the
748-
multivalue ABI (this enables non-ABI uses of multivalue, like exnref).
745+
The -mcpu=generic configuration now enables multivalue feature, which is
746+
standardized and available in all major engines. Enabling multivalue here only
747+
enables the language feature but does not turn on the multivalue ABI (this
748+
enables non-ABI uses of multivalue, like exnref).
749749

750750
AVR Support
751751
^^^^^^^^^^^

clang/lib/Basic/Targets/WebAssembly.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ bool WebAssemblyTargetInfo::initFeatureMap(
153153
auto addGenericFeatures = [&]() {
154154
Features["multivalue"] = true;
155155
Features["mutable-globals"] = true;
156-
Features["reference-types"] = true;
157156
Features["sign-ext"] = true;
158157
};
159158
auto addBleedingEdgeFeatures = [&]() {
@@ -162,6 +161,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
162161
Features["bulk-memory"] = true;
163162
Features["multimemory"] = true;
164163
Features["nontrapping-fptoint"] = true;
164+
Features["reference-types"] = true;
165165
Features["tail-call"] = true;
166166
Features["half-precision"] = true;
167167
setSIMDLevel(Features, SIMD128, true);

clang/test/Preprocessor/wasm-target-features.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@
164164
//
165165
// GENERIC-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
166166
// GENERIC-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}
167-
// GENERIC-INCLUDE-DAG: #define __wasm_reference_types__ 1{{$}}
168167
// GENERIC-INCLUDE-DAG: #define __wasm_sign_ext__ 1{{$}}
169168
//
170169
// RUN: %clang -E -dM %s -o - 2>&1 \
@@ -181,6 +180,7 @@
181180
// GENERIC-NOT: #define __wasm_half_precision__ 1{{$}}
182181
// GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
183182
// GENERIC-NOT: #define __wasm_nontrapping_fptoint__ 1{{$}}
183+
// GENERIC-NOT: #define __wasm_reference_types__ 1{{$}}
184184
// GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}
185185
// GENERIC-NOT: #define __wasm_simd128__ 1{{$}}
186186
// GENERIC-NOT: #define __wasm_tail_call__ 1{{$}}

0 commit comments

Comments
 (0)