Skip to content

Commit

Permalink
Upgrade dependencies (wasmtime 7.0.0) (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
kawamuray authored Aug 8, 2023
1 parent 2dd5067 commit 3634f24
Show file tree
Hide file tree
Showing 38 changed files with 1,420 additions and 1,004 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ See [examples](./examples) for the full example.
```java
public class HelloWasm {
public static void main(String[] args) {
try (Store store = new Store();
try (Store<Void> store = Store.withoutData();
Engine engine = store.engine();
Module module = Module.fromFile(engine, "./hello.wat");
Func helloFunc = WasmFunctions.wrap(store, () -> {
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ task metaProperties() {
}
}

def javah4xVersion = '0.5.0'
def javah4xVersion = '0.9.0'
task downloadJavah4x(type: Download) {
src "https://github.com/kawamuray/javah4x/releases/download/v${javah4xVersion}/javah4x-bin-${javah4xVersion}.zip"
dest new File(project.buildDir, "tmp")
Expand All @@ -128,6 +128,7 @@ task generateJniInterfaces(type:JavaExec) {
'io.github.kawamuray.wasmtime.Instance',
'io.github.kawamuray.wasmtime.Linker',
'io.github.kawamuray.wasmtime.Memory',
'io.github.kawamuray.wasmtime.Global',
'io.github.kawamuray.wasmtime.Module',
'io.github.kawamuray.wasmtime.Store',
'io.github.kawamuray.wasmtime.Config',
Expand Down
2 changes: 1 addition & 1 deletion examples/src/main/java/examples/MemoryInterop.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void main(String[] args) {
Module module = Module.fromFile(store.engine(), WASM_PATH)) {

WasiCtx.addToLinker(linker);
linker.define("xyz", "poll_word", Extern.fromFunc(pollWordFn));
linker.define(store, "xyz", "poll_word", Extern.fromFunc(pollWordFn));
linker.module(store, "", module);

try (Memory mem = linker.get(store, "", "memory").get().memory();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/github/kawamuray/wasmtime/Linker.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public <T> void module(Store<T> store, String moduleName, Module module) {
nativeModule(store.innerPtr(), moduleName, module.innerPtr());
}

public void define(String moduleName, String name, Extern extern) {
nativeDefine(moduleName, name, extern);
public <T> void define(Store<T> store, String moduleName, String name, Extern extern) {
nativeDefine(store.innerPtr(), moduleName, name, extern);
}

public <T> Optional<Extern> get(Store<T> store, String module, String name) {
Expand Down Expand Up @@ -61,7 +61,7 @@ public <T> Set<String> modules(Store<T> store) {

private native void nativeModule(long storePtr, String moduleName, long modulePtr);

private native void nativeDefine(String moduleName, String name, Extern externItem);
private native void nativeDefine(long storePtr, String moduleName, String name, Extern externItem);

private native Extern nativeGet(long storePtr, String module, String name);

Expand Down
Loading

0 comments on commit 3634f24

Please sign in to comment.