Open radekdoulik opened 6 hours ago
I tried various version of llvm to test assumption of this being related to the recent llvm bump to 19.1.0.
The problem exists on 19.1.0, 19.0.x alpha (same commit as emsdk) and even with 16.x after our emscripten bump to 3.1.56. So it looks unrelated.
Later I was trying to find which part of mono_ppdb_load_file
might be causing issues.
When I removed code guarded by #ifndef DISABLE_EMBEDDED_PDB
, the mono_ppdb_load_file
wasn't causing problems anymore. Instead I am getting similar problem with
[error] MONO_WASM: instantiate_wasm_module() failed CompileError: WebAssembly.compileStreaming(): Compiling function #26259:"CompressionNative_InflateInit2_" failed: expected 1 elements on the stack for fallthru, found 4 @+7856472
Which lead me to the zlib linking, which I think is the issue here. What is happening here is that this line
int res = inflateInit2 (&stream, -15);
is being inlined and the same issue as with the CompressionNative_InflateInit2_
is occurring here. Later I found that the CompressionNative_Inflate
has similar issue.
I wonder if we compile and/or link against two different zlib versions. I will dig deeper.
cc @carlossanlop
Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.
Tagging subscribers to this area: @dotnet/area-system-io-compression See info in area-owners.md if you want to be subscribed.
The inflateInit2_
function looks like this
/* Function used by zlib.h and zlib-ng version 2.0 macros */
int32_t Z_EXPORT PREFIX(inflateInit2_)(PREFIX3(stream) *strm, int32_t windowBits, const char *version, int32_t stream_size) {
...
}
and there's redefining macro with only 2 parameters
# define inflateInit2(strm, windowBits) \
... inflateInit2_ ...
and function with same parameters as the redefining macro
/* ===========================================================================
* Initialize inflate state and buffers.
* This function is hidden in ZLIB_COMPAT builds.
*/
int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
...
}
in our .wasm
binary we have
(func Cr_z_inflateInit2_(param $0 i32, $1 i32, $2 i32, $3 i32) (result i32))
(func inflateInit2_(param $0 i32, $1 i32) (result i32))
It looks like possibly wrong function was inlined, maybe wasm-ld or wasm-opt issue?
Application referencing skiasharp packages in Debug configuration are triggering these errors during runtime in chrome:
It is also reproducible on CI, https://github.com/dotnet/runtime/pull/109232 is now triggering this problem.