Stream: git-wasmtime

Topic: wasmtime / issue #15233 Windows ARM64: compiling a functi...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 11 2026 at 16:15):

alexcrichton opened issue #15233:

Compiling big.wasm.txt currently yields:

$ wasmtime compile --target aarch64-pc-windows-msvc big.wasm

thread 'main' panicked at crates/cranelift/src/obj.rs:331:17:
function too large

view this post on Zulip Wasmtime GitHub notifications bot (Nov 11 2026 at 16:15):

alexcrichton added the bug label to Issue #15233.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 11 2026 at 16:15):

alexcrichton added the cranelift:area:aarch64 label to Issue #15233.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 12 2026 at 20:04):

MythicByte commented on issue #15233:

This is a windows aarch64 problem, with the unwinding function size see https://learn.microsoft.com/en-us/cpp/build/arm64-exception-handling?view=msvc-170#large-functions. All functions over 1mb needs to be split how to do this i have at the moment no idea.

The code:

            // See https://learn.microsoft.com/en-us/cpp/build/arm64-exception-handling
            UnwindInfo::WindowsArm64(info) => {
                let code_words = info.code_words();
                let mut unwind_codes = vec![0; (code_words * 4) as usize];
                info.emit(&mut unwind_codes);

                // `.xdata` entries are always 4-byte aligned
                while self.windows_xdata.len() % 4 != 0 {
                    self.windows_xdata.push(0x00);
                }

                // First word:
                // 0-17:    Function Length
                // 18-19:   Version (must be 0)
                // 20:      X bit (is exception data present?)
                // 21:      E bit (has single packed epilogue?)
                // 22-26:   Epilogue count
                // 27-31:   Code words count
                let requires_extended_counts = code_words > (1 << 5);
                let encoded_function_len = function_len / 4;
                assert!(encoded_function_len < (1 << 18), "function too large");

The unwind code correctly asserts this.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 00:27):

cfallin commented on issue #15233:

That is really really unfortunate. All of the Wasmtime compilation tier + Cranelift is structured around the assumption that one Wasm function becomes one Cranelift function, and one Cranelift function is compiled to one machine-code body. A platform-dependent "splitting" requirement is pretty untenable.

The ways that I see to resolve this are:

Thoughts?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 10:35):

bjorn3 commented on issue #15233:

If I'm reading https://learn.microsoft.com/en-us/cpp/build/arm64-exception-handling?view=msvc-170#large-functions correctly, Microsoft isn't suggesting to split the actual function into multiple parts (eg outlining parts of the function), but rather to split the unwind table entry for the function into multiple fragments with all but the first fragment indicating that there is no function prologue and no gaps between the code regions covered by the individual fragments. This wouldn't need any major changes to Cranelift, only changes to the code generating the SEH unwind table.


Last updated: Nov 19 2026 at 20:05 UTC