Skip to content

Commit

Permalink
llvm: Don't use the optimized jump table construction logic for wasm.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp authored and RetroDev256 committed Sep 10, 2024
1 parent 0a62c4e commit 21a0a4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6544,6 +6544,12 @@ pub const FuncGen = struct {

const jmp_table: ?SwitchDispatchInfo.JmpTable = jmp_table: {
if (!is_dispatch_loop) break :jmp_table null;

// Workaround for:
// * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/lib/MC/WasmObjectWriter.cpp#L560
// * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll
if (zcu.comp.getTarget().isWasm()) break :jmp_table null;

// On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just
// about acceptable - it won't fill L1d cache on most CPUs.
const max_table_len = 1024;
Expand Down

0 comments on commit 21a0a4b

Please sign in to comment.