Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.dylibso.chicory.runtime.ImportMemory;
import com.dylibso.chicory.runtime.Instance;
import com.dylibso.chicory.runtime.Machine;
import com.dylibso.chicory.wasi.WasiOptions;
import com.dylibso.chicory.wasm.WasmModule;
import io.roastedroot.proxywasm.internal.ProxyWasm;
import java.net.URI;
Expand Down Expand Up @@ -319,20 +318,6 @@ public PluginFactory.Builder withMachineFactory(
return this;
}

/**
* Configures WebAssembly System Interface (WASI) options for the plugin instance.
* WASI provides a standard interface for WASM modules to interact with the underlying operating system
* for tasks like file system access, environment variables, etc. While Proxy-WASM defines its own ABI,
* some modules might also utilize WASI features.
*
* @param options The {@link WasiOptions} to configure for the WASI environment.
* @return this {@code Builder} instance for method chaining.
*/
public PluginFactory.Builder withWasiOptions(WasiOptions options) {
proxyWasmBuilder.withWasiOptions(options);
return this;
}

/**
* Configures whether the plugin instance should be shared across multiple host requests or contexts.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.dylibso.chicory.annotations.HostModule;
import com.dylibso.chicory.annotations.WasmExport;
import com.dylibso.chicory.runtime.ExportFunction;
import com.dylibso.chicory.runtime.HostFunction;
import com.dylibso.chicory.runtime.Instance;
import com.dylibso.chicory.runtime.Memory;
import com.dylibso.chicory.runtime.WasmRuntimeException;
Expand Down Expand Up @@ -1921,4 +1922,17 @@ void proxyOnForeignFunction(int contextId, int functionId, int argumentsSize) {
}
proxyOnForeignFunctionFn.apply(contextId, functionId, argumentsSize);
}

@WasmExport
void emscriptenNotifyMemoryGrowth(int size) {}

public HostFunction[] toHostFunctions() {
var functions = new ArrayList<>(List.of(ABI_ModuleFactory.toHostFunctions(this)));

HostFunction[] wasiFunctions = new ABI_WASI(handler).toHostFunctions();
functions.addAll(List.of(wasiFunctions));
functions.addAll(List.of(Helpers.withModuleName(wasiFunctions, "wasi_unstable")));

return functions.toArray(new HostFunction[0]);
}
}
Loading