Update WebAssembly C API submodule to latest commit. (#2579)
* Update WebAssembly C API submodule to latest commit. This commit updates the WebAssembly C API submodule (for `wasm.h`) to the latest commit out of master. This fixes the behavior of `wasm_name_new_from_string` such that it no longer copies the null character into the name, which caused unexpected failures when using the Wasmtime linker as imports wouldn't resolve when the null was present. Along with this change were breaking changes to `wasm_func_call`, the host callback signatures, and `wasm_instance_new` to take a vector type instead of a pointer to an unsized array. As a result, Wasmtime language bindings based on the C API will need to be updated once this change is pulled in. Fixes #2211. Fixes #2131. * Update Doxygen comments for wasm.h changes.
This commit is contained in:
@@ -17,9 +17,9 @@ const int N_THREADS = 10;
|
||||
const int N_REPS = 3;
|
||||
|
||||
// A function to be called from Wasm code.
|
||||
own wasm_trap_t* callback(const wasm_val_t args[], wasm_val_t results[]) {
|
||||
assert(args[0].kind == WASM_I32);
|
||||
printf("> Thread %d running\n", args[0].of.i32);
|
||||
own wasm_trap_t* callback(const wasm_val_vec_t* args, wasm_val_vec_t* results) {
|
||||
assert(args->data[0].kind == WASM_I32);
|
||||
printf("> Thread %d running\n", args->data[0].of.i32);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,12 @@ void* run(void* args_abs) {
|
||||
wasm_globaltype_delete(global_type);
|
||||
|
||||
// Instantiate.
|
||||
const wasm_extern_t* imports[] = {
|
||||
wasm_extern_t* imports[] = {
|
||||
wasm_func_as_extern(func), wasm_global_as_extern(global),
|
||||
};
|
||||
wasm_extern_vec_t imports_vec = WASM_ARRAY_VEC(imports);
|
||||
own wasm_instance_t* instance =
|
||||
wasm_instance_new(store, module, imports, NULL);
|
||||
wasm_instance_new(store, module, &imports_vec, NULL);
|
||||
if (!instance) {
|
||||
printf("> Error instantiating module!\n");
|
||||
return NULL;
|
||||
@@ -82,7 +83,9 @@ void* run(void* args_abs) {
|
||||
wasm_instance_delete(instance);
|
||||
|
||||
// Call.
|
||||
if (wasm_func_call(run_func, NULL, NULL)) {
|
||||
wasm_val_vec_t args_vec = WASM_EMPTY_VEC;
|
||||
wasm_val_vec_t results_vec = WASM_EMPTY_VEC;
|
||||
if (wasm_func_call(run_func, &args_vec, &results_vec)) {
|
||||
printf("> Error calling function!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user