From b7a68a8f79fda9cf8f63c6bc96e9dee160f3b50f Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Thu, 17 Sep 2026 15:47:27 +0100 Subject: [PATCH] Added `WithBranchHinting` config --- src/Config.cs | 14 ++++++++++++++ tests/ConfigTests.cs | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Config.cs b/src/Config.cs index e22974d9..8e136f23 100644 --- a/src/Config.cs +++ b/src/Config.cs @@ -257,6 +257,17 @@ public Config WithWideArithmetic(bool enable) return this; } + /// + /// Sets whether the WebAssembly branch-hinting proposal is enabled. + /// + /// True to enable WebAssembly branch hinting support or false to disable. + /// Returns the current config. + public Config WithBranchHinting(bool enable) + { + Native.wasmtime_config_wasm_branch_hinting_set(handle, enable); + return this; + } + /// /// Configures whether the WebAssembly exceptions proposal is enabled. /// @@ -595,6 +606,9 @@ private static class Native [DllImport(Engine.LibraryName)] public static extern void wasmtime_config_wasm_wide_arithmetic_set(Handle config, [MarshalAs(UnmanagedType.I1)] bool enable); + [DllImport(Engine.LibraryName)] + public static extern void wasmtime_config_wasm_branch_hinting_set(Handle config, [MarshalAs(UnmanagedType.I1)] bool enable); + [DllImport(Engine.LibraryName)] public static extern void wasmtime_config_wasm_stack_switching_set(Handle config, [MarshalAs(UnmanagedType.I1)] bool enable); diff --git a/tests/ConfigTests.cs b/tests/ConfigTests.cs index a779d0f1..b83d22ae 100644 --- a/tests/ConfigTests.cs +++ b/tests/ConfigTests.cs @@ -104,6 +104,16 @@ public void ItSetsWideArithmetic() using var engine = new Engine(config); } + [Fact] + public void ItSetsBranchHinting() + { + var config = new Config(); + + config.WithBranchHinting(true); + + using var engine = new Engine(config); + } + [Fact] public void ItSetsThreads() {