Skip to content

Commit

Permalink
Fix changes to Wasmtime C API.
Browse files Browse the repository at this point in the history
This commit fixes the .NET `Config` API to conform to the latest
upstream Wasmtime's C API signatures.

See bytecodealliance/wasmtime#4252 for the upstream change.
  • Loading branch information
peterhuene committed Jun 14, 2022
1 parent 7683592 commit 1ce5607
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,7 @@ public Config WithCompilerStrategy(CompilerStrategy strategy)
throw new ArgumentOutOfRangeException(nameof(strategy));
}

var error = Native.wasmtime_config_strategy_set(handle, (byte)strategy);
if (error != IntPtr.Zero)
{
throw WasmtimeException.FromOwnedError(error);
}

Native.wasmtime_config_strategy_set(handle, (byte)strategy);
return this;
}

Expand Down Expand Up @@ -268,12 +263,7 @@ public Config WithProfilingStrategy(ProfilingStrategy strategy)
throw new ArgumentOutOfRangeException(nameof(strategy));
}

var error = Native.wasmtime_config_profiler_set(handle, (byte)strategy);
if (error != IntPtr.Zero)
{
throw WasmtimeException.FromOwnedError(error);
}

Native.wasmtime_config_profiler_set(handle, (byte)strategy);
return this;
}

Expand Down Expand Up @@ -402,7 +392,7 @@ private static class Native
public static extern void wasmtime_config_wasm_multi_memory_set(Handle config, bool enable);

[DllImport(Engine.LibraryName)]
public static extern IntPtr wasmtime_config_strategy_set(Handle config, byte strategy);
public static extern void wasmtime_config_strategy_set(Handle config, byte strategy);

[DllImport(Engine.LibraryName)]
public static extern void wasmtime_config_cranelift_debug_verifier_set(Handle config, bool enable);
Expand All @@ -414,7 +404,7 @@ private static class Native
public static extern void wasmtime_config_cranelift_opt_level_set(Handle config, byte level);

[DllImport(Engine.LibraryName)]
public static extern IntPtr wasmtime_config_profiler_set(Handle config, byte strategy);
public static extern void wasmtime_config_profiler_set(Handle config, byte strategy);

[DllImport(Engine.LibraryName)]
public static extern void wasmtime_config_static_memory_maximum_size_set(Handle config, ulong size);
Expand Down

0 comments on commit 1ce5607

Please sign in to comment.