Closed Bug 1821061 Opened 2 years ago Closed 2 years ago

Code generation for casting is wrong on x86 and arm32 baseline

Categories

(Core :: JavaScript: WebAssembly, defect, P2)

defect

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

Attachments

(3 files)

loadTypeDef in BaseCompiler will clobber a previously allocated InstanceReg when we are not pinning the instance register.

BaseCompiler::loadTypeDef assumes that it can use InstanceReg, but that
is only true on non x86/arm32.

This commit removes loadWasmGlobalPtr, as it's just a thin wrapper around
loadPtr that obscures more than helps. Callers of that now just specify
the register that contains the instance directly. This demystifies what's
going on. We can then fix baseline to use a register it has allocated.

We use many variations of 'global data', 'global area', and more recently
'instance data'. I prefer 'instance data' as 'global' is ambiguous with
wasm globals, which while stored in the instance are not the only thing
stored there. The naming scheme for this originated when globals were
the only thing stored there, so we should now change it.

Depends on D172026

We do this for type definitions, and can do this for tables and tags for consistency.

Depends on D172027

See Also: → 1820163
See Also: → 1817784
See Also: → 1819215
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/92b00f372ab9 wasm: Fix code generation of downcasts on x86/arm32. r=jseward https://hg.mozilla.org/integration/autoland/rev/47f4f17d5ee4 wasm: Rename to use 'instanceData' consistently. r=jseward https://hg.mozilla.org/integration/autoland/rev/b1f5bc95d0d3 wasm: Batch allocate bytes for tables and tags in instance data. r=jseward https://hg.mozilla.org/integration/autoland/rev/e5ef821175ce apply code formatting via Lando

Backed out for causing build bustages on WasmSerialize.cpp.

[task 2023-04-18T17:44:28.457Z] gmake[4]: Entering directory '/builds/worker/workspace/obj-spider/js/src/wasm'
[task 2023-04-18T17:44:28.458Z] /builds/worker/fetches/clang/bin/clang++ --sysroot /builds/worker/fetches/sysroot-x86_64-linux-gnu -Qunused-arguments -o Unified_cpp_js_src_wasm4.o -c  -I/builds/worker/workspace/obj-spider/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -ftrivial-auto-var-init=pattern -DDEBUG=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_CACHEIR_SPEW -DJS_STRUCTURED_SPEW -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/builds/worker/checkouts/gecko/js/src/wasm -I/builds/worker/workspace/obj-spider/js/src/wasm -I/builds/worker/workspace/obj-spider/js/src -I/builds/worker/checkouts/gecko/js/src -I/builds/worker/workspace/obj-spider/dist/include -I/builds/worker/workspace/obj-spider/dist/include/nspr -I/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-spider/js/src/js-confdefs.h -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fno-aligned-new -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -gdwarf-4 -Xclang -load -Xclang /builds/worker/workspace/obj-spider/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O3 -fno-omit-frame-pointer -funwind-tables -Werror -Wall -Wbitfield-enum-conversion -Wdeprecated-this-capture -Wempty-body -Wformat-type-confusion -Wignored-qualifiers -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtautological-constant-in-range-compare -Wtype-limits -Wno-error=tautological-type-limit-compare -Wunreachable-code -Wunreachable-code-return -Wunused-but-set-parameter -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wno-range-loop-analysis -Wc++2a-compat -Wenum-compare-conditional -Wenum-float-conversion -Wno-ambiguous-reversed-operator -Wno-error=deprecated -Wno-error=deprecated-anon-enum-enum-conversion -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-pragma -Wno-error=deprecated-this-capture -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wformat -Wformat-security -Wno-psabi -Wthread-safety -Wno-unknown-warning-option -Werror=format -fno-strict-aliasing -ffp-contract=off  -MD -MP -MF .deps/Unified_cpp_js_src_wasm4.o.pp   Unified_cpp_js_src_wasm4.cpp
[task 2023-04-18T17:44:28.458Z] In file included from Unified_cpp_js_src_wasm4.cpp:29:
[task 2023-04-18T17:44:28.458Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:57:17: error: cannot initialize a variable of type 'char (*)[112]' with an rvalue of type 'int'
[task 2023-04-18T17:44:28.458Z]   static char (*_Error)[sizeof(T)] = 1;
[task 2023-04-18T17:44:28.458Z]                 ^                    ~
[task 2023-04-18T17:44:28.458Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:722:3: note: in instantiation of template class 'js::wasm::Tripwire<js::wasm::TableDesc, 120>' requested here
[task 2023-04-18T17:44:28.458Z]   WASM_VERIFY_SERIALIZATION_FOR_SIZE(wasm::TableDesc, 120);
[task 2023-04-18T17:44:28.458Z]   ^
[task 2023-04-18T17:44:28.458Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:69:19: note: expanded from macro 'WASM_VERIFY_SERIALIZATION_FOR_SIZE'
[task 2023-04-18T17:44:28.458Z]     static_assert(Tripwire<Type, Size>::Value);
[task 2023-04-18T17:44:28.458Z]                   ^
[task 2023-04-18T17:44:28.458Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:60:30: error: in-class initializer for static data member is not a constant expression
[task 2023-04-18T17:44:28.458Z]   static const bool Value = !_Error;
[task 2023-04-18T17:44:28.458Z]                             ~^~~~~~
[task 2023-04-18T17:44:28.459Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:57:17: error: cannot initialize a variable of type 'char (*)[408]' with an rvalue of type 'int'
[task 2023-04-18T17:44:28.459Z]   static char (*_Error)[sizeof(T)] = 1;
[task 2023-04-18T17:44:28.459Z]                 ^                    ~
[task 2023-04-18T17:44:28.459Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:951:3: note: in instantiation of template class 'js::wasm::Tripwire<js::wasm::Metadata, 400>' requested here
[task 2023-04-18T17:44:28.459Z]   WASM_VERIFY_SERIALIZATION_FOR_SIZE(wasm::Metadata, 400);
[task 2023-04-18T17:44:28.459Z]   ^
[task 2023-04-18T17:44:28.459Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:69:19: note: expanded from macro 'WASM_VERIFY_SERIALIZATION_FOR_SIZE'
[task 2023-04-18T17:44:28.459Z]     static_assert(Tripwire<Type, Size>::Value);
[task 2023-04-18T17:44:28.459Z]                   ^
[task 2023-04-18T17:44:28.459Z] /builds/worker/checkouts/gecko/js/src/wasm/WasmSerialize.cpp:60:30: error: in-class initializer for static data member is not a constant expression
[task 2023-04-18T17:44:28.460Z]   static const bool Value = !_Error;
[task 2023-04-18T17:44:28.460Z]                             ~^~~~~~
[task 2023-04-18T17:44:28.460Z] 4 errors generated.
[task 2023-04-18T17:44:28.460Z] gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:670: Unified_cpp_js_src_wasm4.o] Error 1
[task 2023-04-18T17:44:28.460Z] gmake[4]: Leaving directory '/builds/worker/workspace/obj-spider/js/src/wasm'
Flags: needinfo?(rhunt)
Flags: needinfo?(rhunt)
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/9acd1c4be1e2 wasm: Fix code generation of downcasts on x86/arm32. r=jseward https://hg.mozilla.org/integration/autoland/rev/668594747d45 wasm: Rename to use 'instanceData' consistently. r=jseward https://hg.mozilla.org/integration/autoland/rev/4744a17556a7 wasm: Batch allocate bytes for tables and tags in instance data. r=jseward https://hg.mozilla.org/integration/autoland/rev/6a801407a901 apply code formatting via Lando
Regressions: 1829279
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: