diff --git a/go.mod b/go.mod index 21dfb0608c..f08b5dbe89 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/OneOfOne/xxhash v1.2.8 - github.com/bytecodealliance/wasmtime-go v0.28.0 + github.com/bytecodealliance/wasmtime-go v0.38.0 github.com/fortytw2/leaktest v1.3.0 github.com/fsnotify/fsnotify v1.4.9 github.com/ghodss/yaml v1.0.0 diff --git a/go.sum b/go.sum index 2240da765e..d73bc8dde1 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/bytecodealliance/wasmtime-go v0.28.0 h1:JTWP482wkmR79O9T0JiIAllPqmNW5oP0v56v/FwCpaQ= -github.com/bytecodealliance/wasmtime-go v0.28.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI= +github.com/bytecodealliance/wasmtime-go v0.38.0 h1:uG2qZE5XFY+g4G9EUIvGPd3KhnUyaT07bNFgSJ4HKMA= +github.com/bytecodealliance/wasmtime-go v0.38.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/.gitignore b/vendor/github.com/bytecodealliance/wasmtime-go/.gitignore new file mode 100644 index 0000000000..d6f13472bc --- /dev/null +++ b/vendor/github.com/bytecodealliance/wasmtime-go/.gitignore @@ -0,0 +1,3 @@ +build +/bazel-* +test-vendoring-project \ No newline at end of file diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/BUILD.bazel b/vendor/github.com/bytecodealliance/wasmtime-go/BUILD.bazel index d55f2768d6..017318fcd6 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/BUILD.bazel +++ b/vendor/github.com/bytecodealliance/wasmtime-go/BUILD.bazel @@ -29,14 +29,11 @@ go_library( "globaltype.go", "importtype.go", "instance.go", - "instancetype.go", - "limits.go", "linker.go", "maybe_gc_no.go", "memory.go", "memorytype.go", "module.go", - "moduletype.go", "shims.c", "shims.h", "slab.go", @@ -84,7 +81,6 @@ go_test( "instance_test.go", "linker_test.go", "memorytype_test.go", - "module_linking_test.go", "module_test.go", "reftypes_test.go", "slab_test.go", diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/README.md b/vendor/github.com/bytecodealliance/wasmtime-go/README.md index 61a78a0a1a..7bdb7c9642 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/README.md +++ b/vendor/github.com/bytecodealliance/wasmtime-go/README.md @@ -25,7 +25,7 @@ ## Installation ```sh -go get -u github.com/bytecodealliance/wasmtime-go@v0.28.0 +go get -u github.com/bytecodealliance/wasmtime-go@v0.38.0 ``` Be sure to check out the [API documentation][api]! @@ -37,13 +37,10 @@ Wasmtime locally, but it means that this project only works on Linux x86\_64, macOS x86\_64 , and Windows x86\_64 currently. Building on other platforms will need to arrange to build Wasmtime and use `CGO_*` env vars to compile correctly. -This project has been tested with Go 1.13 or later. It is not recommended to -use Go 1.14 earlier than Go 1.14.11 on macOS due to a [bug in the Go runtime][bug]. +This project has been tested with Go 1.13 or later. [api]: https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go [wasmtime]: https://github.com/bytecodealliance/wasmtime -[bug]: https://github.com/golang/go/issues/39079 - If you are a bazel user, add following to your WORKSPACE file: @@ -51,7 +48,7 @@ If you are a bazel user, add following to your WORKSPACE file: go_repository( name = "com_github_bytecodealliance_wasmtime_go", importpath = "github.com/bytecodealliance/wasmtime-go", - version = "v0.28.0", + version = "v0.38.0", ) ``` @@ -102,7 +99,10 @@ func main() { // After we've instantiated we can lookup our `run` function and call // it. - run := instance.GetExport(store, "run").Func() + run := instance.GetFunc(store, "run") + if run == nil { + panic("not a function") + } _, err = run.Call(store) check(err) } diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/doc-wasm.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/doc-wasm.h deleted file mode 100644 index 5170de920c..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/doc-wasm.h +++ /dev/null @@ -1,2061 +0,0 @@ -/** - * \file wasm.h - * - * Upstream Embedding API for WebAssembly. - * - * This API is defined by the upstream wasm-c-api proposal at - * https://github.com/WebAssembly/wasm-c-api. That proposal is in flux but - * Wasmtime intends to be active in its development. - * - * The documentation for this header file is currently defined in the Wasmtime - * project, not in the upstream header file. Some behavior here may be - * Wasmtime-specific and may not be portable to other engines implementing the - * same C API. Also note that not all functionality from the upstream C API is - * implemented in Wasmtime. We strive to provide all symbols as to not generate - * link errors but some functions are unimplemented and will abort the process - * if called. - * - * ### Memory Management - * - * Memory management in the wasm C API is intended to be relatively simple. Each - * individual object is reference counted unless otherwise noted. You can delete - * any object at any time after you no longer need it. Deletion of an object - * does not imply that the memory will be deallocated at that time. If another - * object still internally references the original object then the memory will - * still be alive. - * - * For example you can delete a #wasm_engine_t after you create a #wasm_store_t - * with #wasm_store_new. The engine, however, is still referenced by the - * #wasm_store_t so it will not be deallocated. In essence by calling - * #wasm_engine_delete you're release your own strong reference on the - * #wasm_engine_t, but that's it. - * - * Additionally APIs like #wasm_memory_copy do not actually copy the underlying - * data. Instead they only increment the reference count and return a new - * object. You'll need to still call #wasm_memory_delete (or the corresponding - * `*_delete` function) for each copy of an object you acquire. - * - * ### Vectors - * - * This API provides a number of `wasm_*_vec_t` type definitions and functions - * to work with them. Each vector is defined by a pointer and a length. - * "Ownership" of a vector refers to the data pointer, not the memory holding - * the data pointer and the length. It is safe, for example to create a - * #wasm_name_t on the stack and pass it to #wasm_importtype_new. The memory - * pointed to by #wasm_name_t must be properly initialized, however, and cannot - * reside on the stack. - */ - -/** - * \typedef byte_t - * \brief A type definition for a number that occupies a single byte of data. - * - * \typedef wasm_byte_t - * \brief A type definition for a number that occupies a single byte of data. - * - * \typedef float32_t - * \brief A type definition for a 32-bit float. - * - * \typedef float64_t - * \brief A type definition for a 64-bit float. - * - * \typedef wasm_name_t - * \brief Convenience for hinting that an argument only accepts utf-8 input. - */ - -/** - * \typedef wasm_config_t - * \brief Convenience alias for #wasm_config_t - * - * \struct wasm_config_t - * \brief Global engine configuration - * - * This structure represents global configuration used when constructing a - * #wasm_engine_t. There are now functions to modify this from wasm.h but the - * wasmtime/config.h header provides a number of Wasmtime-specific functions to - * tweak configuration options. - * - * This object is created with #wasm_config_new. - * - * Configuration is safe to share between threads. Typically you'll create a - * config object and immediately pass it into #wasm_engine_new_with_config, - * however. - * - * For more information about configuration see the Rust documentation as well - * at - * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html. - * - * \fn wasm_config_t *wasm_config_new(void); - * \brief Creates a new empty configuration object. - * - * The object returned is owned by the caller and will need to be deleted with - * #wasm_config_delete. May return `NULL` if a configuration object could not be - * allocated. - * - * \fn void wasm_config_delete(wasm_config_t*); - * \brief Deletes a configuration object. - */ - -/** - * \typedef wasm_engine_t - * \brief Convenience alias for #wasm_engine_t - * - * \struct wasm_engine_t - * \brief Compilation environment and configuration. - * - * An engine is typically global in a program and contains all the configuration - * necessary for compiling wasm code. From an engine you'll typically create a - * #wasmtime_store_t. Engines are created with #wasm_engine_new or - * #wasm_engine_new_with_config. - * - * An engine is safe to share between threads. Multiple stores can be created - * within the same engine with each store living on a separate thread. Typically - * you'll create one #wasm_engine_t for the lifetime of your program. - * - * Engines are reference counted internally so #wasm_engine_delete can be called - * at any time after a #wasmtime_store_t has been created from one. - * - * \fn wasm_engine_t *wasm_engine_new(void); - * \brief Creates a new engine with the default configuration. - * - * The object returned is owned by the caller and will need to be deleted with - * #wasm_engine_delete. This may return `NULL` if the engine could not be - * allocated. - * - * \fn wasm_engine_t *wasm_engine_new_with_config(wasm_config_t *); - * \brief Creates a new engine with the specified configuration. - * - * This function will take ownership of the configuration specified regardless - * of the outcome of this function. You do not need to call #wasm_config_delete - * on the argument. The object returned is owned by the caller and will need to - * be deleted with #wasm_engine_delete. This may return `NULL` if the engine - * could not be allocated. - * - * \fn void wasm_engine_delete(wasm_engine_t*); - * \brief Deletes an engine. - */ - -/** - * \typedef wasm_store_t - * \brief Convenience alias for #wasm_store_t - * - * \struct wasm_store_t - * \brief A collection of instances and wasm global items. - * - * A #wasm_store_t corresponds to the concept of an [embedding - * store](https://webassembly.github.io/spec/core/exec/runtime.html#store) - * - * \fn wasm_store_t *wasm_store_new(wasm_engine_t *); - * \brief Creates a new store within the specified engine. - * - * The object returned is owned by the caller and will need to be deleted with - * #wasm_store_delete. This may return `NULL` if the store could not be - * allocated. - * - * \fn void wasm_store_delete(wasm_store_t *); - * \brief Deletes the specified store. - */ - -/** - * \struct wasm_byte_vec_t - * \brief A list of bytes - * - * Used to pass data in or pass data out of various functions. The meaning and - * ownership of the bytes is defined by each API that operates on this - * datatype. - * - * \var wasm_byte_vec_t::size - * \brief Length of this vector. - * - * \var wasm_byte_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_byte_vec_t - * \brief Convenience alias for #wasm_byte_vec_t - * - * \typedef wasm_message_t - * \brief Alias of #wasm_byte_vec_t which always has a trailing 0-byte. - * - * \fn wasm_name - * \brief Unused by Wasmtime - * - * \fn wasm_name_new - * \brief Convenience alias - * - * \fn wasm_name_new_empty - * \brief Convenience alias - * - * \fn wasm_name_new_new_uninitialized - * \brief Convenience alias - * - * \fn wasm_name_new_from_string - * \brief Create a new name from a C string. - * - * \fn wasm_name_new_from_string_nt - * \brief Create a new name from a C string with null terminator. - * - * \fn wasm_name_copy - * \brief Convenience alias - * - * \fn wasm_name_delete - * \brief Convenience alias - * - * \fn void wasm_byte_vec_new_empty(wasm_byte_vec_t *out); - * \brief Initializes an empty byte vector. - * - * \fn void wasm_byte_vec_new_uninitialized(wasm_byte_vec_t *out, size_t); - * \brief Initializes an byte vector with the specified capacity. - * - * This function will initialize the provided vector with capacity to hold the - * specified number of bytes. The `out` parameter must previously not already be - * initialized and after this function is called you are then responsible for - * ensuring #wasm_byte_vec_delete is called. - * - * \fn void wasm_byte_vec_new(wasm_byte_vec_t *out, size_t, wasm_byte_t const[]); - * \brief Copies the specified data into a new byte vector. - * - * This function will copy the provided data into this byte vector. The byte - * vector should not be previously initialized and the caller is responsible for - * calling #wasm_byte_vec_delete after this function returns. - * - * Note that memory of the the initialization vector provided to this function - * must be managed externally. This function will copy the contents to the - * output vector, but it's up to the caller to properly deallocate the memory. - * - * \fn void wasm_byte_vec_copy(wasm_byte_vec_t *out, const wasm_byte_vec_t *); - * \brief Copies one vector into a new vector. - * - * Copies the second argument's data into the first argument. The `out` vector - * should not be previously initialized and after this function returns you're - * responsible for calling #wasm_byte_vec_delete. - * - * \fn void wasm_byte_vec_delete(wasm_byte_vec_t *); - * \brief Deletes a byte vector. - * - * This function will deallocate the data referenced by the argument provided. - * This does not deallocate the memory holding the #wasm_byte_vec_t itself, it's - * expected that memory is owned by the caller. - */ - -/** - * \struct wasm_valtype_t - * \brief An object representing the type of a value. - * - * \typedef wasm_valtype_t - * \brief Convenience alias for #wasm_valtype_t - * - * \struct wasm_valtype_vec_t - * \brief A list of #wasm_valtype_t values. - * - * \var wasm_valtype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_valtype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_valtype_vec_t - * \brief Convenience alias for #wasm_valtype_vec_t - * - * \fn void wasm_valtype_delete(wasm_valtype_t *); - * \brief Deletes a type. - * - * \fn void wasm_valtype_vec_new_empty(wasm_valtype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_valtype_vec_new_uninitialized(wasm_valtype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_valtype_vec_new(wasm_valtype_vec_t *out, size_t, wasm_valtype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_valtype_vec_copy(wasm_valtype_vec_t *out, const wasm_valtype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_valtype_vec_delete(wasm_valtype_vec_t *out) - * \brief Deallocates memory for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_valtype_t* wasm_valtype_copy(const wasm_valtype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_valtype_t* wasm_valtype_new(wasm_valkind_t); - * \brief Creates a new value type from the specified kind. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t *); - * \brief Returns the associated kind for this value type. - */ - -/** - * \typedef wasm_valkind_t - * \brief Different kinds of types supported in wasm. - */ - -/** - * \struct wasm_functype_t - * \brief An opaque object representing the type of a function. - * - * \typedef wasm_functype_t - * \brief Convenience alias for #wasm_functype_t - * - * \struct wasm_functype_vec_t - * \brief A list of #wasm_functype_t values. - * - * \var wasm_functype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_functype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_functype_vec_t - * \brief Convenience alias for #wasm_functype_vec_t - * - * \fn void wasm_functype_delete(wasm_functype_t *); - * \brief Deletes a type. - * - * \fn void wasm_functype_vec_new_empty(wasm_functype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_functype_vec_new_uninitialized(wasm_functype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_functype_vec_new(wasm_functype_vec_t *out, size_t, wasm_functype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_functype_vec_copy(wasm_functype_vec_t *out, const wasm_functype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_functype_vec_delete(wasm_functype_vec_t *out) - * \brief Deallocates memory for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_functype_t* wasm_functype_copy(const wasm_functype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_functype_t* wasm_functype_new(wasm_valtype_vec_t *params, wasm_valtype_vec_t *results); - * \brief Creates a new function type with the provided parameter and result - * types. - * - * The caller is responsible for deleting the returned value. - * - * \fn const wasm_valtype_vec_t* wasm_functype_params(const wasm_functype_t *); - * \brief Returns the list of parameters of this function type. - * - * The returned memory is owned by the #wasm_functype_t argument, the caller - * should not deallocate it. - * - * \fn const wasm_valtype_vec_t* wasm_functype_results(const wasm_functype_t *); - * \brief Returns the list of results of this function type. - * - * The returned memory is owned by the #wasm_functype_t argument, the caller - * should not deallocate it. - */ - -/** - * \struct wasm_globaltype_t - * \brief An opaque object representing the type of a global. - * - * \typedef wasm_globaltype_t - * \brief Convenience alias for #wasm_globaltype_t - * - * \struct wasm_globaltype_vec_t - * \brief A list of #wasm_globaltype_t values. - * - * \var wasm_globaltype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_globaltype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_globaltype_vec_t - * \brief Convenience alias for #wasm_globaltype_vec_t - * - * \fn void wasm_globaltype_delete(wasm_globaltype_t *); - * \brief Deletes a type. - * - * \fn void wasm_globaltype_vec_new_empty(wasm_globaltype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_globaltype_vec_new_uninitialized(wasm_globaltype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_globaltype_vec_new(wasm_globaltype_vec_t *out, size_t, wasm_globaltype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_globaltype_vec_copy(wasm_globaltype_vec_t *out, const wasm_globaltype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_globaltype_vec_delete(wasm_globaltype_vec_t *out) - * \brief Deallocates memory for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_globaltype_t* wasm_globaltype_copy(const wasm_globaltype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_globaltype_t* wasm_globaltype_new(wasm_valtype_t *, wasm_mutability_t) - * \brief Creates a new global type. - * - * This function takes ownership of the #wasm_valtype_t argument. - * - * The caller is responsible for deleting the returned value. - * - * \fn const wasm_valtype_t* wasm_globaltype_content(const wasm_globaltype_t *); - * \brief Returns the type of value contained in a global. - * - * The returned memory is owned by the provided #wasm_globaltype_t, the caller - * should not deallocate it. - * - * \fn wasm_mutability_t wasm_globaltype_mutability(const wasm_globaltype_t *); - * \brief Returns whether or not a global is mutable. - */ - -/** - * \typedef wasm_mutability_t - * \brief Boolean flag for whether a global is mutable or not. - */ - -/** - * \struct wasm_tabletype_t - * \brief An opaque object representing the type of a table. - * - * \typedef wasm_tabletype_t - * \brief Convenience alias for #wasm_tabletype_t - * - * \struct wasm_tabletype_vec_t - * \brief A list of #wasm_tabletype_t values. - * - * \var wasm_tabletype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_tabletype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_tabletype_vec_t - * \brief Convenience alias for #wasm_tabletype_vec_t - * - * \fn void wasm_tabletype_delete(wasm_tabletype_t *); - * \brief Deletes a type. - * - * \fn void wasm_tabletype_vec_new_empty(wasm_tabletype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_tabletype_vec_new_uninitialized(wasm_tabletype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_tabletype_vec_new(wasm_tabletype_vec_t *out, size_t, wasm_tabletype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_tabletype_vec_copy(wasm_tabletype_vec_t *out, const wasm_tabletype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_tabletype_vec_delete(wasm_tabletype_vec_t *out) - * \brief Deallocates memory for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_tabletype_t* wasm_tabletype_copy(const wasm_tabletype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_tabletype_t* wasm_tabletype_new(wasm_valtype_t *, const wasm_limits_t *)h - * \brief Creates a new table type. - * - * This function takes ownership of the #wasm_valtype_t argument, but does not - * take ownership of the #wasm_limits_t. - * - * The caller is responsible for deallocating the returned type. - * - * \fn const wasm_valtype_t* wasm_tabletype_element(const wasm_tabletype_t *); - * \brief Returns the element type of this table. - * - * The returned #wasm_valtype_t is owned by the #wasm_tabletype_t parameter, the - * caller should not deallocate it. - * - * \fn const wasm_limits_t* wasm_tabletype_limits(const wasm_tabletype_t *); - * \brief Returns the limits of this table. - * - * The returned #wasm_limits_t is owned by the #wasm_tabletype_t parameter, the - * caller should not deallocate it. - */ - -/** - * \struct wasm_limits_t - * \brief Limits for tables/memories in wasm modules - * \var wasm_limits_t::min - * The minimum value required. - * \var wasm_limits_t::max - * The maximum value required, or `wasm_limits_max_default` if no maximum is - * specified. - * - * \typedef wasm_limits_t - * \brief A convenience typedef to #wasm_limits_t - */ - -/** - * \struct wasm_memorytype_t - * \brief An opaque object representing the type of a memory. - * - * \typedef wasm_memorytype_t - * \brief Convenience alias for #wasm_memorytype_t - * - * \struct wasm_memorytype_vec_t - * \brief A list of #wasm_memorytype_t values. - * - * \var wasm_memorytype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_memorytype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_memorytype_vec_t - * \brief Convenience alias for #wasm_memorytype_vec_t - * - * \fn void wasm_memorytype_delete(wasm_memorytype_t *); - * \brief Deletes a type. - * - * \fn void wasm_memorytype_vec_new_empty(wasm_memorytype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_memorytype_vec_new_uninitialized(wasm_memorytype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_memorytype_vec_new(wasm_memorytype_vec_t *out, size_t, wasm_memorytype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_memorytype_vec_copy(wasm_memorytype_vec_t *out, const wasm_memorytype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_memorytype_vec_delete(wasm_memorytype_vec_t *out) - * \brief Deallocates memory for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_memorytype_t* wasm_memorytype_copy(const wasm_memorytype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_memorytype_t* wasm_memorytype_new(const wasm_limits_t *)h - * \brief Creates a new memory type. - * - * This function takes ownership of the #wasm_valtype_t argument, but does not - * take ownership of the #wasm_limits_t. - * - * The caller is responsible for deallocating the returned type. - * - * \fn const wasm_limits_t* wasm_memorytype_limits(const wasm_memorytype_t *); - * \brief Returns the limits of this memory. - * - * The returned #wasm_limits_t is owned by the #wasm_memorytype_t parameter, the - * caller should not deallocate it. - */ - -/** - * \struct wasm_externtype_t - * \brief An opaque object representing the type of a external value. Can be - * seen as a superclass of #wasm_functype_t, #wasm_tabletype_t, - * #wasm_globaltype_t, and #wasm_memorytype_t. - * - * \typedef wasm_externtype_t - * \brief Convenience alias for #wasm_externtype_t - * - * \struct wasm_externtype_vec_t - * \brief A list of #wasm_externtype_t values. - * - * \var wasm_externtype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_externtype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_externtype_vec_t - * \brief Convenience alias for #wasm_externtype_vec_t - * - * \fn void wasm_externtype_delete(wasm_externtype_t *); - * \brief Deletes a type. - * - * \fn void wasm_externtype_vec_new_empty(wasm_externtype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_externtype_vec_new_uninitialized(wasm_externtype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_externtype_vec_new(wasm_externtype_vec_t *out, size_t, wasm_externtype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_externtype_vec_copy(wasm_externtype_vec_t *out, const wasm_externtype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_externtype_vec_delete(wasm_externtype_vec_t *out) - * \brief Deallocates extern for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_externtype_t* wasm_externtype_copy(const wasm_externtype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_externkind_t wasm_externtype_kind(const wasm_externtype_t *) - * \brief Returns the kind of external item this type represents. - */ - -/** - * \typedef wasm_externkind_t - * \brief Classifier for #wasm_externtype_t - * - * This is returned from #wasm_extern_kind and #wasm_externtype_kind to - * determine what kind of type is wrapped. - */ - -/** - * \fn wasm_externtype_t* wasm_functype_as_externtype(wasm_functype_t *) - * \brief Converts a #wasm_functype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_functype_t argument and should not - * be deleted. - * - * \fn wasm_externtype_t* wasm_tabletype_as_externtype(wasm_tabletype_t *) - * \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_tabletype_t argument and should not - * be deleted. - * - * \fn wasm_externtype_t* wasm_globaltype_as_externtype(wasm_globaltype_t *) - * \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_globaltype_t argument and should not - * be deleted. - * - * \fn wasm_externtype_t* wasm_memorytype_as_externtype(wasm_memorytype_t *) - * \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_memorytype_t argument and should not - * be deleted. - * - * \fn const wasm_externtype_t* wasm_functype_as_externtype_const(const wasm_functype_t *) - * \brief Converts a #wasm_functype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_functype_t argument and should not - * be deleted. - * - * \fn const wasm_externtype_t* wasm_tabletype_as_externtype_const(const wasm_tabletype_t *) - * \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_tabletype_t argument and should not - * be deleted. - * - * \fn const wasm_externtype_t* wasm_globaltype_as_externtype_const(const wasm_globaltype_t *) - * \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_globaltype_t argument and should not - * be deleted. - * - * \fn const wasm_externtype_t* wasm_memorytype_as_externtype_const(const wasm_memorytype_t *) - * \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasm_memorytype_t argument and should not - * be deleted. - * - * \fn wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t - * - * The returned value is owned by the #wasm_functype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_functype_t. - * - * \fn wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t - * - * The returned value is owned by the #wasm_tabletype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_tabletype_t. - * - * \fn wasm_memorytype_t* wasm_externtype_as_memorytype(wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t - * - * The returned value is owned by the #wasm_memorytype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_memorytype_t. - * - * \fn wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t - * - * The returned value is owned by the #wasm_globaltype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_globaltype_t. - * - * \fn const wasm_functype_t* wasm_externtype_as_functype_const(const wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t - * - * The returned value is owned by the #wasm_functype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_functype_t. - * - * \fn const wasm_tabletype_t* wasm_externtype_as_tabletype_const(const wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t - * - * The returned value is owned by the #wasm_tabletype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_tabletype_t. - * - * \fn const wasm_memorytype_t* wasm_externtype_as_memorytype_const(const wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t - * - * The returned value is owned by the #wasm_memorytype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_memorytype_t. - * - * \fn const wasm_globaltype_t* wasm_externtype_as_globaltype_const(const wasm_externtype_t *) - * \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t - * - * The returned value is owned by the #wasm_globaltype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasm_globaltype_t. - */ - -/** - * \struct wasm_importtype_t - * \brief An opaque object representing the type of an import. - * - * \typedef wasm_importtype_t - * \brief Convenience alias for #wasm_importtype_t - * - * \struct wasm_importtype_vec_t - * \brief A list of #wasm_importtype_t values. - * - * \var wasm_importtype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_importtype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_importtype_vec_t - * \brief Convenience alias for #wasm_importtype_vec_t - * - * \fn void wasm_importtype_delete(wasm_importtype_t *); - * \brief Deletes a type. - * - * \fn void wasm_importtype_vec_new_empty(wasm_importtype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_importtype_vec_new_uninitialized(wasm_importtype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_importtype_vec_new(wasm_importtype_vec_t *out, size_t, wasm_importtype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_importtype_vec_copy(wasm_importtype_vec_t *out, const wasm_importtype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_importtype_vec_delete(wasm_importtype_vec_t *out) - * \brief Deallocates import for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_importtype_t* wasm_importtype_copy(const wasm_importtype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_importtype_t* wasm_importtype_new(wasm_name_t *module, wasm_name_t *name, wasm_externtype_t *) - * \brief Creates a new import type. - * - * This function takes ownership of the `module`, `name`, and - * #wasm_externtype_t arguments. The caller is responsible for deleting the - * returned value. Note that `name` can be `NULL` where in the module linking - * proposal the import name can be omitted. - * - * \fn const wasm_name_t* wasm_importtype_module(const wasm_importtype_t *); - * \brief Returns the module this import is importing from. - * - * The returned memory is owned by the #wasm_importtype_t argument, the caller - * should not deallocate it. - * - * \fn const wasm_name_t* wasm_importtype_name(const wasm_importtype_t *); - * \brief Returns the name this import is importing from. - * - * The returned memory is owned by the #wasm_importtype_t argument, the caller - * should not deallocate it. Note that `NULL` can be returned which means - * that the import name is not provided. This is for imports with the module - * linking proposal that only have the module specified. - * - * \fn const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t *); - * \brief Returns the type of item this import is importing. - * - * The returned memory is owned by the #wasm_importtype_t argument, the caller - * should not deallocate it. - */ - -/** - * \struct wasm_exporttype_t - * \brief An opaque object representing the type of an export. - * - * \typedef wasm_exporttype_t - * \brief Convenience alias for #wasm_exporttype_t - * - * \struct wasm_exporttype_vec_t - * \brief A list of #wasm_exporttype_t values. - * - * \var wasm_exporttype_vec_t::size - * \brief Length of this vector. - * - * \var wasm_exporttype_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_exporttype_vec_t - * \brief Convenience alias for #wasm_exporttype_vec_t - * - * \fn void wasm_exporttype_delete(wasm_exporttype_t *); - * \brief Deletes a type. - * - * \fn void wasm_exporttype_vec_new_empty(wasm_exporttype_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_exporttype_vec_new_uninitialized(wasm_exporttype_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_exporttype_vec_new(wasm_exporttype_vec_t *out, size_t, wasm_exporttype_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_exporttype_vec_copy(wasm_exporttype_vec_t *out, const wasm_exporttype_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_exporttype_vec_delete(wasm_exporttype_vec_t *out) - * \brief Deallocates export for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_exporttype_t* wasm_exporttype_copy(const wasm_exporttype_t *) - * \brief Creates a new value which matches the provided one. - * - * The caller is responsible for deleting the returned value. - * - * \fn wasm_exporttype_t* wasm_exporttype_new(wasm_name_t *name, wasm_externtype_t *) - * \brief Creates a new export type. - * - * This function takes ownership of the `name` and - * #wasm_externtype_t arguments. The caller is responsible for deleting the - * returned value. - * - * \fn const wasm_name_t* wasm_exporttype_name(const wasm_exporttype_t *); - * \brief Returns the name of this export. - * - * The returned memory is owned by the #wasm_exporttype_t argument, the caller - * should not deallocate it. - * - * \fn const wasm_externtype_t* wasm_exporttype_type(const wasm_exporttype_t *); - * \brief Returns the type of this export. - * - * The returned memory is owned by the #wasm_exporttype_t argument, the caller - * should not deallocate it. - */ - -/** - * \struct wasm_val_t - * \brief Representation of a WebAssembly value. - * - * Note that this structure is intended to represent the way to communicate - * values from the embedder to the engine. This type is not actually the - * internal representation in JIT code, for example. - * - * Also note that this is an owned value, notably the `ref` field. The - * #wasm_val_delete function does not delete the memory holding the #wasm_val_t - * itself, but only the memory pointed to by #wasm_val_t. - * - * \var wasm_val_t::kind - * \brief The kind of this value, or which of the fields in the `of` payload - * contains the actual value. - * - * \var wasm_val_t::of - * \brief The actual value of this #wasm_val_t. Only one field of this - * anonymous union is valid, and which field is valid is defined by the `kind` - * field. - * - * \var wasm_val_t::@0::i32 - * \brief value for the `WASM_I32` type - * - * \var wasm_val_t::@0::i64 - * \brief value for the `WASM_I64` type - * - * \var wasm_val_t::@0::f32 - * \brief value for the `WASM_F32` type - * - * \var wasm_val_t::@0::f64 - * \brief value for the `WASM_F64` type - * - * \var wasm_val_t::@0::ref - * \brief Unused by Wasmtime. - * - * \typedef wasm_val_t - * \brief Convenience alias for #wasm_val_t - * - * \struct wasm_val_vec_t - * \brief A list of #wasm_val_t values. - * - * \var wasm_val_vec_t::size - * \brief Length of this vector. - * - * \var wasm_val_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_val_vec_t - * \brief Convenience alias for #wasm_val_vec_t - * - * \fn void wasm_val_delete(wasm_val_t *v); - * \brief Deletes a type. - * - * This does not delete the memory pointed to by `v`, so it's safe for `v` to - * reside on the stack. Instead this only deletes the memory referenced by `v`, - * such as the `ref` variant of #wasm_val_t. - * - * \fn void wasm_val_vec_new_empty(wasm_val_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_val_vec_new_uninitialized(wasm_val_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_val_vec_new(wasm_val_vec_t *out, size_t, wasm_val_t const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_val_vec_copy(wasm_val_vec_t *out, const wasm_val_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_val_vec_delete(wasm_val_vec_t *out) - * \brief Deallocates export for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn void wasm_val_copy(wasm_val_t *out, const wasm_val_t *) - * \brief Copies a #wasm_val_t to a new one. - * - * The second argument to this function is copied to the first. The caller is - * responsible for calling #wasm_val_delete on the first argument after this - * function. The `out` parameter is assumed uninitialized by this function and - * the previous contents will not be deallocated. - */ - -/** - * \struct wasm_ref_t - * \brief A reference type: either a funcref or an externref. - * - * \typedef wasm_ref_t - * \brief Convenience alias for #wasm_ref_t - * - * \fn void wasm_ref_delete(wasm_ref_t *v); - * \brief Delete a reference. - * - * \fn wasm_ref_t *wasm_ref_copy(const wasm_ref_t *) - * \brief Copy a reference. - * - * \fn bool wasm_ref_same(const wasm_ref_t *, const wasm_ref_t *) - * \brief Are the given references pointing to the same externref? - * - * > Note: Wasmtime does not support checking funcrefs for equality, and this - * > function will always return false for funcrefs. - * - * \fn void* wasm_ref_get_host_info(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_ref_set_host_info(wasm_ref_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_ref_set_host_info_with_finalizer(wasm_ref_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - */ - -/** - * \struct wasm_frame_t - * \brief Opaque struct representing a frame of a wasm stack trace. - * - * \typedef wasm_frame_t - * \brief Convenience alias for #wasm_frame_t - * - * \struct wasm_frame_vec_t - * \brief A list of #wasm_frame_t frameues. - * - * \var wasm_frame_vec_t::size - * \brief Length of this vector. - * - * \var wasm_frame_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_frame_vec_t - * \brief Convenience alias for #wasm_frame_vec_t - * - * \fn void wasm_frame_delete(wasm_frame_t *v); - * \brief Deletes a frame. - * - * \fn void wasm_frame_vec_new_empty(wasm_frame_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_frame_vec_new_uninitialized(wasm_frame_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_frame_vec_new(wasm_frame_vec_t *out, size_t, wasm_frame_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_frame_vec_copy(wasm_frame_vec_t *out, const wasm_frame_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_frame_vec_delete(wasm_frame_vec_t *out) - * \brief Deallocates export for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_frame_t *wasm_frame_copy(const wasm_frame_t *) - * \brief Returns a copy of the provided frame. - * - * The caller is expected to call #wasm_frame_delete on the returned frame. - * - * \fn wasm_instance_t *wasm_frame_instance(const wasm_frame_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn uint32_t wasm_frame_func_index(const wasm_frame_t *); - * \brief Returns the function index in the original wasm module that this frame - * corresponds to. - * - * \fn uint32_t wasm_frame_func_offset(const wasm_frame_t *); - * \brief Returns the byte offset from the beginning of the function in the - * original wasm file to the instruction this frame points to. - * - * \fn uint32_t wasm_frame_module_offset(const wasm_frame_t *); - * \brief Returns the byte offset from the beginning of the original wasm file - * to the instruction this frame points to. - */ - -/** - * \struct wasm_trap_t - * \brief Opaque struct representing a wasm trap. - * - * \typedef wasm_trap_t - * \brief Convenience alias for #wasm_trap_t - * - * \fn void wasm_trap_delete(wasm_trap_t *v); - * \brief Deletes a trap. - * - * \fn wasm_trap_t *wasm_trap_copy(const wasm_trap_t *) - * \brief Copies a #wasm_trap_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_trap_t. - * - * \fn void wasm_trap_same(const wasm_trap_t *, const wasm_trap_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_trap_get_host_info(const wasm_trap_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_trap_set_host_info(wasm_trap_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_trap_set_host_info_with_finalizer(wasm_trap_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_trap_as_ref(wasm_trap_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_trap_t *wasm_ref_as_trap(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_trap_as_ref_const(const wasm_trap_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_trap_t *wasm_ref_as_trap_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_trap_t *wasm_trap_new(wasm_store_t *store, const wasm_message_t *); - * \brief Creates a new #wasm_trap_t with the provided message. - * - * This function will create a new trap within the given #wasm_store_t with the - * provided message. This will also capture the backtrace, if any, of wasm - * frames on the stack. - * - * Note that the #wasm_message_t argument is expected to have a 0-byte at the - * end of the message, and the length should include the trailing 0-byte. - * - * This function does not take ownership of either argument. - * - * The caller is responsible for deallocating the trap returned. - * - * \fn void wasm_trap_message(const wasm_trap_t *, wasm_message_t *out); - * \brief Retrieves the message associated with this trap. - * - * The caller takes ownership of the returned `out` value and is responsible for - * calling #wasm_byte_vec_delete on it. - * - * \fn wasm_frame_t* wasm_trap_origin(const wasm_trap_t *); - * \brief Returns the top frame of the wasm stack responsible for this trap. - * - * The caller is responsible for deallocating the returned frame. This function - * may return `NULL`, for example, for traps created when there wasn't anything - * on the wasm stack. - * - * \fn void wasm_trap_trace(const wasm_trap_t *, wasm_frame_vec_t *out); - * \brief Returns the trace of wasm frames for this trap. - * - * The caller is responsible for deallocating the returned list of frames. - * Frames are listed in order of increasing depth, with the most recently called - * function at the front of the list and the base function on the stack at the - * end. - */ - -/** - * \struct wasm_foreign_t - * \brief Unimplemented in Wasmtime - * - * \typedef wasm_foreign_t - * \brief Convenience alias for #wasm_foreign_t - * - * \fn void wasm_foreign_delete(wasm_foreign_t *v); - * \brief Unimplemented in Wasmtime, aborts the process if called - * - * \fn wasm_foreign_t *wasm_foreign_copy(const wasm_foreign_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called - * - * \fn void wasm_foreign_same(const wasm_foreign_t *, const wasm_foreign_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_foreign_get_host_info(const wasm_foreign_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_foreign_set_host_info(wasm_foreign_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_foreign_set_host_info_with_finalizer(wasm_foreign_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_foreign_as_ref(wasm_foreign_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_foreign_t *wasm_ref_as_foreign(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_foreign_as_ref_const(const wasm_foreign_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_foreign_t *wasm_ref_as_foreign_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_foreign_t *wasm_foreign_new(wasm_store_t *store); - * \brief Unimplemented in Wasmtime, aborts the process if called. - */ - -/** - * \struct wasm_module_t - * \brief Opaque struct representing a compiled wasm module. - * - * This structure is safe to send across threads in Wasmtime. - * - * \typedef wasm_module_t - * \brief Convenience alias for #wasm_module_t - * - * \struct wasm_shared_module_t - * \brief Opaque struct representing module that can be sent between threads. - * - * This structure is safe to send across threads in Wasmtime. Note that in - * Wasmtime #wasm_module_t is also safe to share across threads. - * - * \typedef wasm_shared_module_t - * \brief Convenience alias for #wasm_shared_module_t - * - * \fn void wasm_module_delete(wasm_module_t *v); - * \brief Deletes a module. - * - * \fn wasm_module_t *wasm_module_copy(const wasm_module_t *) - * \brief Copies a #wasm_module_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_module_t. - * - * \fn void wasm_module_same(const wasm_module_t *, const wasm_module_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_module_get_host_info(const wasm_module_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_module_set_host_info(wasm_module_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_module_set_host_info_with_finalizer(wasm_module_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_module_as_ref(wasm_module_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_module_t *wasm_ref_as_module(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_module_as_ref_const(const wasm_module_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_module_t *wasm_ref_as_module_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_module_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_shared_module_delete(wasm_shared_module_t *); - * \brief Deletes the provided module. - * - * \fn wasm_shared_module_t *wasm_module_share(const wasm_module_t *); - * \brief Creates a shareable module from the provided module. - * - * > Note that this API is not necessary in Wasmtime because #wasm_module_t can - * > be shared across threads. This is implemented for compatibility, however. - * - * This function does not take ownership of the argument, but the caller is - * expected to deallocate the returned #wasm_shared_module_t. - * - * \fn wasm_module_t *wasm_module_obtain(wasm_store_t *, const wasm_shared_module_t *); - * \brief Attempts to create a #wasm_module_t from the shareable module. - * - * > Note that this API is not necessary in Wasmtime because #wasm_module_t can - * > be shared across threads. This is implemented for compatibility, however. - * - * This function does not take ownership of its arguments, but the caller is - * expected to deallocate the returned #wasm_module_t. - * - * This function may fail if the engines associated with the #wasm_store_t or - * #wasm_shared_module_t are different. - * - * \fn wasm_module_t *wasm_module_new(wasm_store_t *, const wasm_byte_vec_t *binary) - * \brief Compiles a raw WebAssembly binary to a #wasm_module_t. - * - * This function will validate and compile the provided binary. The returned - * #wasm_module_t is ready for instantiation after this call returns. - * - * This function does not take ownership of its arguments, but the caller is - * expected to deallocate the returned #wasm_module_t. - * - * This function may fail if the provided binary is not a WebAssembly binary or - * if it does not pass validation. In these cases this function returns `NULL`. - * - * \fn bool wasm_module_validate(wasm_store_t *, const wasm_byte_vec_t *binary); - * \brief Validates whether a provided byte sequence is a valid wasm binary. - * - * This function will perform any internal validation necessary to determine if - * `binary` is a valid WebAssembly binary according to the configuration of the - * #wasm_store_t provided. - * - * \fn void wasm_module_imports(const wasm_module_t *, wasm_importtype_vec_t *out); - * \brief Returns the list of imports that this module expects. - * - * The list of imports returned are the types of items expected to be passed to - * #wasm_instance_new. You can use #wasm_importtype_type to learn about the - * expected type of each import. - * - * This function does not take ownership of the provided module but ownership of - * `out` is passed to the caller. Note that `out` is treated as uninitialized - * when passed to this function. - * - * \fn void wasm_module_exports(const wasm_module_t *, wasm_exporttype_vec_t *out); - * \brief Returns the list of exports that this module provides. - * - * The list of exports returned are in the same order as the items returned by - * #wasm_instance_exports. - * - * This function does not take ownership of the provided module but ownership - * of `out` is passed to the caller. Note that `out` is treated as - * uninitialized when passed to this function. - * - * \fn void wasm_module_serialize(const wasm_module_t *, wasm_byte_vec_t *out); - * \brief Serializes the provided module to a byte vector. - * - * Does not take ownership of the input module but expects the caller will - * deallocate the `out` vector. The byte vector can later be deserialized - * through #wasm_module_deserialize. - * - * \fn wasm_module_t *wasm_module_deserialize(wasm_store_t *, const wasm_byte_vec_t *); - * \brief Deserializes a previously-serialized module. - * - * The input bytes must have been created from a previous call to - * #wasm_module_serialize. - */ - -/** - * \struct wasm_func_t - * \brief Opaque struct representing a compiled wasm function. - * - * \typedef wasm_func_t - * \brief Convenience alias for #wasm_func_t - * - * \typedef wasm_func_callback_t - * \brief Type definition for functions passed to #wasm_func_new. - * - * This is the type signature of a host function created with #wasm_func_new. - * This function takes two parameters, the first of which is the list of - * parameters to the function and the second of which is where to write the - * results. This function can optionally return a #wasm_trap_t and does not have - * to fill in the results in that case. - * - * It is guaranteed that this function will be called with the appropriate - * number and types of arguments according to the function type passed to - * #wasm_func_new. It is required that this function produces the correct number - * and types of results as the original type signature. It is undefined behavior - * to return other types or different numbers of values. - * - * Ownership of the results and the trap returned, if any, is passed to the - * caller of this function. - * - * \typedef wasm_func_callback_with_env_t - * \brief Type definition for functions passed to #wasm_func_new_with_env - * - * The semantics of this function are the same as those of - * #wasm_func_callback_t, except the first argument is the same `void*` argument - * passed to #wasm_func_new_with_env. - * - * \fn void wasm_func_delete(wasm_func_t *v); - * \brief Deletes a func. - * - * \fn wasm_func_t *wasm_func_copy(const wasm_func_t *) - * \brief Copies a #wasm_func_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_func_t. - * - * \fn void wasm_func_same(const wasm_func_t *, const wasm_func_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_func_get_host_info(const wasm_func_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_func_set_host_info(wasm_func_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_func_set_host_info_with_finalizer(wasm_func_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_func_as_ref(wasm_func_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_func_t *wasm_ref_as_func(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_func_as_ref_const(const wasm_func_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_func_t *wasm_ref_as_func_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_func_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_func_t *wasm_func_new(wasm_store_t *, const wasm_functype_t *, wasm_func_callback_t); - * \brief Creates a new WebAssembly function with host functionality. - * - * This function creates a new #wasm_func_t from a host-provided function. The - * host provided function must implement the type signature matching the - * #wasm_functype_t provided here. - * - * The returned #wasm_func_t is expected to be deleted by the caller. This - * function does not take ownership of its arguments. - * - * \fn wasm_func_t *wasm_func_new_with_env( - * wasm_store_t *, - * const wasm_functype_t *type, - * wasm_func_callback_with_env_t, - * void *env, - * void (*finalizer)(void *)); - * \brief Creates a new WebAssembly function with host functionality. - * - * This function is the same as #wasm_func_new except that it the host-provided - * `env` argument is passed to each invocation of the callback provided. This - * provides a means of attaching host information to this #wasm_func_t. - * - * The `finalizer` argument will be invoked to deallocate `env` when the - * #wasm_func_t is deallocated. If this argument is `NULL` then the data - * provided will not be finalized. - * - * This function only takes ownership of the `env` argument (which is later - * deallocated automatically by calling `finalizer`). This function yields - * ownership of the returned #wasm_func_t to the caller. - * - * \fn wasm_functype_t *wasm_func_type(const wasm_func_t *); - * \brief Returns the type of this function. - * - * The returned #wasm_functype_t is expected to be deallocated by the caller. - * - * \fn size_t wasm_func_param_arity(const wasm_func_t *); - * \brief Returns the number of arguments expected by this function. - * - * \fn size_t wasm_func_result_arity(const wasm_func_t *); - * \brief Returns the number of results returned by this function. - * -* \fn wasm_trap_t *wasm_func_call(const wasm_func_t *, const wasm_val_vec_t *args, wasm_val_vec_t *results); - * \brief Calls the provided function with the arguments given. - * - * This function is used to call WebAssembly from the host. The parameter array - * provided must be valid for #wasm_func_param_arity number of arguments, and - * the result array must be valid for #wasm_func_result_arity number of results. - * Providing not enough space is undefined behavior. - * - * If any of the arguments do not have the correct type then a trap is returned. - * Additionally if any of the arguments come from a different store than - * the #wasm_func_t provided a trap is returned. - * - * When no trap happens and no errors are detected then `NULL` is returned. The - * `results` array is guaranteed to be filled in with values appropriate for - * this function's type signature. - * - * If a trap happens during execution or some other error then a non-`NULL` trap - * is returned. In this situation the `results` are is unmodified. - * - * Does not take ownership of `wasm_val_t` arguments. Gives ownership of - * `wasm_val_t` results. - */ - -/** - * \struct wasm_global_t - * \brief Opaque struct representing a wasm global. - * - * \typedef wasm_global_t - * \brief Convenience alias for #wasm_global_t - * - * \fn void wasm_global_delete(wasm_global_t *v); - * \brief Deletes a global. - * - * \fn wasm_global_t *wasm_global_copy(const wasm_global_t *) - * \brief Copies a #wasm_global_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_global_t. - * - * \fn void wasm_global_same(const wasm_global_t *, const wasm_global_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_global_get_host_info(const wasm_global_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_global_set_host_info(wasm_global_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_global_set_host_info_with_finalizer(wasm_global_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_global_as_ref(wasm_global_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_global_t *wasm_ref_as_global(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_global_as_ref_const(const wasm_global_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_global_t *wasm_ref_as_global_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_global_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_global_t *wasm_global_new(wasm_store_t *, const wasm_globaltype_t *, const wasm_val_t *); - * \brief Creates a new WebAssembly global. - * - * This function is used to create a wasm global from the host, typically to - * provide as the import of a module. The type of the global is specified along - * with the initial value. - * - * This function will return `NULL` on errors. Errors include: - * - * * The type of the global doesn't match the type of the value specified. - * * The initialization value does not come from the provided #wasm_store_t. - * - * This function does not take ownership of any of its arguments. The caller is - * expected to deallocate the returned value. - * - * \fn wasm_globaltype_t *wasm_global_type(const wasm_global_t *); - * \brief Returns the type of this global. - * - * The caller is expected to deallocate the returned #wasm_globaltype_t. - * - * \fn void wasm_global_get(const wasm_global_t *, wasm_val_t *out); - * \brief Gets the value of this global. - * - * The caller is expected to deallocate the returned #wasm_val_t. The provided - * `out` argument is treated as uninitialized on input. - * - * \fn void wasm_global_set(wasm_global_t *, const wasm_val_t *); - * \brief Sets the value of this global. - * - * This function will set the value of a global to a new value. This function - * does nothing if the global is not mutable, if the #wasm_val_t argument has - * the wrong type, or if the provided value comes from a different store as the - * #wasm_global_t. - * - * This function does not take ownership of its arguments. - */ - -/** - * \struct wasm_table_t - * \brief Opaque struct representing a wasm table. - * - * \typedef wasm_table_t - * \brief Convenience alias for #wasm_table_t - * - * \typedef wasm_table_size_t - * \brief Typedef for indices and sizes of wasm tables. - * - * \fn void wasm_table_delete(wasm_table_t *v); - * \brief Deletes a table. - * - * \fn wasm_table_t *wasm_table_copy(const wasm_table_t *) - * \brief Copies a #wasm_table_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_table_t. - * - * \fn void wasm_table_same(const wasm_table_t *, const wasm_table_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_table_get_host_info(const wasm_table_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_table_set_host_info(wasm_table_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_table_set_host_info_with_finalizer(wasm_table_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_table_as_ref(wasm_table_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_table_t *wasm_ref_as_table(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_table_as_ref_const(const wasm_table_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_table_t *wasm_ref_as_table_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_table_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_table_t *wasm_table_new(wasm_store_t *, const wasm_tabletype_t *, wasm_ref_t *init); - * \brief Creates a new WebAssembly table. - * - * Creates a new host-defined table of values. This table has the type provided - * and is filled with the provided initial value (which can be `NULL`). - * - * Returns an error if the #wasm_ref_t does not match the element type of the - * table provided or if it comes from a different store than the one provided. - * - * Does not take ownship of the `init` value. - * - * \fn wasm_tabletype_t *wasm_table_type(const wasm_table_t *); - * \brief Returns the type of this table. - * - * The caller is expected to deallocate the returned #wasm_tabletype_t. - * - * \fn wasm_ref_t *wasm_table_get(const wasm_table_t *, wasm_table_size_t index); - * \brief Gets an element from this table. - * - * Attempts to get a value at an index in this table. This function returns - * `NULL` if the index is out of bounds. - * - * Gives ownership of the resulting `wasm_ref_t*`. - * - * \fn void wasm_table_set(wasm_table_t *, wasm_table_size_t index, wasm_ref_t *); - * \brief Sets an element in this table. - * - * Attempts to set a value at an index in this table. This function does nothing - * in erroneous situations such as: - * - * * The index is out of bounds. - * * The #wasm_ref_t comes from a different store than the table provided. - * * The #wasm_ref_t does not have an appropriate type to store in this table. - * - * Does not take ownership of the given `wasm_ref_t*`. - * - * \fn wasm_table_size_t wasm_table_size(const wasm_table_t *); - * \brief Gets the current size, in elements, of this table. - * - * \fn bool wasm_table_grow(wasm_table_t *, wasm_table_size_t delta, wasm_ref_t *init); - * \brief Attempts to grow this table by `delta` elements. - * - * This function will grow the table by `delta` elements, initializing all new - * elements to the `init` value provided. - * - * If growth happens successfully, then `true` is returned. Otherwise `false` is - * returned and indicates one possible form of failure: - * - * * The table's limits do not allow growth by `delta`. - * * The #wasm_ref_t comes from a different store than the table provided. - * * The #wasm_ref_t does not have an appropriate type to store in this table. - * - * Does not take ownership of the given `init` value. - */ - -/** - * \struct wasm_memory_t - * \brief Opaque struct representing a wasm memory. - * - * \typedef wasm_memory_t - * \brief Convenience alias for #wasm_memory_t - * - * \typedef wasm_memory_pages_t - * \brief Unsigned integer to hold the number of pages a memory has. - * - * \fn void wasm_memory_delete(wasm_memory_t *v); - * \brief Deletes a memory. - * - * \fn wasm_memory_t *wasm_memory_copy(const wasm_memory_t *) - * \brief Copies a #wasm_memory_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_memory_t. - * - * \fn void wasm_memory_same(const wasm_memory_t *, const wasm_memory_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_memory_get_host_info(const wasm_memory_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_memory_set_host_info(wasm_memory_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_memory_set_host_info_with_finalizer(wasm_memory_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_memory_as_ref(wasm_memory_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_memory_t *wasm_ref_as_memory(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_memory_as_ref_const(const wasm_memory_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_memory_t *wasm_ref_as_memory_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_memory_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_memory_t *wasm_memory_new(wasm_store_t *, const wasm_memorytype_t *); - * \brief Creates a new WebAssembly memory. - * - * \fn wasm_memorytype_t *wasm_memory_type(const wasm_memory_t *); - * \brief Returns the type of this memory. - * - * The caller is expected to deallocate the returned #wasm_memorytype_t. - * - * \fn byte_t *wasm_memory_data(wasm_memory_t *); - * \brief Returns the base address, in memory, where this memory is located. - * - * Note that the returned address may change over time when growth happens. The - * returned pointer is only valid until the memory is next grown (which could - * happen in wasm itself). - * - * \fn size_t wasm_memory_data_size(const wasm_memory_t *); - * \brief Returns the size, in bytes, of this memory. - * - * \fn wasm_memory_pages_t wasm_memory_size(const wasm_memory_t *); - * \brief Returns the size, in wasm pages, of this memory. - * - * \fn bool wasm_memory_grow(wasm_memory_t *, wasm_memory_pages_t delta); - * \brief Attempts to grow this memory by `delta` wasm pages. - * - * This function is similar to the `memory.grow` instruction in wasm itself. It - * will attempt to grow the memory by `delta` wasm pages. If growth fails then - * `false` is returned, otherwise `true` is returned. - */ - -/** - * \struct wasm_extern_t - * \brief Opaque struct representing a wasm external value. - * - * \typedef wasm_extern_t - * \brief Convenience alias for #wasm_extern_t - * - * \struct wasm_extern_vec_t - * \brief A list of #wasm_extern_t values. - * - * \var wasm_extern_vec_t::size - * \brief Length of this vector. - * - * \var wasm_extern_vec_t::data - * \brief Pointer to the base of this vector - * - * \typedef wasm_extern_vec_t - * \brief Convenience alias for #wasm_extern_vec_t - * - * \fn void wasm_extern_delete(wasm_extern_t *v); - * \brief Deletes a extern. - * - * \fn void wasm_extern_vec_new_empty(wasm_extern_vec_t *out); - * \brief Creates an empty vector. - * - * See #wasm_byte_vec_new_empty for more information. - * - * \fn void wasm_extern_vec_new_uninitialized(wasm_extern_vec_t *out, size_t); - * \brief Creates a vector with the given capacity. - * - * See #wasm_byte_vec_new_uninitialized for more information. - * - * \fn void wasm_extern_vec_new(wasm_extern_vec_t *out, size_t, wasm_extern_t *const[]); - * \brief Creates a vector with the provided contents. - * - * See #wasm_byte_vec_new for more information. - * - * \fn void wasm_extern_vec_copy(wasm_extern_vec_t *out, const wasm_extern_vec_t *) - * \brief Copies one vector to another - * - * See #wasm_byte_vec_copy for more information. - * - * \fn void wasm_extern_vec_delete(wasm_extern_vec_t *out) - * \brief Deallocates import for a vector. - * - * See #wasm_byte_vec_delete for more information. - * - * \fn wasm_extern_t *wasm_extern_copy(const wasm_extern_t *) - * \brief Copies a #wasm_extern_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_extern_t. - * - * \fn void wasm_extern_same(const wasm_extern_t *, const wasm_extern_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_extern_get_host_info(const wasm_extern_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_extern_set_host_info(wasm_extern_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_extern_set_host_info_with_finalizer(wasm_extern_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_extern_as_ref(wasm_extern_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_extern_t *wasm_ref_as_extern(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_extern_as_ref_const(const wasm_extern_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_extern_t *wasm_ref_as_extern_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_extern_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_externkind_t *wasm_extern_kind(const wasm_extern_t *); - * \brief Returns the kind of this extern, indicating what it will downcast as. - * - * \fn wasm_externtype_t *wasm_extern_type(const wasm_extern_t *); - * \brief Returns the type of this extern. - * - * The caller is expected to deallocate the returned #wasm_externtype_t. - */ - -/** - * \fn wasm_extern_t *wasm_func_as_extern(wasm_func_t *f); - * \brief Converts a #wasm_func_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_func_t argument. - * - * \fn wasm_extern_t *wasm_global_as_extern(wasm_global_t *f); - * \brief Converts a #wasm_global_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_global_t argument. - * - * \fn wasm_extern_t *wasm_memory_as_extern(wasm_memory_t *f); - * \brief Converts a #wasm_memory_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_memory_t argument. - * - * \fn wasm_extern_t *wasm_table_as_extern(wasm_table_t *f); - * \brief Converts a #wasm_table_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_table_t argument. - * - * \fn const wasm_extern_t *wasm_func_as_extern_const(const wasm_func_t *f); - * \brief Converts a #wasm_func_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_func_t argument. - * - * \fn const wasm_extern_t *wasm_global_as_extern_const(const wasm_global_t *f); - * \brief Converts a #wasm_global_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_global_t argument. - * - * \fn const wasm_extern_t *wasm_memory_as_extern_const(const wasm_memory_t *f); - * \brief Converts a #wasm_memory_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_memory_t argument. - * - * \fn const wasm_extern_t *wasm_table_as_extern_const(const wasm_table_t *f); - * \brief Converts a #wasm_table_t to #wasm_extern_t. - * - * The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_table_t argument. - * - * \fn wasm_func_t *wasm_extern_as_func(wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_func_t. - * - * The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned. - * - * \fn wasm_table_t *wasm_extern_as_table(wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_table_t. - * - * The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned. - * - * \fn wasm_memory_t *wasm_extern_as_memory(wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_memory_t. - * - * The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned. - * - * \fn wasm_global_t *wasm_extern_as_global(wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_global_t. - * - * The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned. - * - * \fn const wasm_func_t *wasm_extern_as_func_const(const wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_func_t. - * - * The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned. - * - * \fn const wasm_table_t *wasm_extern_as_table_const(const wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_table_t. - * - * The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned. - * - * \fn const wasm_memory_t *wasm_extern_as_memory_const(const wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_memory_t. - * - * The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned. - * - * \fn const wasm_global_t *wasm_extern_as_global_const(const wasm_extern_t *); - * \brief Converts a #wasm_extern_t to #wasm_global_t. - * - * The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers - * should not delete the returned value, and it only lives as long as the - * #wasm_extern_t argument. - * - * If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned. - */ - -/** - * \struct wasm_instance_t - * \brief Opaque struct representing a wasm instance. - * - * \typedef wasm_instance_t - * \brief Convenience alias for #wasm_instance_t - * - * \fn void wasm_instance_delete(wasm_instance_t *v); - * \brief Deletes a instance. - * - * \fn wasm_instance_t *wasm_instance_copy(const wasm_instance_t *) - * \brief Copies a #wasm_instance_t to a new one. - * - * The caller is responsible for deleting the returned #wasm_instance_t. - * - * \fn void wasm_instance_same(const wasm_instance_t *, const wasm_instance_t *) - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void* wasm_instance_get_host_info(const wasm_instance_t *); - * \brief Unimplemented in Wasmtime, always returns `NULL`. - * - * \fn void wasm_instance_set_host_info(wasm_instance_t *, void *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn void wasm_instance_set_host_info_with_finalizer(wasm_instance_t *, void *, void(*)(void*)); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_t *wasm_instance_as_ref(wasm_instance_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_instance_t *wasm_ref_as_instance(wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_ref_t *wasm_instance_as_ref_const(const wasm_instance_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn const wasm_instance_t *wasm_ref_as_instance_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_ref_as_instance_const(const wasm_ref_t *); - * \brief Unimplemented in Wasmtime, aborts the process if called. - * - * \fn wasm_instance_t *wasm_instance_new(wasm_store_t *, const wasm_module_t *, const wasm_extern_vec_t *, wasm_trap_t **); - * \brief Instantiates a module with the provided imports. - * - * This function will instantiate the provided #wasm_module_t into the provided - * #wasm_store_t. The `imports` specified are used to satisfy the imports of the - * #wasm_module_t. - * - * This function must provide exactly the same number of imports as returned by - * #wasm_module_imports or this results in undefined behavior. - * - * Imports provided are expected to be 1:1 matches against the list returned by - * #wasm_module_imports. - * - * Instantiation includes invoking the `start` function of a wasm module. If - * that function traps then a trap is returned through the #wasm_trap_t type. - * - * This function does not take ownership of any of its arguments, and the - * returned #wasm_instance_t and #wasm_trap_t are owned by the caller. - * - * \fn void wasm_instance_exports(const wasm_instance_t *, wasm_extern_vec_t *out); - * \brief Returns the exports of an instance. - * - * This function returns a list of #wasm_extern_t values, which will be owned by - * the caller, which are exported from the instance. The `out` list will have - * the same length as #wasm_module_exports called on the original module. Each - * element is 1:1 matched with the elements in the list of #wasm_module_exports. - */ - -/** - * \def WASM_EMPTY_VEC - * \brief Used to initialize an empty vector type. - * - * \def WASM_ARRAY_VEC - * \brief Used to initialize a vector type from a C array. - * - * \def WASM_I32_VAL - * \brief Used to initialize a 32-bit integer wasm_val_t value. - * - * \def WASM_I64_VAL - * \brief Used to initialize a 64-bit integer wasm_val_t value. - * - * \def WASM_F32_VAL - * \brief Used to initialize a 32-bit floating point wasm_val_t value. - * - * \def WASM_F64_VAL - * \brief Used to initialize a 64-bit floating point wasm_val_t value. - * - * \def WASM_REF_VAL - * \brief Used to initialize an externref wasm_val_t value. - * - * \def WASM_INIT_VAL - * \brief Used to initialize a null externref wasm_val_t value. - */ diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasi.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasi.h deleted file mode 100644 index 994c66b226..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasi.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * \file wasi.h - * - * C API for WASI - */ - -#ifndef WASI_H -#define WASI_H - -#include "wasm.h" - -#ifndef WASI_API_EXTERN -#ifdef _WIN32 -#define WASI_API_EXTERN __declspec(dllimport) -#else -#define WASI_API_EXTERN -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define own - -#define WASI_DECLARE_OWN(name) \ - typedef struct wasi_##name##_t wasi_##name##_t; \ - WASI_API_EXTERN void wasi_##name##_delete(own wasi_##name##_t*); - -/** - * \typedef wasi_config_t - * \brief Convenience alias for #wasi_config_t - * - * \struct wasi_config_t - * \brief TODO - * - * \fn void wasi_config_delete(wasi_config_t *); - * \brief Deletes a configuration object. - */ -WASI_DECLARE_OWN(config) - -/** - * \brief Creates a new empty configuration object. - * - * The caller is expected to deallocate the returned configuration - */ -WASI_API_EXTERN own wasi_config_t* wasi_config_new(); - -/** - * \brief Sets the argv list for this configuration object. - * - * By default WASI programs have an empty argv list, but this can be used to - * explicitly specify what the argv list for the program is. - * - * The arguments are copied into the `config` object as part of this function - * call, so the `argv` pointer only needs to stay alive for this function call. - */ -WASI_API_EXTERN void wasi_config_set_argv(wasi_config_t* config, int argc, const char* argv[]); - -/** - * \brief Indicates that the argv list should be inherited from this process's - * argv list. - */ -WASI_API_EXTERN void wasi_config_inherit_argv(wasi_config_t* config); - -/** - * \brief Sets the list of environment variables available to the WASI instance. - * - * By default WASI programs have a blank environment, but this can be used to - * define some environment variables for them. - * - * It is required that the `names` and `values` lists both have `envc` entries. - * - * The env vars are copied into the `config` object as part of this function - * call, so the `names` and `values` pointers only need to stay alive for this - * function call. - */ -WASI_API_EXTERN void wasi_config_set_env(wasi_config_t* config, int envc, const char* names[], const char* values[]); - -/** - * \brief Indicates that the entire environment of the calling process should be - * inherited by this WASI configuration. - */ -WASI_API_EXTERN void wasi_config_inherit_env(wasi_config_t* config); - -/** - * \brief Configures standard input to be taken from the specified file. - * - * By default WASI programs have no stdin, but this configures the specified - * file to be used as stdin for this configuration. - * - * If the stdin location does not exist or it cannot be opened for reading then - * `false` is returned. Otherwise `true` is returned. - */ -WASI_API_EXTERN bool wasi_config_set_stdin_file(wasi_config_t* config, const char* path); - -/** - * \brief Configures this process's own stdin stream to be used as stdin for - * this WASI configuration. - */ -WASI_API_EXTERN void wasi_config_inherit_stdin(wasi_config_t* config); - -/** - * \brief Configures standard output to be written to the specified file. - * - * By default WASI programs have no stdout, but this configures the specified - * file to be used as stdout. - * - * If the stdout location could not be opened for writing then `false` is - * returned. Otherwise `true` is returned. - */ -WASI_API_EXTERN bool wasi_config_set_stdout_file(wasi_config_t* config, const char* path); - -/** - * \brief Configures this process's own stdout stream to be used as stdout for - * this WASI configuration. - */ -WASI_API_EXTERN void wasi_config_inherit_stdout(wasi_config_t* config); - -/** - * \brief Configures standard output to be written to the specified file. - * - * By default WASI programs have no stderr, but this configures the specified - * file to be used as stderr. - * - * If the stderr location could not be opened for writing then `false` is - * returned. Otherwise `true` is returned. - */ -WASI_API_EXTERN bool wasi_config_set_stderr_file(wasi_config_t* config, const char* path); - -/** - * \brief Configures this process's own stderr stream to be used as stderr for - * this WASI configuration. - */ -WASI_API_EXTERN void wasi_config_inherit_stderr(wasi_config_t* config); - -/** - * \brief Configures a "preopened directory" to be available to WASI APIs. - * - * By default WASI programs do not have access to anything on the filesystem. - * This API can be used to grant WASI programs access to a directory on the - * filesystem, but only that directory (its whole contents but nothing above it). - * - * The `path` argument here is a path name on the host filesystem, and - * `guest_path` is the name by which it will be known in wasm. - */ -WASI_API_EXTERN bool wasi_config_preopen_dir(wasi_config_t* config, const char* path, const char* guest_path); - -#undef own - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // #ifdef WASI_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasm.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasm.h deleted file mode 100644 index 325e618b60..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasm.h +++ /dev/null @@ -1,723 +0,0 @@ -// WebAssembly C API - -#ifndef WASM_H -#define WASM_H - -#include -#include -#include -#include -#include - -#ifndef WASM_API_EXTERN -#ifdef _WIN32 -#define WASM_API_EXTERN __declspec(dllimport) -#else -#define WASM_API_EXTERN -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////// -// Auxiliaries - -// Machine types - -inline void assertions(void) { - static_assert(sizeof(float) == sizeof(uint32_t), "incompatible float type"); - static_assert(sizeof(double) == sizeof(uint64_t), "incompatible double type"); - static_assert(sizeof(intptr_t) == sizeof(uint32_t) || - sizeof(intptr_t) == sizeof(uint64_t), - "incompatible pointer type"); -} - -typedef char byte_t; -typedef float float32_t; -typedef double float64_t; - - -// Ownership - -#define own - -// The qualifier `own` is used to indicate ownership of data in this API. -// It is intended to be interpreted similar to a `const` qualifier: -// -// - `own wasm_xxx_t*` owns the pointed-to data -// - `own wasm_xxx_t` distributes to all fields of a struct or union `xxx` -// - `own wasm_xxx_vec_t` owns the vector as well as its elements(!) -// - an `own` function parameter passes ownership from caller to callee -// - an `own` function result passes ownership from callee to caller -// - an exception are `own` pointer parameters named `out`, which are copy-back -// output parameters passing back ownership from callee to caller -// -// Own data is created by `wasm_xxx_new` functions and some others. -// It must be released with the corresponding `wasm_xxx_delete` function. -// -// Deleting a reference does not necessarily delete the underlying object, -// it merely indicates that this owner no longer uses it. -// -// For vectors, `const wasm_xxx_vec_t` is used informally to indicate that -// neither the vector nor its elements should be modified. -// TODO: introduce proper `wasm_xxx_const_vec_t`? - - -#define WASM_DECLARE_OWN(name) \ - typedef struct wasm_##name##_t wasm_##name##_t; \ - \ - WASM_API_EXTERN void wasm_##name##_delete(own wasm_##name##_t*); - - -// Vectors - -#define WASM_DECLARE_VEC(name, ptr_or_none) \ - typedef struct wasm_##name##_vec_t { \ - size_t size; \ - wasm_##name##_t ptr_or_none* data; \ - } wasm_##name##_vec_t; \ - \ - WASM_API_EXTERN void wasm_##name##_vec_new_empty(own wasm_##name##_vec_t* out); \ - WASM_API_EXTERN void wasm_##name##_vec_new_uninitialized( \ - own wasm_##name##_vec_t* out, size_t); \ - WASM_API_EXTERN void wasm_##name##_vec_new( \ - own wasm_##name##_vec_t* out, \ - size_t, own wasm_##name##_t ptr_or_none const[]); \ - WASM_API_EXTERN void wasm_##name##_vec_copy( \ - own wasm_##name##_vec_t* out, const wasm_##name##_vec_t*); \ - WASM_API_EXTERN void wasm_##name##_vec_delete(own wasm_##name##_vec_t*); - - -// Byte vectors - -typedef byte_t wasm_byte_t; -WASM_DECLARE_VEC(byte, ) - -typedef wasm_byte_vec_t wasm_name_t; - -#define wasm_name wasm_byte_vec -#define wasm_name_new wasm_byte_vec_new -#define wasm_name_new_empty wasm_byte_vec_new_empty -#define wasm_name_new_new_uninitialized wasm_byte_vec_new_uninitialized -#define wasm_name_copy wasm_byte_vec_copy -#define wasm_name_delete wasm_byte_vec_delete - -static inline void wasm_name_new_from_string( - own wasm_name_t* out, const char* s -) { - wasm_name_new(out, strlen(s), s); -} - -static inline void wasm_name_new_from_string_nt( - own wasm_name_t* out, const char* s -) { - wasm_name_new(out, strlen(s) + 1, s); -} - - -/////////////////////////////////////////////////////////////////////////////// -// Runtime Environment - -// Configuration - -WASM_DECLARE_OWN(config) - -WASM_API_EXTERN own wasm_config_t* wasm_config_new(void); - -// Embedders may provide custom functions for manipulating configs. - - -// Engine - -WASM_DECLARE_OWN(engine) - -WASM_API_EXTERN own wasm_engine_t* wasm_engine_new(void); -WASM_API_EXTERN own wasm_engine_t* wasm_engine_new_with_config(own wasm_config_t*); - - -// Store - -WASM_DECLARE_OWN(store) - -WASM_API_EXTERN own wasm_store_t* wasm_store_new(wasm_engine_t*); - - -/////////////////////////////////////////////////////////////////////////////// -// Type Representations - -// Type attributes - -typedef uint8_t wasm_mutability_t; -enum wasm_mutability_enum { - WASM_CONST, - WASM_VAR, -}; - -typedef struct wasm_limits_t { - uint32_t min; - uint32_t max; -} wasm_limits_t; - -static const uint32_t wasm_limits_max_default = 0xffffffff; - - -// Generic - -#define WASM_DECLARE_TYPE(name) \ - WASM_DECLARE_OWN(name) \ - WASM_DECLARE_VEC(name, *) \ - \ - WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_copy(const wasm_##name##_t*); - - -// Value Types - -WASM_DECLARE_TYPE(valtype) - -typedef uint8_t wasm_valkind_t; -enum wasm_valkind_enum { - WASM_I32, - WASM_I64, - WASM_F32, - WASM_F64, - WASM_ANYREF = 128, - WASM_FUNCREF, -}; - -WASM_API_EXTERN own wasm_valtype_t* wasm_valtype_new(wasm_valkind_t); - -WASM_API_EXTERN wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t*); - -static inline bool wasm_valkind_is_num(wasm_valkind_t k) { - return k < WASM_ANYREF; -} -static inline bool wasm_valkind_is_ref(wasm_valkind_t k) { - return k >= WASM_ANYREF; -} - -static inline bool wasm_valtype_is_num(const wasm_valtype_t* t) { - return wasm_valkind_is_num(wasm_valtype_kind(t)); -} -static inline bool wasm_valtype_is_ref(const wasm_valtype_t* t) { - return wasm_valkind_is_ref(wasm_valtype_kind(t)); -} - - -// Function Types - -WASM_DECLARE_TYPE(functype) - -WASM_API_EXTERN own wasm_functype_t* wasm_functype_new( - own wasm_valtype_vec_t* params, own wasm_valtype_vec_t* results); - -WASM_API_EXTERN const wasm_valtype_vec_t* wasm_functype_params(const wasm_functype_t*); -WASM_API_EXTERN const wasm_valtype_vec_t* wasm_functype_results(const wasm_functype_t*); - - -// Global Types - -WASM_DECLARE_TYPE(globaltype) - -WASM_API_EXTERN own wasm_globaltype_t* wasm_globaltype_new( - own wasm_valtype_t*, wasm_mutability_t); - -WASM_API_EXTERN const wasm_valtype_t* wasm_globaltype_content(const wasm_globaltype_t*); -WASM_API_EXTERN wasm_mutability_t wasm_globaltype_mutability(const wasm_globaltype_t*); - - -// Table Types - -WASM_DECLARE_TYPE(tabletype) - -WASM_API_EXTERN own wasm_tabletype_t* wasm_tabletype_new( - own wasm_valtype_t*, const wasm_limits_t*); - -WASM_API_EXTERN const wasm_valtype_t* wasm_tabletype_element(const wasm_tabletype_t*); -WASM_API_EXTERN const wasm_limits_t* wasm_tabletype_limits(const wasm_tabletype_t*); - - -// Memory Types - -WASM_DECLARE_TYPE(memorytype) - -WASM_API_EXTERN own wasm_memorytype_t* wasm_memorytype_new(const wasm_limits_t*); - -WASM_API_EXTERN const wasm_limits_t* wasm_memorytype_limits(const wasm_memorytype_t*); - - -// Extern Types - -WASM_DECLARE_TYPE(externtype) - -typedef uint8_t wasm_externkind_t; -enum wasm_externkind_enum { - WASM_EXTERN_FUNC, - WASM_EXTERN_GLOBAL, - WASM_EXTERN_TABLE, - WASM_EXTERN_MEMORY, -}; - -WASM_API_EXTERN wasm_externkind_t wasm_externtype_kind(const wasm_externtype_t*); - -WASM_API_EXTERN wasm_externtype_t* wasm_functype_as_externtype(wasm_functype_t*); -WASM_API_EXTERN wasm_externtype_t* wasm_globaltype_as_externtype(wasm_globaltype_t*); -WASM_API_EXTERN wasm_externtype_t* wasm_tabletype_as_externtype(wasm_tabletype_t*); -WASM_API_EXTERN wasm_externtype_t* wasm_memorytype_as_externtype(wasm_memorytype_t*); - -WASM_API_EXTERN wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t*); -WASM_API_EXTERN wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t*); -WASM_API_EXTERN wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype_t*); -WASM_API_EXTERN wasm_memorytype_t* wasm_externtype_as_memorytype(wasm_externtype_t*); - -WASM_API_EXTERN const wasm_externtype_t* wasm_functype_as_externtype_const(const wasm_functype_t*); -WASM_API_EXTERN const wasm_externtype_t* wasm_globaltype_as_externtype_const(const wasm_globaltype_t*); -WASM_API_EXTERN const wasm_externtype_t* wasm_tabletype_as_externtype_const(const wasm_tabletype_t*); -WASM_API_EXTERN const wasm_externtype_t* wasm_memorytype_as_externtype_const(const wasm_memorytype_t*); - -WASM_API_EXTERN const wasm_functype_t* wasm_externtype_as_functype_const(const wasm_externtype_t*); -WASM_API_EXTERN const wasm_globaltype_t* wasm_externtype_as_globaltype_const(const wasm_externtype_t*); -WASM_API_EXTERN const wasm_tabletype_t* wasm_externtype_as_tabletype_const(const wasm_externtype_t*); -WASM_API_EXTERN const wasm_memorytype_t* wasm_externtype_as_memorytype_const(const wasm_externtype_t*); - - -// Import Types - -WASM_DECLARE_TYPE(importtype) - -WASM_API_EXTERN own wasm_importtype_t* wasm_importtype_new( - own wasm_name_t* module, own wasm_name_t* name, own wasm_externtype_t*); - -WASM_API_EXTERN const wasm_name_t* wasm_importtype_module(const wasm_importtype_t*); -WASM_API_EXTERN const wasm_name_t* wasm_importtype_name(const wasm_importtype_t*); -WASM_API_EXTERN const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t*); - - -// Export Types - -WASM_DECLARE_TYPE(exporttype) - -WASM_API_EXTERN own wasm_exporttype_t* wasm_exporttype_new( - own wasm_name_t*, own wasm_externtype_t*); - -WASM_API_EXTERN const wasm_name_t* wasm_exporttype_name(const wasm_exporttype_t*); -WASM_API_EXTERN const wasm_externtype_t* wasm_exporttype_type(const wasm_exporttype_t*); - - -/////////////////////////////////////////////////////////////////////////////// -// Runtime Objects - -// Values - -struct wasm_ref_t; - -typedef struct wasm_val_t { - wasm_valkind_t kind; - union { - int32_t i32; - int64_t i64; - float32_t f32; - float64_t f64; - struct wasm_ref_t* ref; - } of; -} wasm_val_t; - -WASM_API_EXTERN void wasm_val_delete(own wasm_val_t* v); -WASM_API_EXTERN void wasm_val_copy(own wasm_val_t* out, const wasm_val_t*); - -WASM_DECLARE_VEC(val, ) - - -// References - -#define WASM_DECLARE_REF_BASE(name) \ - WASM_DECLARE_OWN(name) \ - \ - WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_copy(const wasm_##name##_t*); \ - WASM_API_EXTERN bool wasm_##name##_same(const wasm_##name##_t*, const wasm_##name##_t*); \ - \ - WASM_API_EXTERN void* wasm_##name##_get_host_info(const wasm_##name##_t*); \ - WASM_API_EXTERN void wasm_##name##_set_host_info(wasm_##name##_t*, void*); \ - WASM_API_EXTERN void wasm_##name##_set_host_info_with_finalizer( \ - wasm_##name##_t*, void*, void (*)(void*)); - -#define WASM_DECLARE_REF(name) \ - WASM_DECLARE_REF_BASE(name) \ - \ - WASM_API_EXTERN wasm_ref_t* wasm_##name##_as_ref(wasm_##name##_t*); \ - WASM_API_EXTERN wasm_##name##_t* wasm_ref_as_##name(wasm_ref_t*); \ - WASM_API_EXTERN const wasm_ref_t* wasm_##name##_as_ref_const(const wasm_##name##_t*); \ - WASM_API_EXTERN const wasm_##name##_t* wasm_ref_as_##name##_const(const wasm_ref_t*); - -#define WASM_DECLARE_SHARABLE_REF(name) \ - WASM_DECLARE_REF(name) \ - WASM_DECLARE_OWN(shared_##name) \ - \ - WASM_API_EXTERN own wasm_shared_##name##_t* wasm_##name##_share(const wasm_##name##_t*); \ - WASM_API_EXTERN own wasm_##name##_t* wasm_##name##_obtain(wasm_store_t*, const wasm_shared_##name##_t*); - - -WASM_DECLARE_REF_BASE(ref) - - -// Frames - -WASM_DECLARE_OWN(frame) -WASM_DECLARE_VEC(frame, *) -WASM_API_EXTERN own wasm_frame_t* wasm_frame_copy(const wasm_frame_t*); - -WASM_API_EXTERN struct wasm_instance_t* wasm_frame_instance(const wasm_frame_t*); -WASM_API_EXTERN uint32_t wasm_frame_func_index(const wasm_frame_t*); -WASM_API_EXTERN size_t wasm_frame_func_offset(const wasm_frame_t*); -WASM_API_EXTERN size_t wasm_frame_module_offset(const wasm_frame_t*); - - -// Traps - -typedef wasm_name_t wasm_message_t; // null terminated - -WASM_DECLARE_REF(trap) - -WASM_API_EXTERN own wasm_trap_t* wasm_trap_new(wasm_store_t* store, const wasm_message_t*); - -WASM_API_EXTERN void wasm_trap_message(const wasm_trap_t*, own wasm_message_t* out); -WASM_API_EXTERN own wasm_frame_t* wasm_trap_origin(const wasm_trap_t*); -WASM_API_EXTERN void wasm_trap_trace(const wasm_trap_t*, own wasm_frame_vec_t* out); - - -// Foreign Objects - -WASM_DECLARE_REF(foreign) - -WASM_API_EXTERN own wasm_foreign_t* wasm_foreign_new(wasm_store_t*); - - -// Modules - -WASM_DECLARE_SHARABLE_REF(module) - -WASM_API_EXTERN own wasm_module_t* wasm_module_new( - wasm_store_t*, const wasm_byte_vec_t* binary); - -WASM_API_EXTERN bool wasm_module_validate(wasm_store_t*, const wasm_byte_vec_t* binary); - -WASM_API_EXTERN void wasm_module_imports(const wasm_module_t*, own wasm_importtype_vec_t* out); -WASM_API_EXTERN void wasm_module_exports(const wasm_module_t*, own wasm_exporttype_vec_t* out); - -WASM_API_EXTERN void wasm_module_serialize(const wasm_module_t*, own wasm_byte_vec_t* out); -WASM_API_EXTERN own wasm_module_t* wasm_module_deserialize(wasm_store_t*, const wasm_byte_vec_t*); - - -// Function Instances - -WASM_DECLARE_REF(func) - -typedef own wasm_trap_t* (*wasm_func_callback_t)( - const wasm_val_vec_t* args, own wasm_val_vec_t* results); -typedef own wasm_trap_t* (*wasm_func_callback_with_env_t)( - void* env, const wasm_val_vec_t* args, wasm_val_vec_t* results); - -WASM_API_EXTERN own wasm_func_t* wasm_func_new( - wasm_store_t*, const wasm_functype_t*, wasm_func_callback_t); -WASM_API_EXTERN own wasm_func_t* wasm_func_new_with_env( - wasm_store_t*, const wasm_functype_t* type, wasm_func_callback_with_env_t, - void* env, void (*finalizer)(void*)); - -WASM_API_EXTERN own wasm_functype_t* wasm_func_type(const wasm_func_t*); -WASM_API_EXTERN size_t wasm_func_param_arity(const wasm_func_t*); -WASM_API_EXTERN size_t wasm_func_result_arity(const wasm_func_t*); - -WASM_API_EXTERN own wasm_trap_t* wasm_func_call( - const wasm_func_t*, const wasm_val_vec_t* args, wasm_val_vec_t* results); - - -// Global Instances - -WASM_DECLARE_REF(global) - -WASM_API_EXTERN own wasm_global_t* wasm_global_new( - wasm_store_t*, const wasm_globaltype_t*, const wasm_val_t*); - -WASM_API_EXTERN own wasm_globaltype_t* wasm_global_type(const wasm_global_t*); - -WASM_API_EXTERN void wasm_global_get(const wasm_global_t*, own wasm_val_t* out); -WASM_API_EXTERN void wasm_global_set(wasm_global_t*, const wasm_val_t*); - - -// Table Instances - -WASM_DECLARE_REF(table) - -typedef uint32_t wasm_table_size_t; - -WASM_API_EXTERN own wasm_table_t* wasm_table_new( - wasm_store_t*, const wasm_tabletype_t*, wasm_ref_t* init); - -WASM_API_EXTERN own wasm_tabletype_t* wasm_table_type(const wasm_table_t*); - -WASM_API_EXTERN own wasm_ref_t* wasm_table_get(const wasm_table_t*, wasm_table_size_t index); -WASM_API_EXTERN bool wasm_table_set(wasm_table_t*, wasm_table_size_t index, wasm_ref_t*); - -WASM_API_EXTERN wasm_table_size_t wasm_table_size(const wasm_table_t*); -WASM_API_EXTERN bool wasm_table_grow(wasm_table_t*, wasm_table_size_t delta, wasm_ref_t* init); - - -// Memory Instances - -WASM_DECLARE_REF(memory) - -typedef uint32_t wasm_memory_pages_t; - -static const size_t MEMORY_PAGE_SIZE = 0x10000; - -WASM_API_EXTERN own wasm_memory_t* wasm_memory_new(wasm_store_t*, const wasm_memorytype_t*); - -WASM_API_EXTERN own wasm_memorytype_t* wasm_memory_type(const wasm_memory_t*); - -WASM_API_EXTERN byte_t* wasm_memory_data(wasm_memory_t*); -WASM_API_EXTERN size_t wasm_memory_data_size(const wasm_memory_t*); - -WASM_API_EXTERN wasm_memory_pages_t wasm_memory_size(const wasm_memory_t*); -WASM_API_EXTERN bool wasm_memory_grow(wasm_memory_t*, wasm_memory_pages_t delta); - - -// Externals - -WASM_DECLARE_REF(extern) -WASM_DECLARE_VEC(extern, *) - -WASM_API_EXTERN wasm_externkind_t wasm_extern_kind(const wasm_extern_t*); -WASM_API_EXTERN own wasm_externtype_t* wasm_extern_type(const wasm_extern_t*); - -WASM_API_EXTERN wasm_extern_t* wasm_func_as_extern(wasm_func_t*); -WASM_API_EXTERN wasm_extern_t* wasm_global_as_extern(wasm_global_t*); -WASM_API_EXTERN wasm_extern_t* wasm_table_as_extern(wasm_table_t*); -WASM_API_EXTERN wasm_extern_t* wasm_memory_as_extern(wasm_memory_t*); - -WASM_API_EXTERN wasm_func_t* wasm_extern_as_func(wasm_extern_t*); -WASM_API_EXTERN wasm_global_t* wasm_extern_as_global(wasm_extern_t*); -WASM_API_EXTERN wasm_table_t* wasm_extern_as_table(wasm_extern_t*); -WASM_API_EXTERN wasm_memory_t* wasm_extern_as_memory(wasm_extern_t*); - -WASM_API_EXTERN const wasm_extern_t* wasm_func_as_extern_const(const wasm_func_t*); -WASM_API_EXTERN const wasm_extern_t* wasm_global_as_extern_const(const wasm_global_t*); -WASM_API_EXTERN const wasm_extern_t* wasm_table_as_extern_const(const wasm_table_t*); -WASM_API_EXTERN const wasm_extern_t* wasm_memory_as_extern_const(const wasm_memory_t*); - -WASM_API_EXTERN const wasm_func_t* wasm_extern_as_func_const(const wasm_extern_t*); -WASM_API_EXTERN const wasm_global_t* wasm_extern_as_global_const(const wasm_extern_t*); -WASM_API_EXTERN const wasm_table_t* wasm_extern_as_table_const(const wasm_extern_t*); -WASM_API_EXTERN const wasm_memory_t* wasm_extern_as_memory_const(const wasm_extern_t*); - - -// Module Instances - -WASM_DECLARE_REF(instance) - -WASM_API_EXTERN own wasm_instance_t* wasm_instance_new( - wasm_store_t*, const wasm_module_t*, const wasm_extern_vec_t* imports, - own wasm_trap_t** -); - -WASM_API_EXTERN void wasm_instance_exports(const wasm_instance_t*, own wasm_extern_vec_t* out); - - -/////////////////////////////////////////////////////////////////////////////// -// Convenience - -// Vectors - -#define WASM_EMPTY_VEC {0, NULL} -#define WASM_ARRAY_VEC(array) {sizeof(array)/sizeof(*(array)), array} - - -// Value Type construction short-hands - -static inline own wasm_valtype_t* wasm_valtype_new_i32(void) { - return wasm_valtype_new(WASM_I32); -} -static inline own wasm_valtype_t* wasm_valtype_new_i64(void) { - return wasm_valtype_new(WASM_I64); -} -static inline own wasm_valtype_t* wasm_valtype_new_f32(void) { - return wasm_valtype_new(WASM_F32); -} -static inline own wasm_valtype_t* wasm_valtype_new_f64(void) { - return wasm_valtype_new(WASM_F64); -} - -static inline own wasm_valtype_t* wasm_valtype_new_anyref(void) { - return wasm_valtype_new(WASM_ANYREF); -} -static inline own wasm_valtype_t* wasm_valtype_new_funcref(void) { - return wasm_valtype_new(WASM_FUNCREF); -} - - -// Function Types construction short-hands - -static inline own wasm_functype_t* wasm_functype_new_0_0(void) { - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new_empty(¶ms); - wasm_valtype_vec_new_empty(&results); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_1_0( - own wasm_valtype_t* p -) { - wasm_valtype_t* ps[1] = {p}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 1, ps); - wasm_valtype_vec_new_empty(&results); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_2_0( - own wasm_valtype_t* p1, own wasm_valtype_t* p2 -) { - wasm_valtype_t* ps[2] = {p1, p2}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 2, ps); - wasm_valtype_vec_new_empty(&results); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_3_0( - own wasm_valtype_t* p1, own wasm_valtype_t* p2, own wasm_valtype_t* p3 -) { - wasm_valtype_t* ps[3] = {p1, p2, p3}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 3, ps); - wasm_valtype_vec_new_empty(&results); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_0_1( - own wasm_valtype_t* r -) { - wasm_valtype_t* rs[1] = {r}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new_empty(¶ms); - wasm_valtype_vec_new(&results, 1, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_1_1( - own wasm_valtype_t* p, own wasm_valtype_t* r -) { - wasm_valtype_t* ps[1] = {p}; - wasm_valtype_t* rs[1] = {r}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 1, ps); - wasm_valtype_vec_new(&results, 1, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_2_1( - own wasm_valtype_t* p1, own wasm_valtype_t* p2, own wasm_valtype_t* r -) { - wasm_valtype_t* ps[2] = {p1, p2}; - wasm_valtype_t* rs[1] = {r}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 2, ps); - wasm_valtype_vec_new(&results, 1, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_3_1( - own wasm_valtype_t* p1, own wasm_valtype_t* p2, own wasm_valtype_t* p3, - own wasm_valtype_t* r -) { - wasm_valtype_t* ps[3] = {p1, p2, p3}; - wasm_valtype_t* rs[1] = {r}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 3, ps); - wasm_valtype_vec_new(&results, 1, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_0_2( - own wasm_valtype_t* r1, own wasm_valtype_t* r2 -) { - wasm_valtype_t* rs[2] = {r1, r2}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new_empty(¶ms); - wasm_valtype_vec_new(&results, 2, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_1_2( - own wasm_valtype_t* p, own wasm_valtype_t* r1, own wasm_valtype_t* r2 -) { - wasm_valtype_t* ps[1] = {p}; - wasm_valtype_t* rs[2] = {r1, r2}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 1, ps); - wasm_valtype_vec_new(&results, 2, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_2_2( - own wasm_valtype_t* p1, own wasm_valtype_t* p2, - own wasm_valtype_t* r1, own wasm_valtype_t* r2 -) { - wasm_valtype_t* ps[2] = {p1, p2}; - wasm_valtype_t* rs[2] = {r1, r2}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 2, ps); - wasm_valtype_vec_new(&results, 2, rs); - return wasm_functype_new(¶ms, &results); -} - -static inline own wasm_functype_t* wasm_functype_new_3_2( - own wasm_valtype_t* p1, own wasm_valtype_t* p2, own wasm_valtype_t* p3, - own wasm_valtype_t* r1, own wasm_valtype_t* r2 -) { - wasm_valtype_t* ps[3] = {p1, p2, p3}; - wasm_valtype_t* rs[2] = {r1, r2}; - wasm_valtype_vec_t params, results; - wasm_valtype_vec_new(¶ms, 3, ps); - wasm_valtype_vec_new(&results, 2, rs); - return wasm_functype_new(¶ms, &results); -} - - -// Value construction short-hands - -static inline void wasm_val_init_ptr(own wasm_val_t* out, void* p) { -#if UINTPTR_MAX == UINT32_MAX - out->kind = WASM_I32; - out->of.i32 = (intptr_t)p; -#elif UINTPTR_MAX == UINT64_MAX - out->kind = WASM_I64; - out->of.i64 = (intptr_t)p; -#endif -} - -static inline void* wasm_val_ptr(const wasm_val_t* val) { -#if UINTPTR_MAX == UINT32_MAX - return (void*)(intptr_t)val->of.i32; -#elif UINTPTR_MAX == UINT64_MAX - return (void*)(intptr_t)val->of.i64; -#endif -} - -#define WASM_I32_VAL(i) {.kind = WASM_I32, .of = {.i32 = i}} -#define WASM_I64_VAL(i) {.kind = WASM_I64, .of = {.i64 = i}} -#define WASM_F32_VAL(z) {.kind = WASM_F32, .of = {.f32 = z}} -#define WASM_F64_VAL(z) {.kind = WASM_F64, .of = {.f64 = z}} -#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .of = {.ref = r}} -#define WASM_INIT_VAL {.kind = WASM_ANYREF, .of = {.ref = NULL}} - - -/////////////////////////////////////////////////////////////////////////////// - -#undef own - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // #ifdef WASM_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime.h deleted file mode 100644 index 9d1f7219eb..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime.h +++ /dev/null @@ -1,211 +0,0 @@ -/** - * \mainpage Wasmtime C API - * - * This documentation is an overview and API reference for the C API of - * Wasmtime. The C API is spread between three different header files: - * - * * \ref wasmtime.h - * * \ref wasi.h - * * \ref wasm.h - * - * The \ref wasmtime.h header file includes all the other header files and is - * the main header file you'll likely be using. The \ref wasm.h header file - * comes directly from the - * [WebAssembly/wasm-c-api](https://github.com/WebAssembly/wasm-c-api) - * repository, and at this time the upstream header file does not have - * documentation so Wasmtime provides documentation here. It should be noted - * some semantics may be Wasmtime-specific and may not be portable to other - * engines. - * - * ## Installing the C API - * - * To install the C API from precompiled binaries you can download the - * appropriate binary from the [releases page of - * Wasmtime](https://github.com/bytecodealliance/wasmtime/releases). Artifacts - * for the C API all end in "-c-api" for the filename. - * - * Each archive contains an `include` directory with necessary headers, as well - * as a `lib` directory with both a static archive and a dynamic library of - * Wasmtime. You can link to either of them as you see fit. - * - * ## Linking against the C API - * - * You'll want to arrange the `include` directory of the C API to be in your - * compiler's header path (e.g. the `-I` flag). If you're compiling for Windows - * and you're using the static library then you'll also need to pass - * `-DWASM_API_EXTERN=` and `-DWASI_API_EXTERN=` to disable dllimport. - * - * Your final artifact can then be linked with `-lwasmtime`. If you're linking - * against the static library you may need to pass other system libraries - * depending on your platform: - * - * * Linux - `-lpthread -ldl -lm` - * * macOS - no extra flags needed - * * Windows - `ws2_32.lib advapi32.lib userenv.lib ntdll.lib shell32.lib ole32.lib` - * - * ## Building from Source - * - * The C API is located in the - * [`crates/c-api`](https://github.com/bytecodealliance/wasmtime/tree/main/crates/c-api) - * directory of the [Wasmtime - * repository](https://github.com/bytecodealliance/wasmtime). To build from - * source you'll need a Rust compiler and a checkout of the `wasmtime` project. - * Afterwards you can execute: - * - * ``` - * $ cargo build --release -p wasmtime-c-api - * ``` - * - * This will place the final artifacts in `target/release`, with names depending - * on what platform you're compiling for. - * - * ## Other resources - * - * Some other handy resources you might find useful when exploring the C API - * documentation are: - * - * * [Rust `wasmtime` crate - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/) - - * although this documentation is for Rust and not C, you'll find that many - * functions mirror one another and there may be extra documentation in Rust - * you find helpful. If you find yourself having to frequently do this, - * though, please feel free to [file an - * issue](https://github.com/bytecodealliance/wasmtime/issues/new). - * - * * [C embedding - * examples](https://bytecodealliance.github.io/wasmtime/examples-c-embed.html) - * are available online and are tested from the Wasmtime repository itself. - * - * * [Contribution documentation for - * Wasmtime](https://bytecodealliance.github.io/wasmtime/contributing.html) in - * case you're interested in helping out! - */ - -/** - * \file wasmtime.h - * - * \brief Wasmtime's C API - * - * This file is the central inclusion point for Wasmtime's C API. There are a - * number of sub-header files but this file includes them all. The C API is - * based on \ref wasm.h but there are many Wasmtime-specific APIs which are - * tailored to Wasmtime's implementation. - * - * The #wasm_config_t and #wasm_engine_t types are used from \ref wasm.h. - * Additionally all type-level information (like #wasm_functype_t) is also - * used from \ref wasm.h. Otherwise, though, all wasm objects (like - * #wasmtime_store_t or #wasmtime_func_t) are used from this header file. - * - * ### Thread Safety - * - * The multithreading story of the C API very closely follows the - * multithreading story of the Rust API for Wasmtime. All objects are safe to - * send to other threads so long as user-specific data is also safe to send to - * other threads. Functions are safe to call from any thread but some functions - * cannot be called concurrently. For example, functions which correspond to - * `&T` in Rust can be called concurrently with any other methods that take - * `&T`. Functions that take `&mut T` in Rust, however, cannot be called - * concurrently with any other function (but can still be invoked on any - * thread). - * - * This generally equates to mutation of internal state. Functions which don't - * mutate anything, such as learning type information through - * #wasmtime_func_type, can be called concurrently. Functions which do require - * mutation, for example #wasmtime_func_call, cannot be called concurrently. - * This is conveyed in the C API with either `const wasmtime_context_t*` - * (concurrency is ok as it's read-only) or `wasmtime_context_t*` (concurrency - * is not ok, mutation may happen). - * - * When in doubt assume that functions cannot be called concurrently with - * aliasing objects. - * - * ### Aliasing - * - * The C API for Wasmtime is intended to be a relatively thin layer over the - * Rust API for Wasmtime. Rust has much more strict rules about aliasing than C - * does, and the Rust API for Wasmtime is designed around these rules to be - * used safely. These same rules must be upheld when using the C API of - * Wasmtime. - * - * The main consequence of this is that the #wasmtime_context_t pointer into - * the #wasmtime_store_t must be carefully used. Since the context is an - * internal pointer into the store it must be used carefully to ensure you're - * not doing something that Rust would otherwise forbid at compile time. A - * #wasmtime_context_t can only be used when you would otherwise have been - * provided access to it. For example in a host function created with - * #wasmtime_func_new you can use #wasmtime_context_t in the host function - * callback. This is because an argument, a #wasmtime_caller_t, provides access - * to #wasmtime_context_t. On the other hand a destructor passed to - * #wasmtime_externref_new, however, cannot use a #wasmtime_context_t because - * it was not provided access to one. Doing so may lead to memory unsafety. - * - * ### Stores - * - * A foundational construct in this API is the #wasmtime_store_t. A store is a - * collection of host-provided objects and instantiated wasm modules. Stores are - * often treated as a "single unit" and items within a store are all allowed to - * reference one another. References across stores cannot currently be created. - * For example you cannot pass a function from one store into another store. - * - * A store is not intended to be a global long-lived object. Stores provide no - * means of internal garbage collections of wasm objects (such as instances), - * meaning that no memory from a store will be deallocated until you call - * #wasmtime_store_delete. If you're working with a web server, for example, - * then it's recommended to think of a store as a "one per request" sort of - * construct. Globally you'd have one #wasm_engine_t and a cache of - * #wasmtime_module_t instances compiled into that engine. Each request would - * create a new #wasmtime_store_t and then instantiate a #wasmtime_module_t - * into the store. This process of creating a store and instantiating a module - * is expected to be quite fast. When the request is finished you'd delete the - * #wasmtime_store_t keeping memory usage reasonable for the lifetime of the - * server. - */ - -#ifndef WASMTIME_API_H -#define WASMTIME_API_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Converts from the text format of WebAssembly to to the binary format. - * - * \param wat this it the input pointer with the WebAssembly Text Format inside of - * it. This will be parsed and converted to the binary format. - * \param wat_len this it the length of `wat`, in bytes. - * \param ret if the conversion is successful, this byte vector is filled in with - * the WebAssembly binary format. - * - * \return a non-null error if parsing fails, or returns `NULL`. If parsing - * fails then `ret` isn't touched. - * - * This function does not take ownership of `wat`, and the caller is expected to - * deallocate the returned #wasmtime_error_t and #wasm_byte_vec_t. - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_wat2wasm( - const char *wat, - size_t wat_len, - wasm_byte_vec_t *ret -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_API_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/config.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/config.h deleted file mode 100644 index 6c9e051f9a..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/config.h +++ /dev/null @@ -1,264 +0,0 @@ -/** - * \file wasmtime/config.h - * - * \brief Wasmtime-specific extensions to #wasm_config_t - */ - -#ifndef WASMTIME_CONFIG_H -#define WASMTIME_CONFIG_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Specifier for how Wasmtime will compile code, values are in - * #wasmtime_strategy_enum - */ -typedef uint8_t wasmtime_strategy_t; - -/** - * \brief Different ways that Wasmtime can compile WebAssembly - * - * The default value is #WASMTIME_STRATEGY_AUTO. - */ -enum wasmtime_strategy_enum { // Strategy - /// Wasmtime will automatically determine whether to use Cranelift or - /// Lightbeam, and currently it will always pick Cranelift. This default may - /// change over time though. - WASMTIME_STRATEGY_AUTO, - - /// Indicates that Cranelift will unconditionally use Cranelift to compile - /// WebAssembly code. - WASMTIME_STRATEGY_CRANELIFT, - - /// Indicates that Cranelift will unconditionally use Lightbeam to compile - /// WebAssembly code. Note that Lightbeam isn't always enabled at compile - /// time, and if that's the case an error will be returned. - WASMTIME_STRATEGY_LIGHTBEAM, -}; - -/** - * \brief Specifier of what optimization level to use for generated JIT code. - * - * See #wasmtime_opt_level_enum for possible values. - */ -typedef uint8_t wasmtime_opt_level_t; - -/** - * \brief Different ways Wasmtime can optimize generated code. - * - * The default value is #WASMTIME_OPT_LEVEL_SPEED. - */ -enum wasmtime_opt_level_enum { // OptLevel - /// Generated code will not be optimized at all. - WASMTIME_OPT_LEVEL_NONE, - /// Generated code will be optimized purely for speed. - WASMTIME_OPT_LEVEL_SPEED, - /// Generated code will be optimized, but some speed optimizations are - /// disabled if they cause the generated code to be significantly larger. - WASMTIME_OPT_LEVEL_SPEED_AND_SIZE, -}; - -/** - * \brief Different ways wasmtime can enable profiling JIT code. - * - * See #wasmtime_profiling_strategy_enum for possible values. - */ -typedef uint8_t wasmtime_profiling_strategy_t; - -/** - * \brief Different ways to profile JIT code. - * - * The default is #WASMTIME_PROFILING_STRATEGY_NONE. - */ -enum wasmtime_profiling_strategy_enum { // ProfilingStrategy - /// No profiling is enabled at runtime. - WASMTIME_PROFILING_STRATEGY_NONE, - /// Linux's "jitdump" support in `perf` is enabled and when Wasmtime is run - /// under `perf` necessary calls will be made to profile generated JIT code. - WASMTIME_PROFILING_STRATEGY_JITDUMP, - /// Support for VTune will be enabled and the VTune runtime will be informed, - /// at runtime, about JIT code. - /// - /// Note that this isn't always enabled at build time. - WASMTIME_PROFILING_STRATEGY_VTUNE, -}; - -#define WASMTIME_CONFIG_PROP(ret, name, ty) \ - WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t*, ty); - -/** - * \brief Configures whether DWARF debug information is constructed at runtime - * to describe JIT code. - * - * This setting is `false` by default. When enabled it will attempt to inform - * native debuggers about DWARF debugging information for JIT code to more - * easily debug compiled WebAssembly via native debuggers. This can also - * sometimes improve the quality of output when profiling is enabled. - */ -WASMTIME_CONFIG_PROP(void, debug_info, bool) - -/** - * \brief Enables WebAssembly code to be interrupted. - * - * This setting is `false` by default. When enabled it will enable getting an - * interrupt handle via #wasmtime_interrupt_handle_new which can be used to - * interrupt currently-executing WebAssembly code. - */ -WASMTIME_CONFIG_PROP(void, interruptable, bool) - -/** - * \brief Whether or not fuel is enabled for generated code. - * - * This setting is `false` by default. When enabled it will enable fuel counting - * meaning that fuel will be consumed every time a wasm instruction is executed, - * and trap when reaching zero. - */ -WASMTIME_CONFIG_PROP(void, consume_fuel, bool) - -/** - * \brief Configures the maximum stack size, in bytes, that JIT code can use. - * - * This setting is 2MB by default. Configuring this setting will limit the - * amount of native stack space that JIT code can use while it is executing. If - * you're hitting stack overflow you can try making this setting larger, or if - * you'd like to limit wasm programs to less stack you can also configure this. - * - * Note that this setting is not interpreted with 100% precision. Additionally - * the amount of stack space that wasm takes is always relative to the first - * invocation of wasm on the stack, so recursive calls with host frames in the - * middle will all need to fit within this setting. - */ -WASMTIME_CONFIG_PROP(void, max_wasm_stack, size_t) - -/** - * \brief Configures whether the WebAssembly threading proposal is enabled. - * - * This setting is `false` by default. - * - * Note that threads are largely unimplemented in Wasmtime at this time. - */ -WASMTIME_CONFIG_PROP(void, wasm_threads, bool) - -/** - * \brief Configures whether the WebAssembly reference types proposal is - * enabled. - * - * This setting is `false` by default. - */ -WASMTIME_CONFIG_PROP(void, wasm_reference_types, bool) - -/** - * \brief Configures whether the WebAssembly SIMD proposal is - * enabled. - * - * This setting is `false` by default. - */ -WASMTIME_CONFIG_PROP(void, wasm_simd, bool) - -/** - * \brief Configures whether the WebAssembly bulk memory proposal is - * enabled. - * - * This setting is `false` by default. - */ -WASMTIME_CONFIG_PROP(void, wasm_bulk_memory, bool) - -/** - * \brief Configures whether the WebAssembly multi value proposal is - * enabled. - * - * This setting is `true` by default. - */ -WASMTIME_CONFIG_PROP(void, wasm_multi_value, bool) - -/** - * \brief Configures whether the WebAssembly module linking proposal is - * enabled. - * - * This setting is `false` by default. - */ -WASMTIME_CONFIG_PROP(void, wasm_module_linking, bool) - -/** - * \brief Configures how JIT code will be compiled. - * - * This setting is #WASMTIME_STRATEGY_AUTO by default. - * - * If the compilation strategy selected could not be enabled then an error is - * returned. - */ -WASMTIME_CONFIG_PROP(wasmtime_error_t*, strategy, wasmtime_strategy_t) - -/** - * \brief Configures whether Cranelift's debug verifier is enabled. - * - * This setting in `false` by default. - * - * When cranelift is used for compilation this enables expensive debug checks - * within Cranelift itself to verify it's correct. - */ -WASMTIME_CONFIG_PROP(void, cranelift_debug_verifier, bool) - -/** - * \brief Configures Cranelift's optimization level for JIT code. - * - * This setting in #WASMTIME_OPT_LEVEL_SPEED by default. - */ -WASMTIME_CONFIG_PROP(void, cranelift_opt_level, wasmtime_opt_level_t) - -/** - * \brief Configures the profiling strategy used for JIT code. - * - * This setting in #WASMTIME_PROFILING_STRATEGY_NONE by default. - */ -WASMTIME_CONFIG_PROP(wasmtime_error_t*, profiler, wasmtime_profiling_strategy_t) - -/** - * \brief Configures the maximum size for memory to be considered "static" - * - * For more information see the Rust documentation at - * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html#method.static_memory_maximum_size. - */ -WASMTIME_CONFIG_PROP(void, static_memory_maximum_size, uint64_t) - -/** - * \brief Configures the guard region size for "static" memory. - * - * For more information see the Rust documentation at - * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html#method.static_memory_guard_size. - */ -WASMTIME_CONFIG_PROP(void, static_memory_guard_size, uint64_t) - -/** - * \brief Configures the guard region size for "dynamic" memory. - * - * For more information see the Rust documentation at - * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html#method.dynamic_memory_guard_size. - */ -WASMTIME_CONFIG_PROP(void, dynamic_memory_guard_size, uint64_t) - -/** - * \brief Enables Wasmtime's cache and loads configuration from the specified - * path. - * - * By default the Wasmtime compilation cache is disabled. The configuration path - * here can be `NULL` to use the default settings, and otherwise the argument - * here must be a file on the filesystem with TOML configuration - - * https://bytecodealliance.github.io/wasmtime/cli-cache.html. - * - * An error is returned if the cache configuration could not be loaded or if the - * cache could not be enabled. - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_config_cache_config_load(wasm_config_t*, const char*); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_CONFIG_H - diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/error.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/error.h deleted file mode 100644 index 2ffee72bed..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/error.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file wasmtime/error.h - * - * \brief Definition and accessors of #wasmtime_error_t - */ - -#ifndef WASMTIME_ERROR_H -#define WASMTIME_ERROR_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \typedef wasmtime_error_t - * \brief Convenience alias for #wasmtime_error - * - * \struct wasmtime_error - * \brief Errors generated by Wasmtime. - * \headerfile wasmtime/error.h - * - * This opaque type represents an error that happened as part of one of the - * functions below. Errors primarily have an error message associated with them - * at this time, which you can acquire by calling #wasmtime_error_message. - * - * Errors are safe to share across threads and must be deleted with - * #wasmtime_error_delete. - */ -typedef struct wasmtime_error wasmtime_error_t; - -/** - * \brief Deletes an error. - */ -WASM_API_EXTERN void wasmtime_error_delete(wasmtime_error_t *error); - -/** - * \brief Returns the string description of this error. - * - * This will "render" the error to a string and then return the string - * representation of the error to the caller. The `message` argument should be - * uninitialized before this function is called and the caller is responsible - * for deallocating it with #wasm_byte_vec_delete afterwards. - */ -WASM_API_EXTERN void wasmtime_error_message( - const wasmtime_error_t *error, - wasm_name_t *message -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_ERROR_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/extern.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/extern.h deleted file mode 100644 index f3369d6360..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/extern.h +++ /dev/null @@ -1,172 +0,0 @@ -/** - * \file wasmtime/extern.h - * - * \brief Definition of #wasmtime_extern_t and external items. - */ - -#ifndef WASMTIME_EXTERN_H -#define WASMTIME_EXTERN_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/// \brief Representation of a function in Wasmtime. -/// -/// Functions are represented with a 64-bit identifying integer in Wasmtime. -/// They do not have any destructor associated with them. Functions cannot -/// interoperate between #wasmtime_store_t instances and if the wrong function -/// is passed to the wrong store then it may trigger an assertion to abort the -/// process. -typedef struct wasmtime_func { - /// Internal identifier of what store this belongs to, never zero. - uint64_t store_id; - /// Internal index within the store. - size_t index; -} wasmtime_func_t; - -/// \brief Representation of a table in Wasmtime. -/// -/// Tables are represented with a 64-bit identifying integer in Wasmtime. -/// They do not have any destructor associated with them. Tables cannot -/// interoperate between #wasmtime_store_t instances and if the wrong table -/// is passed to the wrong store then it may trigger an assertion to abort the -/// process. -typedef struct wasmtime_table { - /// Internal identifier of what store this belongs to, never zero. - uint64_t store_id; - /// Internal index within the store. - size_t index; -} wasmtime_table_t; - -/// \brief Representation of a memory in Wasmtime. -/// -/// Memories are represented with a 64-bit identifying integer in Wasmtime. -/// They do not have any destructor associated with them. Memories cannot -/// interoperate between #wasmtime_store_t instances and if the wrong memory -/// is passed to the wrong store then it may trigger an assertion to abort the -/// process. -typedef struct wasmtime_memory { - /// Internal identifier of what store this belongs to, never zero. - uint64_t store_id; - /// Internal index within the store. - size_t index; -} wasmtime_memory_t; - -/// \brief Representation of a instance in Wasmtime. -/// -/// Instances are represented with a 64-bit identifying integer in Wasmtime. -/// They do not have any destructor associated with them. Instances cannot -/// interoperate between #wasmtime_store_t instances and if the wrong instance -/// is passed to the wrong store then it may trigger an assertion to abort the -/// process. -typedef struct wasmtime_instance { - /// Internal identifier of what store this belongs to, never zero. - uint64_t store_id; - /// Internal index within the store. - size_t index; -} wasmtime_instance_t; - -/// \brief Representation of a global in Wasmtime. -/// -/// Globals are represented with a 64-bit identifying integer in Wasmtime. -/// They do not have any destructor associated with them. Globals cannot -/// interoperate between #wasmtime_store_t instances and if the wrong global -/// is passed to the wrong store then it may trigger an assertion to abort the -/// process. -typedef struct wasmtime_global { - /// Internal identifier of what store this belongs to, never zero. - uint64_t store_id; - /// Internal index within the store. - size_t index; -} wasmtime_global_t; - -/// \brief Disciminant of #wasmtime_extern_t -typedef uint8_t wasmtime_extern_kind_t; - -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is a -/// function -#define WASMTIME_EXTERN_FUNC 0 -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is a -/// global -#define WASMTIME_EXTERN_GLOBAL 1 -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is a -/// table -#define WASMTIME_EXTERN_TABLE 2 -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is a -/// memory -#define WASMTIME_EXTERN_MEMORY 3 -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is -/// an instance -#define WASMTIME_EXTERN_INSTANCE 4 -/// \brief Value of #wasmtime_extern_kind_t meaning that #wasmtime_extern_t is -/// a module -#define WASMTIME_EXTERN_MODULE 5 - -/** - * \typedef wasmtime_extern_union_t - * \brief Convenience alias for #wasmtime_extern_union - * - * \union wasmtime_extern_union - * \brief Container for different kinds of extern items. - * - * This type is contained in #wasmtime_extern_t and contains the payload for the - * various kinds of items an extern wasm item can be. - */ -typedef union wasmtime_extern_union { - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_FUNC - wasmtime_func_t func; - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_GLOBAL - wasmtime_global_t global; - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_TABLE - wasmtime_table_t table; - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_MEMORY - wasmtime_memory_t memory; - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_INSTANCE - wasmtime_instance_t instance; - /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_MODULE - /// - /// Note that this may be an owned pointer depending on the ownership of the - /// #wasmtime_extern_t container value. - wasmtime_module_t *module; -} wasmtime_extern_union_t; - -/** - * \typedef wasmtime_extern_t - * \brief Convenience alias for #wasmtime_extern_t - * - * \union wasmtime_extern - * \brief Container for different kinds of extern items. - * - * Note that this structure may contain an owned value, namely - * #wasmtime_module_t, depending on the context in which this is used. APIs - * which consume a #wasmtime_extern_t do not take ownership, but APIs that - * return #wasmtime_extern_t require that #wasmtime_extern_delete is called to - * deallocate the value. - */ -typedef struct wasmtime_extern { - /// Discriminant of which field of #of is valid. - wasmtime_extern_kind_t kind; - /// Container for the extern item's value. - wasmtime_extern_union_t of; -} wasmtime_extern_t; - -/// \brief Deletes a #wasmtime_extern_t. -void wasmtime_extern_delete(wasmtime_extern_t *val); - -/// \brief Returns the type of the #wasmtime_extern_t defined within the given -/// store. -/// -/// Does not take ownership of `context` or `val`, but the returned -/// #wasm_externtype_t is an owned value that needs to be deleted. -wasm_externtype_t *wasmtime_extern_type(wasmtime_context_t *context, wasmtime_extern_t *val); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_EXTERN_H - diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/func.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/func.h deleted file mode 100644 index f254d922aa..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/func.h +++ /dev/null @@ -1,179 +0,0 @@ -/** - * \file wasmtime/func.h - * - * Wasmtime definitions of how to interact with host and wasm functions. - */ - -#ifndef WASMTIME_FUNC_H -#define WASMTIME_FUNC_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \typedef wasmtime_caller_t - * \brief Alias to #wasmtime_caller - * - * \brief Structure used to learn about the caller of a host-defined function. - * \struct wasmtime_caller - * - * This structure is an argument to #wasmtime_func_callback_t. The purpose - * of this structure is acquire a #wasmtime_context_t pointer to interact with - * objects, but it can also be used for inspect the state of the caller (such as - * getting memories and functions) with #wasmtime_caller_export_get. - * - * This object is never owned and does not need to be deleted. - */ -typedef struct wasmtime_caller wasmtime_caller_t; - -/** - * \brief Callback signature for #wasmtime_func_new. - * - * This is the function signature for host functions that can be made accessible - * to WebAssembly. The arguments to this function are: - * - * \param env user-provided argument passed to #wasmtime_func_new - * \param caller a temporary object that can only be used during this function - * call. Used to acquire #wasmtime_context_t or caller's state - * \param args the arguments provided to this function invocation - * \param nargs how many arguments are provided - * \param results where to write the results of this function - * \param nresults how many results must be produced - * - * Callbacks are guaranteed to get called with the right types of arguments, but - * they must produce the correct number and types of results. Failure to do so - * will cause traps to get raised on the wasm side. - * - * This callback can optionally return a #wasm_trap_t indicating that a trap - * should be raised in WebAssembly. It's expected that in this case the caller - * relinquishes ownership of the trap and it is passed back to the engine. - */ -typedef wasm_trap_t* (*wasmtime_func_callback_t)( - void *env, - wasmtime_caller_t* caller, - const wasmtime_val_t *args, - size_t nargs, - wasmtime_val_t *results, - size_t nresults); - -/** - * \brief Creates a new host-defined function. - * - * Inserts a host-defined function into the `store` provided which can be used - * to then instantiate a module with or define within a #wasmtime_linker_t. - * - * \param store the store in which to create the function - * \param type the wasm type of the function that's being created - * \param callback the host-defined callback to invoke - * \param env host-specific data passed to the callback invocation, can be - * `NULL` - * \param finalizer optional finalizer for `env`, can be `NULL` - * \param ret the #wasmtime_func_t return value to be filled in. - * - * The returned function can only be used with the specified `store`. - */ -WASM_API_EXTERN void wasmtime_func_new( - wasmtime_context_t *store, - const wasm_functype_t* type, - wasmtime_func_callback_t callback, - void *env, - void (*finalizer)(void*), - wasmtime_func_t *ret -); - -/** - * \brief Returns the type of the function specified - * - * The returned #wasm_functype_t is owned by the caller. - */ -WASM_API_EXTERN wasm_functype_t* wasmtime_func_type( - const wasmtime_context_t *store, - const wasmtime_func_t *func -); - -/** - * \brief Call a WebAssembly function. - * - * This function is used to invoke a function defined within a store. For - * example this might be used after extracting a function from a - * #wasmtime_instance_t. - * - * \param store the store which owns `func` - * \param func the function to call - * \param args the arguments to the function call - * \param nargs the number of arguments provided - * \param results where to write the results of the function call - * \param nresults the number of results expected - * \param trap where to store a trap, if one happens. - * - * There are three possible return states from this function: - * - * 1. The returned error is non-null. This means `results` - * wasn't written to and `trap` will have `NULL` written to it. This state - * means that programmer error happened when calling the function, for - * example when the size of the arguments/results was wrong, the types of the - * arguments were wrong, or arguments may come from the wrong store. - * 2. The trap pointer is filled in. This means the returned error is `NULL` and - * `results` was not written to. This state means that the function was - * executing but hit a wasm trap while executing. - * 3. The error and trap returned are both `NULL` and `results` are written to. - * This means that the function call succeeded and the specified results were - * produced. - * - * The `trap` pointer cannot be `NULL`. The `args` and `results` pointers may be - * `NULL` if the corresponding length is zero. - * - * Does not take ownership of #wasmtime_val_t arguments. Gives ownership of - * #wasmtime_val_t results. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_func_call( - wasmtime_context_t *store, - const wasmtime_func_t *func, - const wasmtime_val_t *args, - size_t nargs, - wasmtime_val_t *results, - size_t nresults, - wasm_trap_t **trap -); - -/** - * \brief Loads a #wasmtime_extern_t from the caller's context - * - * This function will attempt to look up the export named `name` on the caller - * instance provided. If it is found then the #wasmtime_extern_t for that is - * returned, otherwise `NULL` is returned. - * - * Note that this only works for exported memories right now for WASI - * compatibility. - * - * \param caller the caller object to look up the export from - * \param name the name that's being looked up - * \param name_len the byte length of `name` - * \param item where to store the return value - * - * Returns a nonzero value if the export was found, or 0 if the export wasn't - * found. If the export wasn't found then `item` isn't written to. - */ -WASM_API_EXTERN bool wasmtime_caller_export_get( - wasmtime_caller_t *caller, - const char *name, - size_t name_len, - wasmtime_extern_t *item -); - -/** - * \brief Returns the store context of the caller object. - */ -WASM_API_EXTERN wasmtime_context_t* wasmtime_caller_context(wasmtime_caller_t* caller); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_FUNC_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/global.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/global.h deleted file mode 100644 index 4e244285a5..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/global.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * \file wasmtime/global.h - * - * Wasmtime APIs for interacting with WebAssembly globals. - */ - -#ifndef WASMTIME_GLOBAL_H -#define WASMTIME_GLOBAL_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Creates a new global value. - * - * Creates a new host-defined global value within the provided `store` - * - * \param store the store in which to create the global - * \param type the wasm type of the global being created - * \param val the initial value of the global - * \param ret a return pointer for the created global. - * - * This function may return an error if the `val` argument does not match the - * specified type of the global, or if `val` comes from a different store than - * the one provided. - * - * This function does not take ownership of any of its arguments but error is - * owned by the caller. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_global_new( - wasmtime_context_t *store, - const wasm_globaltype_t *type, - const wasmtime_val_t *val, - wasmtime_global_t *ret -); - -/** - * \brief Returns the wasm type of the specified global. - * - * The returned #wasm_globaltype_t is owned by the caller. - */ -WASM_API_EXTERN wasm_globaltype_t* wasmtime_global_type( - const wasmtime_context_t *store, - const wasmtime_global_t *global -); - -/** - * \brief Get the value of the specified global. - * - * \param store the store that owns `global` - * \param global the global to get - * \param out where to store the value in this global. - * - * This function returns ownership of the contents of `out`, so - * #wasmtime_val_delete may need to be called on the value. - */ -WASM_API_EXTERN void wasmtime_global_get( - wasmtime_context_t *store, - const wasmtime_global_t *global, - wasmtime_val_t *out -); - -/** - * \brief Sets a global to a new value. - * - * \param store the store that owns `global` - * \param global the global to set - * \param val the value to store in the global - * - * This function may return an error if `global` is not mutable or if `val` has - * the wrong type for `global`. - * - * THis does not take ownership of any argument but returns ownership of the error. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_global_set( - wasmtime_context_t *store, - const wasmtime_global_t *global, - const wasmtime_val_t *val -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_GLOBAL_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/instance.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/instance.h deleted file mode 100644 index 6058d21701..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/instance.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * \file wasmtime/instance.h - * - * Wasmtime APIs for interacting with wasm instances. - */ - -#ifndef WASMTIME_INSTANCE_H -#define WASMTIME_INSTANCE_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief An opaque object representing the type of an instance. - */ -typedef struct wasmtime_instancetype wasmtime_instancetype_t; - -/// \brief Deletes an instance type -WASM_API_EXTERN void wasmtime_instancetype_delete(wasmtime_instancetype_t *ty); - -/** - * \brief Returns the list of exports that this instance type provides. - * - * This function does not take ownership of the provided instance type but - * ownership of `out` is passed to the caller. Note that `out` is treated as - * uninitialized when passed to this function. - */ -WASM_API_EXTERN void wasmtime_instancetype_exports(const wasmtime_instancetype_t*, wasm_exporttype_vec_t* out); - -/** - * \brief Converts a #wasmtime_instancetype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasmtime_instancetype_t argument and should not - * be deleted. - */ -WASM_API_EXTERN wasm_externtype_t* wasmtime_instancetype_as_externtype(wasmtime_instancetype_t*); - -/** - * \brief Attempts to convert a #wasm_externtype_t to a #wasmtime_instancetype_t - * - * The returned value is owned by the #wasmtime_instancetype_t argument and should not - * be deleted. Returns `NULL` if the provided argument is not a - * #wasmtime_instancetype_t. - */ -WASM_API_EXTERN wasmtime_instancetype_t* wasmtime_externtype_as_instancetype(wasm_externtype_t*); - -/** - * \brief Instantiate a wasm module. - * - * This function will instantiate a WebAssembly module with the provided - * imports, creating a WebAssembly instance. The returned instance can then - * afterwards be inspected for exports. - * - * \param store the store in which to create the instance - * \param module the module that's being instantiated - * \param imports the imports provided to the module - * \param nimports the size of `imports` - * \param instance where to store the returned instance - * \param trap where to store the returned trap - * - * This function requires that `imports` is the same size as the imports that - * `module` has. Additionally the `imports` array must be 1:1 lined up with the - * imports of the `module` specified. This is intended to be relatively low - * level, and #wasmtime_linker_instantiate is provided for a more ergonomic - * name-based resolution API. - * - * The states of return values from this function are similar to - * #wasmtime_func_call where an error can be returned meaning something like a - * link error in this context. A trap can be returned (meaning no error or - * instance is returned), or an instance can be returned (meaning no error or - * trap is returned). - * - * Note that this function requires that all `imports` specified must be owned - * by the `store` provided as well. - * - * This function does not take ownership of any of its arguments, but all return - * values are owned by the caller. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_instance_new( - wasmtime_context_t *store, - const wasmtime_module_t *module, - const wasmtime_extern_t* imports, - size_t nimports, - wasmtime_instance_t *instance, - wasm_trap_t **trap -); - -/** - * \brief Returns the type of the specified instance. - * - * The returned type is owned by the caller. - */ -WASM_API_EXTERN wasmtime_instancetype_t *wasmtime_instance_type( - const wasmtime_context_t *store, - const wasmtime_instance_t *instance -); - -/** - * \brief Get an export by name from an instance. - * - * \param store the store that owns `instance` - * \param instance the instance to lookup within - * \param name the export name to lookup - * \param name_len the byte length of `name` - * \param item where to store the returned value - * - * Returns nonzero if the export was found, and `item` is filled in. Otherwise - * returns 0. - * - * Doesn't take ownership of any arguments but does return ownership of the - * #wasmtime_extern_t. - */ -WASM_API_EXTERN bool wasmtime_instance_export_get( - wasmtime_context_t *store, - const wasmtime_instance_t *instance, - const char *name, - size_t name_len, - wasmtime_extern_t *item -); - -/** - * \brief Get an export by index from an instance. - * - * \param store the store that owns `instance` - * \param instance the instance to lookup within - * \param index the index to lookup - * \param name where to store the name of the export - * \param name_len where to store the byte length of the name - * \param item where to store the export itself - * - * Returns nonzero if the export was found, and `name`, `name_len`, and `item` - * are filled in. Otherwise returns 0. - * - * Doesn't take ownership of any arguments but does return ownership of the - * #wasmtime_extern_t. The `name` pointer return value is owned by the `store` - * and must be immediately used before calling any other APIs on - * #wasmtime_context_t. - */ -WASM_API_EXTERN bool wasmtime_instance_export_nth( - wasmtime_context_t *store, - const wasmtime_instance_t *instance, - size_t index, - char **name, - size_t *name_len, - wasmtime_extern_t *item -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_INSTANCE_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/linker.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/linker.h deleted file mode 100644 index b8793a7878..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/linker.h +++ /dev/null @@ -1,239 +0,0 @@ -/** - * \file wasmtime/linker.h - * - * Wasmtime API for a name-based linker used to instantiate modules. - */ - -#ifndef WASMTIME_LINKER_H -#define WASMTIME_LINKER_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \typedef wasmtime_linker_t - * \brief Alias to #wasmtime_linker - * - * \struct #wasmtime_linker - * \brief Object used to conveniently link together and instantiate wasm - * modules. - * - * This type corresponds to the `wasmtime::Linker` type in Rust. This - * type is intended to make it easier to manage a set of modules that link - * together, or to make it easier to link WebAssembly modules to WASI. - * - * A #wasmtime_linker_t is a higher level way to instantiate a module than - * #wasm_instance_new since it works at the "string" level of imports rather - * than requiring 1:1 mappings. - */ -typedef struct wasmtime_linker wasmtime_linker_t; - -/** - * \brief Creates a new linker for the specified engine. - * - * This function does not take ownership of the engine argument, and the caller - * is expected to delete the returned linker. - */ -WASM_API_EXTERN wasmtime_linker_t* wasmtime_linker_new(wasm_engine_t* engine); - -/** - * \brief Deletes a linker - */ -WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t* linker); - -/** - * \brief Configures whether this linker allows later definitions to shadow - * previous definitions. - * - * By default this setting is `false`. - */ -WASM_API_EXTERN void wasmtime_linker_allow_shadowing(wasmtime_linker_t* linker, bool allow_shadowing); - -/** - * \brief Defines a new item in this linker. - * - * \param linker the linker the name is being defined in. - * \param module the module name the item is defined under. - * \param module_len the byte length of `module` - * \param name the field name the item is defined under - * \param name_len the byte length of `name` - * \param item the item that is being defined in this linker. - * - * \return On success `NULL` is returned, otherwise an error is returned which - * describes why the definition failed. - * - * For more information about name resolution consult the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define( - wasmtime_linker_t *linker, - const char *module, - size_t module_len, - const char *name, - size_t name_len, - const wasmtime_extern_t *item -); - -/** - * \brief Defines WASI functions in this linker. - * - * \param linker the linker the name is being defined in. - * - * \return On success `NULL` is returned, otherwise an error is returned which - * describes why the definition failed. - * - * This function will provide WASI function names in the specified linker. Note - * that when an instance is created within a store then the store also needs to - * have its WASI settings configured with #wasmtime_context_set_wasi for WASI - * functions to work, otherwise an assert will be tripped that will abort the - * process. - * - * For more information about name resolution consult the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_wasi( - wasmtime_linker_t *linker -); - -/** - * \brief Defines an instance under the specified name in this linker. - * - * \param linker the linker the name is being defined in. - * \param store the store that owns `instance` - * \param name the module name to define `instance` under. - * \param name_len the byte length of `name` - * \param instance a previously-created instance. - * - * \return On success `NULL` is returned, otherwise an error is returned which - * describes why the definition failed. - * - * This function will take all of the exports of the `instance` provided and - * defined them under a module called `name` with a field name as the export's - * own name. - * - * For more information about name resolution consult the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_instance( - wasmtime_linker_t *linker, - wasmtime_context_t *store, - const char *name, - size_t name_len, - const wasmtime_instance_t *instance -); - -/** - * \brief Instantiates a #wasm_module_t with the items defined in this linker. - * - * \param linker the linker used to instantiate the provided module. - * \param store the store that is used to instantiate within - * \param module the module that is being instantiated. - * \param instance the returned instance, if successful. - * \param trap a trap returned, if the start function traps. - * - * \return One of three things can happen as a result of this function. First - * the module could be successfully instantiated and returned through - * `instance`, meaning the return value and `trap` are both set to `NULL`. - * Second the start function may trap, meaning the return value and `instance` - * are set to `NULL` and `trap` describes the trap that happens. Finally - * instantiation may fail for another reason, in which case an error is returned - * and `trap` and `instance` are set to `NULL`. - * - * This function will attempt to satisfy all of the imports of the `module` - * provided with items previously defined in this linker. If any name isn't - * defined in the linker than an error is returned. (or if the previously - * defined item is of the wrong type). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_instantiate( - const wasmtime_linker_t *linker, - wasmtime_context_t *store, - const wasmtime_module_t *module, - wasmtime_instance_t *instance, - wasm_trap_t **trap -); - -/** - * \brief Defines automatic instantiations of a #wasm_module_t in this linker. - * - * \param linker the linker the module is being added to - * \param store the store that is used to instantiate `module` - * \param name the name of the module within the linker - * \param name_len the byte length of `name` - * \param module the module that's being instantiated - * - * \return An error if the module could not be instantiated or added or `NULL` - * on success. - * - * This function automatically handles [Commands and - * Reactors](https://github.com/WebAssembly/WASI/blob/master/design/application-abi.md#current-unstable-abi) - * instantiation and initialization. - * - * For more information see the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#method.module). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_module( - wasmtime_linker_t *linker, - wasmtime_context_t *store, - const char *name, - size_t name_len, - const wasmtime_module_t *module -); - -/** - * \brief Acquires the "default export" of the named module in this linker. - * - * \param linker the linker to load from - * \param store the store to load a function into - * \param name the name of the module to get the default export for - * \param name_len the byte length of `name` - * \param func where to store the extracted default function. - * - * \return An error is returned if the default export could not be found, or - * `NULL` is returned and `func` is filled in otherwise. - * - * For more information see the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#method.get_default). - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_get_default( - const wasmtime_linker_t *linker, - wasmtime_context_t *store, - const char *name, - size_t name_len, - wasmtime_func_t *func -); - -/** - * \brief Loads an item by name from this linker. - * - * \param linker the linker to load from - * \param store the store to load the item into - * \param module the name of the module to get - * \param module_len the byte length of `module` - * \param name the name of the field to get - * \param name_len the byte length of `name` - * \param item where to store the extracted item - * - * \return A nonzero value if the item is defined, in which case `item` is also - * filled in. Otherwise zero is returned. - */ -WASM_API_EXTERN bool wasmtime_linker_get( - const wasmtime_linker_t *linker, - wasmtime_context_t *store, - const char *module, - size_t module_len, - const char *name, - size_t name_len, - wasmtime_extern_t *item -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_LINKER_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/memory.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/memory.h deleted file mode 100644 index 173639b747..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/memory.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * \file wasmtime/memory.h - * - * Wasmtime API for interacting with wasm memories. - */ - -#ifndef WASMTIME_MEMORY_H -#define WASMTIME_MEMORY_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Creates a new WebAssembly linear memory - * - * \param store the store to create the memory within - * \param ty the type of the memory to create - * \param ret where to store the returned memory - * - * If an error happens when creating the memory it's returned and owned by the - * caller. If an error happens then `ret` is not filled in. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_memory_new( - wasmtime_context_t *store, - const wasm_memorytype_t* ty, - wasmtime_memory_t *ret -); - -/** - * \brief Returns the tyep of the memory specified - */ -WASM_API_EXTERN wasm_memorytype_t* wasmtime_memory_type( - const wasmtime_context_t *store, - const wasmtime_memory_t *memory -); - -/** - * \brief Returns the base pointer in memory where the linear memory starts. - */ -WASM_API_EXTERN uint8_t *wasmtime_memory_data( - const wasmtime_context_t *store, - const wasmtime_memory_t *memory -); - -/** - * \brief Returns the byte length of this linear memory. - */ -WASM_API_EXTERN size_t wasmtime_memory_data_size( - const wasmtime_context_t *store, - const wasmtime_memory_t *memory -); - -/** - * \brief Returns the length, in WebAssembly pages, of this linear memory - */ -WASM_API_EXTERN uint32_t wasmtime_memory_size( - const wasmtime_context_t *store, - const wasmtime_memory_t *memory -); - -/** - * \brief Attempts to grow the specified memory by `delta` pages. - * - * \param store the store that owns `memory` - * \param memory the memory to grow - * \param delta the number of pages to grow by - * \param prev_size where to store the previous size of memory - * - * If memory cannot be grown then `prev_size` is left unchanged and an error is - * returned. Otherwise `prev_size` is set to the previous size of the memory, in - * WebAssembly pages, and `NULL` is returned. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_memory_grow( - wasmtime_context_t *store, - const wasmtime_memory_t *memory, - uint32_t delta, - uint32_t *prev_size -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_MEMORY_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/module.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/module.h deleted file mode 100644 index c5e6e1a5de..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/module.h +++ /dev/null @@ -1,172 +0,0 @@ -/** - * \file wasmtime/module.h - * - * APIs for interacting with modules in Wasmtime - */ - -#ifndef WASMTIME_MODULE_H -#define WASMTIME_MODULE_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief An opaque object representing the type of a module. - */ -typedef struct wasmtime_moduletype wasmtime_moduletype_t; - -/** - * \brief Deletes a module type. - */ -WASM_API_EXTERN void wasmtime_moduletype_delete(wasmtime_moduletype_t *ty); - -/** - * \brief Returns the list of imports that this module type requires. - * - * This function does not take ownership of the provided module type but - * ownership of `out` is passed to the caller. Note that `out` is treated as - * uninitialized when passed to this function. - */ -WASM_API_EXTERN void wasmtime_moduletype_imports(const wasmtime_moduletype_t*, wasm_importtype_vec_t* out); - -/** - * \brief Returns the list of exports that this module type provides. - * - * This function does not take ownership of the provided module type but - * ownership of `out` is passed to the caller. Note that `out` is treated as - * uninitialized when passed to this function. - */ -WASM_API_EXTERN void wasmtime_moduletype_exports(const wasmtime_moduletype_t*, wasm_exporttype_vec_t* out); - -/** - * \brief Converts a #wasmtime_moduletype_t to a #wasm_externtype_t - * - * The returned value is owned by the #wasmtime_moduletype_t argument and should not - * be deleted. - */ -WASM_API_EXTERN wasm_externtype_t* wasmtime_moduletype_as_externtype(wasmtime_moduletype_t*); - -/** - * \brief Attempts to convert a #wasm_externtype_t to a #wasmtime_moduletype_t - * - * The returned value is owned by the #wasmtime_moduletype_t argument and - * should not be deleted. Returns `NULL` if the provided argument is not a - * #wasmtime_moduletype_t. - */ -WASM_API_EXTERN wasmtime_moduletype_t* wasmtime_externtype_as_moduletype(wasm_externtype_t*); - -/** - * \typedef wasmtime_module_t - * \brief Convenience alias for #wasmtime_module - * - * \struct wasmtime_module - * \brief A compiled Wasmtime module. - * - * This type represents a compiled WebAssembly module. The compiled module is - * ready to be instantiated and can be inspected for imports/exports. It is safe - * to use a module across multiple threads simultaneously. - */ -typedef struct wasmtime_module wasmtime_module_t; - -/** - * \brief Compiles a WebAssembly binary into a #wasmtime_module_t - * - * This function will compile a WebAssembly binary into an owned #wasm_module_t. - * This performs the same as #wasm_module_new except that it returns a - * #wasmtime_error_t type to get richer error information. - * - * On success the returned #wasmtime_error_t is `NULL` and the `ret` pointer is - * filled in with a #wasm_module_t. On failure the #wasmtime_error_t is - * non-`NULL` and the `ret` pointer is unmodified. - * - * This function does not take ownership of any of its arguments, but the - * returned error and module are owned by the caller. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_module_new( - wasm_engine_t *engine, - const uint8_t *wasm, - size_t wasm_len, - wasmtime_module_t **ret -); - -/** - * \brief Deletes a module. - */ -WASM_API_EXTERN void wasmtime_module_delete(wasmtime_module_t *m); - -/** - * \brief Creates a shallow clone of the specified module, increasing the - * internal reference count. - */ -WASM_API_EXTERN wasmtime_module_t *wasmtime_module_clone(wasmtime_module_t *m); - -/** - * \brief Validate a WebAssembly binary. - * - * This function will validate the provided byte sequence to determine if it is - * a valid WebAssembly binary within the context of the engine provided. - * - * This function does not take ownership of its arguments but the caller is - * expected to deallocate the returned error if it is non-`NULL`. - * - * If the binary validates then `NULL` is returned, otherwise the error returned - * describes why the binary did not validate. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_module_validate( - wasm_engine_t *engine, - const uint8_t *wasm, - size_t wasm_len -); - -/** - * \brief Returns the type of this module. - * - * The returned #wasmtime_moduletype_t is expected to be deallocated by the - * caller. - */ -WASM_API_EXTERN wasmtime_moduletype_t* wasmtime_module_type(const wasmtime_module_t*); - -/** - * \brief This function serializes compiled module artifacts as blob data. - * - * \param module the module - * \param ret if the conversion is successful, this byte vector is filled in with - * the serialized compiled module. - * - * \return a non-null error if parsing fails, or returns `NULL`. If parsing - * fails then `ret` isn't touched. - * - * This function does not take ownership of `module`, and the caller is - * expected to deallocate the returned #wasmtime_error_t and #wasm_byte_vec_t. - */ -WASM_API_EXTERN wasmtime_error_t* wasmtime_module_serialize( - wasmtime_module_t* module, - wasm_byte_vec_t *ret -); - -/** - * \brief Build a module from serialized data. - * - * This function does not take ownership of any of its arguments, but the - * returned error and module are owned by the caller. - * - * This function is not safe to receive arbitrary user input. See the Rust - * documentation for more information on what inputs are safe to pass in here - * (e.g. only that of #wasmtime_module_serialize) - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize( - wasm_engine_t *engine, - const uint8_t *bytes, - size_t bytes_len, - wasmtime_module_t **ret -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_MODULE_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/store.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/store.h deleted file mode 100644 index e4e76173ee..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/store.h +++ /dev/null @@ -1,203 +0,0 @@ -/** - * \file wasmtime/store.h - * - * Wasmtime definition of a "store". - */ - -#ifndef WASMTIME_STORE_H -#define WASMTIME_STORE_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \typedef wasmtime_store_t - * \brief Convenience alias for #wasmtime_store_t - * - * \struct wasmtime_store - * \brief Storage of WebAssembly objects - * - * A store is the unit of isolation between WebAssembly instances in an - * embedding of Wasmtime. Values in one #wasmtime_store_t cannot flow into - * another #wasmtime_store_t. Stores are cheap to create and cheap to dispose. - * It's expected that one-off stores are common in embeddings. - * - * Objects stored within a #wasmtime_store_t are referenced with integer handles - * rather than interior pointers. This means that most APIs require that the - * store be explicitly passed in, which is done via #wasmtime_context_t. It is - * safe to move a #wasmtime_store_t to any thread at any time. A store generally - * cannot be concurrently used, however. - */ -typedef struct wasmtime_store wasmtime_store_t; - -/** - * \typedef wasmtime_context_t - * \brief Convenience alias for #wasmtime_context - * - * \struct wasmtime_context - * \brief An interior pointer into a #wasmtime_store_t which is used as - * "context" for many functions. - * - * This context pointer is used pervasively throught Wasmtime's API. This can be - * acquired from #wasmtime_store_context or #wasmtime_caller_context. The - * context pointer for a store is the same for the entire lifetime of a store, - * so it can safely be stored adjacent to a #wasmtime_store_t itself. - * - * Usage of a #wasmtime_context_t must not outlive the original - * #wasmtime_store_t. Additionally #wasmtime_context_t can only be used in - * situations where it has explicitly been granted access to doing so. For - * example finalizers cannot use #wasmtime_context_t because they are not given - * access to it. - */ -typedef struct wasmtime_context wasmtime_context_t; - -/** - * \brief Creates a new store within the specified engine. - * - * \param engine the compilation environment with configuration this store is - * connected to - * \param data user-provided data to store, can later be acquired with - * #wasmtime_context_get_data. - * \param finalizer an optional finalizer for `data` - * - * This function creates a fresh store with the provided configuration settings. - * The returned store must be deleted with #wasmtime_store_delete. - */ -WASM_API_EXTERN wasmtime_store_t *wasmtime_store_new( - wasm_engine_t *engine, - void *data, - void (*finalizer)(void*) -); - -/** - * \brief Returns the interior #wasmtime_context_t pointer to this store - */ -WASM_API_EXTERN wasmtime_context_t *wasmtime_store_context(wasmtime_store_t *store); - -/** - * \brief Deletes a store. - */ -WASM_API_EXTERN void wasmtime_store_delete(wasmtime_store_t *store); - -/** - * \brief Returns the user-specified data associated with the specified store - */ -WASM_API_EXTERN void *wasmtime_context_get_data(const wasmtime_context_t* context); - -/** - * \brief Overwrites the user-specified data associated with this store. - * - * Note that this does not execute the original finalizer for the provided data, - * and the original finalizer will be executed for the provided data when the - * store is deleted. - */ -WASM_API_EXTERN void wasmtime_context_set_data(wasmtime_context_t* context, void *data); - -/** - * \brief Perform garbage collection within the given context. - * - * Garbage collects `externref`s that are used within this store. Any - * `externref`s that are discovered to be unreachable by other code or objects - * will have their finalizers run. - * - * The `context` argument must not be NULL. - */ -WASM_API_EXTERN void wasmtime_context_gc(wasmtime_context_t* context); - -/** - * \brief Adds fuel to this context's store for wasm to consume while executing. - * - * For this method to work fuel consumption must be enabled via - * #wasmtime_config_consume_fuel_set. By default a store starts with 0 fuel - * for wasm to execute with (meaning it will immediately trap). - * This function must be called for the store to have - * some fuel to allow WebAssembly to execute. - * - * Note that at this time when fuel is entirely consumed it will cause - * wasm to trap. More usages of fuel are planned for the future. - * - * If fuel is not enabled within this store then an error is returned. If fuel - * is successfully added then NULL is returned. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_context_add_fuel(wasmtime_context_t *store, uint64_t fuel); - -/** - * \brief Returns the amount of fuel consumed by this context's store execution - * so far. - * - * If fuel consumption is not enabled via #wasmtime_config_consume_fuel_set - * then this function will return false. Otherwise true is returned and the - * fuel parameter is filled in with fuel consuemd so far. - * - * Also note that fuel, if enabled, must be originally configured via - * #wasmtime_context_add_fuel. - */ -WASM_API_EXTERN bool wasmtime_context_fuel_consumed(const wasmtime_context_t *context, uint64_t *fuel); - -/** - * \brief Configres WASI state within the specified store. - * - * This function is required if #wasmtime_linker_define_wasi is called. This - * will configure the WASI state for instances defined within this store to the - * configuration specified. - * - * This function does not take ownership of `context` but it does take ownership - * of `wasi`. The caller should no longer use `wasi` after calling this function - * (even if an error is returned). - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_context_set_wasi(wasmtime_context_t *context, wasi_config_t *wasi); - -/** - * \typedef wasmtime_interrupt_handle_t - * \brief Convenience alias for #wasmtime_interrupt_handle_t - * - * \struct wasmtime_interrupt_handle_t - * \brief A handle used to interrupt executing WebAssembly code. - * - * This structure is an opaque handle that represents a handle to a store. This - * handle can be used to remotely (from another thread) interrupt currently - * executing WebAssembly code. - * - * This structure is safe to share from multiple threads. - */ -typedef struct wasmtime_interrupt_handle wasmtime_interrupt_handle_t; - -/** - * \brief Creates a new interrupt handle to interrupt executing WebAssembly from - * the provided store. - * - * There are a number of caveats about how interrupt is handled in Wasmtime. For - * more information see the [Rust - * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Store.html#method.interrupt_handle). - * - * This function returns `NULL` if the store's configuration does not have - * interrupts enabled. See #wasmtime_config_interruptable_set. - */ -WASM_API_EXTERN wasmtime_interrupt_handle_t *wasmtime_interrupt_handle_new(wasmtime_context_t *context); - -/** - * \brief Requests that WebAssembly code running in the store attached to this - * interrupt handle is interrupted. - * - * For more information about interrupts see #wasmtime_interrupt_handle_new. - * - * Note that this is safe to call from any thread. - */ -WASM_API_EXTERN void wasmtime_interrupt_handle_interrupt(wasmtime_interrupt_handle_t *handle); - -/** - * \brief Deletes an interrupt handle. - */ -WASM_API_EXTERN void wasmtime_interrupt_handle_delete(wasmtime_interrupt_handle_t *handle); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_STORE_H - diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/table.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/table.h deleted file mode 100644 index 630cee9eca..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/table.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * \file wasmtime/table.h - * - * Wasmtime APIs for interacting with WebAssembly tables. - */ - -#ifndef WASMTIME_TABLE_H -#define WASMTIME_TABLE_H - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Creates a new host-defined wasm table. - * - * \param store the store to create the table within - * \param ty the type of the table to create - * \param init the initial value for this table's elements - * \param table where to store the returned table - * - * This function does not take ownership of any of its parameters, but yields - * ownership of returned error. This function may return an error if the `init` - * value does not match `ty`, for example. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_table_new( - wasmtime_context_t *store, - const wasm_tabletype_t *ty, - const wasmtime_val_t *init, - wasmtime_table_t *table -); - -/** - * \brief Returns the type of this table. - * - * The caller has ownership of the returned #wasm_tabletype_t - */ -WASM_API_EXTERN wasm_tabletype_t* wasmtime_table_type( - const wasmtime_context_t *store, - const wasmtime_table_t *table -); - -/** - * \brief Gets a value in a table. - * - * \param store the store that owns `table` - * \param table the table to access - * \param index the table index to access - * \param val where to store the table's value - * - * This function will attempt to access a table element. If a nonzero value is - * returned then `val` is filled in and is owned by the caller. Otherwise zero - * is returned because the `index` is out-of-bounds. - */ -WASM_API_EXTERN bool wasmtime_table_get( - wasmtime_context_t *store, - const wasmtime_table_t *table, - uint32_t index, - wasmtime_val_t *val -); - -/** - * \brief Sets a value in a table. - * - * \param store the store that owns `table` - * \param table the table to write to - * \param index the table index to write - * \param value the value to store. - * - * This function will store `value` into the specified index in the table. This - * does not take ownership of any argument but yields ownership of the error. - * This function can fail if `value` has the wrong type for the table, or if - * `index` is out of bounds. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_table_set( - wasmtime_context_t *store, - const wasmtime_table_t *table, - uint32_t index, - const wasmtime_val_t *value -); - -/** - * \brief Returns the size, in elements, of the specified table - */ -WASM_API_EXTERN uint32_t wasmtime_table_size( - const wasmtime_context_t *store, - const wasmtime_table_t *table -); - -/** - * \brief Grows a table. - * - * \param store the store that owns `table` - * \param table the table to grow - * \param delta the number of elements to grow the table by - * \param init the initial value for new table element slots - * \param prev_size where to store the previous size of the table before growth - * - * This function will attempt to grow the table by `delta` table elements. This - * can fail if `delta` would exceed the maximum size of the table or if `init` - * is the wrong type for this table. If growth is successful then `NULL` is - * returned and `prev_size` is filled in with the previous size of the table, in - * elements, before the growth happened. - * - * This function does not take ownership of any of its arguments. - */ -WASM_API_EXTERN wasmtime_error_t *wasmtime_table_grow( - wasmtime_context_t *store, - const wasmtime_table_t *table, - uint32_t delta, - const wasmtime_val_t *init, - uint32_t *prev_size -); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_TABLE_H - diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/trap.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/trap.h deleted file mode 100644 index 2ad0800f0a..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/trap.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * \file wasmtime/trap.h - * - * Wasmtime APIs for interacting with traps and extensions to #wasm_trap_t. - */ - -#ifndef WASMTIME_TRAP_H -#define WASMTIME_TRAP_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief Creates a new trap. - * - * \param msg the message to associate with this trap - * \param msg_len the byte length of `msg` - * - * The #wasm_trap_t returned is owned by the caller. - */ -WASM_API_EXTERN wasm_trap_t *wasmtime_trap_new(const char *msg, size_t msg_len); - -/** - * \brief Attempts to extract a WASI-specific exit status from this trap. - * - * Returns `true` if the trap is a WASI "exit" trap and has a return status. If - * `true` is returned then the exit status is returned through the `status` - * pointer. If `false` is returned then this is not a wasi exit trap. - */ -WASM_API_EXTERN bool wasmtime_trap_exit_status(const wasm_trap_t*, int *status); - -/** - * \brief Returns a human-readable name for this frame's function. - * - * This function will attempt to load a human-readable name for function this - * frame points to. This function may return `NULL`. - * - * The lifetime of the returned name is the same as the #wasm_frame_t itself. - */ -WASM_API_EXTERN const wasm_name_t *wasmtime_frame_func_name(const wasm_frame_t*); - -/** - * \brief Returns a human-readable name for this frame's module. - * - * This function will attempt to load a human-readable name for module this - * frame points to. This function may return `NULL`. - * - * The lifetime of the returned name is the same as the #wasm_frame_t itself. - */ -WASM_API_EXTERN const wasm_name_t *wasmtime_frame_module_name(const wasm_frame_t*); - - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_TRAP_H diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/val.h b/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/val.h deleted file mode 100644 index 43b40ff77e..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/build/include/wasmtime/val.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * \file wasmtime/val.h - * - * APIs for interacting with WebAssembly values in Wasmtime. - */ - -#ifndef WASMTIME_VAL_H -#define WASMTIME_VAL_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \typedef wasmtime_externref_t - * \brief Convenience alias for #wasmtime_externref - * - * \struct wasmtime_externref - * \brief A host-defined un-forgeable reference to pass into WebAssembly. - * - * This structure represents an `externref` that can be passed to WebAssembly. - * It cannot be forged by WebAssembly itself and is guaranteed to have been - * created by the host. - */ -typedef struct wasmtime_externref wasmtime_externref_t; - -/** - * \brief Create a new `externref` value. - * - * Creates a new `externref` value wrapping the provided data, returning the - * pointer to the externref. - * - * \param data the host-specific data to wrap - * \param finalizer an optional finalizer for `data` - * - * When the reference is reclaimed, the wrapped data is cleaned up with the - * provided `finalizer`. - * - * The returned value must be deleted with #wasmtime_externref_delete - */ -WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_new(void *data, void (*finalizer)(void*)); - -/** - * \brief Get an `externref`'s wrapped data - * - * Returns the original `data` passed to #wasmtime_externref_new. It is required - * that `data` is not `NULL`. - */ -WASM_API_EXTERN void *wasmtime_externref_data(wasmtime_externref_t *data); - -/** - * \brief Creates a shallow copy of the `externref` argument, returning a - * separately owned pointer (increases the reference count). - */ -WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_clone(wasmtime_externref_t *ref); - -/** - * \brief Decrements the reference count of the `ref`, deleting it if it's the - * last reference. - */ -WASM_API_EXTERN void wasmtime_externref_delete(wasmtime_externref_t *ref); - -/// \brief Discriminant stored in #wasmtime_val::kind -typedef uint8_t wasmtime_valkind_t; -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is an i32 -#define WASMTIME_I32 0 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is an i64 -#define WASMTIME_I64 1 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a f32 -#define WASMTIME_F32 2 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a f64 -#define WASMTIME_F64 3 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a v128 -#define WASMTIME_V128 4 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a funcref -#define WASMTIME_FUNCREF 5 -/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is an externref -#define WASMTIME_EXTERNREF 6 - -/// \brief A 128-bit value representing the WebAssembly `v128` type. Bytes are -/// stored in little-endian order. -typedef uint8_t wasmtime_v128[16]; - -/** - * \typedef wasmtime_valunion_t - * \brief Convenience alias for #wasmtime_valunion - * - * \union wasmtime_valunion - * \brief Container for different kinds of wasm values. - * - * This type is contained in #wasmtime_val_t and contains the payload for the - * various kinds of items a value can be. - */ -typedef union wasmtime_valunion { - /// Field used if #wasmtime_val_t::kind is #WASMTIME_I32 - int32_t i32; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_I64 - int64_t i64; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_F32 - float32_t f32; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_F64 - float64_t f64; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_FUNCREF - /// - /// If this value represents a `ref.null func` value then the `store_id` field - /// is set to zero. - wasmtime_func_t funcref; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_EXTERNREF - /// - /// If this value represents a `ref.null extern` value then this pointer will - /// be `NULL`. - wasmtime_externref_t *externref; - /// Field used if #wasmtime_val_t::kind is #WASMTIME_V128 - wasmtime_v128 v128; -} wasmtime_valunion_t; - -/** - * \typedef wasmtime_val_t - * \brief Convenience alias for #wasmtime_val_t - * - * \union wasmtime_val - * \brief Container for different kinds of wasm values. - * - * Note that this structure may contain an owned value, namely - * #wasmtime_externref_t, depending on the context in which this is used. APIs - * which consume a #wasmtime_val_t do not take ownership, but APIs that return - * #wasmtime_val_t require that #wasmtime_val_delete is called to deallocate - * the value. - */ -typedef struct wasmtime_val { - /// Discriminant of which field of #of is valid. - wasmtime_valkind_t kind; - /// Container for the extern item's value. - wasmtime_valunion_t of; -} wasmtime_val_t; - -/** - * \brief Delets an owned #wasmtime_val_t. - * - * Note that this only deletes the contents, not the memory that `val` points to - * itself (which is owned by the caller). - */ -WASM_API_EXTERN void wasmtime_val_delete(wasmtime_val_t *val); - -/** - * \brief Copies `src` into `dst`. - */ -WASM_API_EXTERN void wasmtime_val_copy(wasmtime_val_t *dst, const wasmtime_val_t *src); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // WASMTIME_VAL_H - diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/linux-x86_64/libwasmtime.a b/vendor/github.com/bytecodealliance/wasmtime-go/build/linux-x86_64/libwasmtime.a deleted file mode 100644 index ae8a6d78c1..0000000000 Binary files a/vendor/github.com/bytecodealliance/wasmtime-go/build/linux-x86_64/libwasmtime.a and /dev/null differ diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/macos-x86_64/libwasmtime.a b/vendor/github.com/bytecodealliance/wasmtime-go/build/macos-x86_64/libwasmtime.a deleted file mode 100644 index 7355de7db1..0000000000 Binary files a/vendor/github.com/bytecodealliance/wasmtime-go/build/macos-x86_64/libwasmtime.a and /dev/null differ diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/build/windows-x86_64/libwasmtime.a b/vendor/github.com/bytecodealliance/wasmtime-go/build/windows-x86_64/libwasmtime.a deleted file mode 100644 index 36e9243519..0000000000 Binary files a/vendor/github.com/bytecodealliance/wasmtime-go/build/windows-x86_64/libwasmtime.a and /dev/null differ diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/config.go b/vendor/github.com/bytecodealliance/wasmtime-go/config.go index 96f96e8979..e4e5fc51da 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/config.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/config.go @@ -17,8 +17,6 @@ const ( StrategyAuto Strategy = C.WASMTIME_STRATEGY_AUTO // StrategyCranelift will force wasmtime to use the Cranelift backend StrategyCranelift Strategy = C.WASMTIME_STRATEGY_CRANELIFT - // StrategyLightbeam will force wasmtime to use the lightbeam backend - StrategyLightbeam Strategy = C.WASMTIME_STRATEGY_LIGHTBEAM ) // OptLevel decides what degree of optimization wasmtime will perform on generated machine code @@ -94,9 +92,21 @@ func (cfg *Config) SetWasmMultiValue(enabled bool) { runtime.KeepAlive(cfg) } -// SetWasmModuleLinking configures whether the wasm module linking proposal is enabled -func (cfg *Config) SetWasmModuleLinking(enabled bool) { - C.wasmtime_config_wasm_module_linking_set(cfg.ptr(), C.bool(enabled)) +// SetWasmMultiMemory configures whether the wasm multi memory proposal is enabled +func (cfg *Config) SetWasmMultiMemory(enabled bool) { + C.wasmtime_config_wasm_multi_memory_set(cfg.ptr(), C.bool(enabled)) + runtime.KeepAlive(cfg) +} + +// SetWasmMemory64 configures whether the wasm memory64 proposal is enabled +func (cfg *Config) SetWasmMemory64(enabled bool) { + C.wasmtime_config_wasm_memory64_set(cfg.ptr(), C.bool(enabled)) + runtime.KeepAlive(cfg) +} + +// SetConsumFuel configures whether fuel is enabled +func (cfg *Config) SetConsumeFuel(enabled bool) { + C.wasmtime_config_consume_fuel_set(cfg.ptr(), C.bool(enabled)) runtime.KeepAlive(cfg) } @@ -163,10 +173,11 @@ func (cfg *Config) CacheConfigLoad(path string) error { return nil } -// SetInterruptable configures whether generated wasm code can be interrupted via interrupt -// handles. -func (cfg *Config) SetInterruptable(interruptable bool) { - C.wasmtime_config_interruptable_set(cfg.ptr(), C.bool(interruptable)) +// SetEpochInterruption enables epoch-based instrumentation of generated code to +// interrupt WebAssembly execution when the current engine epoch exceeds a +// defined threshold. +func (cfg *Config) SetEpochInterruption(enable bool) { + C.wasmtime_config_epoch_interruption_set(cfg.ptr(), C.bool(enable)) runtime.KeepAlive(cfg) } diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/engine.go b/vendor/github.com/bytecodealliance/wasmtime-go/engine.go index 47daf8667d..f3e5c1c50d 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/engine.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/engine.go @@ -1,8 +1,10 @@ package wasmtime -// #include +// #include import "C" -import "runtime" +import ( + "runtime" +) // Engine is an instance of a wasmtime engine which is used to create a `Store`. // @@ -42,3 +44,13 @@ func (engine *Engine) ptr() *C.wasm_engine_t { maybeGC() return ret } + +// IncrementEpoch will increase the current epoch number by 1 within the +// current engine which will cause any connected stores with their epoch +// deadline exceeded to now be interrupted. +// +// This method is safe to call from any goroutine. +func (engine *Engine) IncrementEpoch() { + C.wasmtime_engine_increment_epoch(engine.ptr()) + runtime.KeepAlive(engine) +} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/extern.go b/vendor/github.com/bytecodealliance/wasmtime-go/extern.go index 96a73bf202..77166d5ea6 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/extern.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/extern.go @@ -83,29 +83,6 @@ func (e *Extern) Table() *Table { return ret } -// Module returns a Module if this export is a module or nil otherwise -func (e *Extern) Module() *Module { - ptr := e.ptr() - if ptr.kind != C.WASMTIME_EXTERN_MODULE { - return nil - } - module := C.go_wasmtime_extern_module_get(ptr) - ret := mkModule(C.wasmtime_module_clone(module)) - runtime.KeepAlive(e) - return ret -} - -// Instance returns a Instance if this export is a module or nil otherwise -func (e *Extern) Instance() *Instance { - ptr := e.ptr() - if ptr.kind != C.WASMTIME_EXTERN_INSTANCE { - return nil - } - ret := mkInstance(C.go_wasmtime_extern_instance_get(ptr)) - runtime.KeepAlive(e) - return ret -} - func (e *Extern) AsExtern() C.wasmtime_extern_t { return *e.ptr() } diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/ffi.go b/vendor/github.com/bytecodealliance/wasmtime-go/ffi.go index 0aa6f4cf8c..7d47d7b543 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/ffi.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/ffi.go @@ -1,16 +1,20 @@ package wasmtime // #cgo CFLAGS:-I${SRCDIR}/build/include -// #cgo !windows LDFLAGS:-lwasmtime -lm -ldl +// #cgo !windows LDFLAGS:-lwasmtime -lm -ldl -pthread // #cgo windows CFLAGS:-DWASM_API_EXTERN= -DWASI_API_EXTERN= // #cgo windows LDFLAGS:-lwasmtime -luserenv -lole32 -lntdll -lws2_32 -lkernel32 -lbcrypt // #cgo linux,amd64 LDFLAGS:-L${SRCDIR}/build/linux-x86_64 +// #cgo linux,arm64 LDFLAGS:-L${SRCDIR}/build/linux-aarch64 // #cgo darwin,amd64 LDFLAGS:-L${SRCDIR}/build/macos-x86_64 +// #cgo darwin,arm64 LDFLAGS:-L${SRCDIR}/build/macos-aarch64 // #cgo windows,amd64 LDFLAGS:-L${SRCDIR}/build/windows-x86_64 // #include import "C" -import "runtime" -import "unsafe" +import ( + "runtime" + "unsafe" +) // # What's up with `ptr()` methods? // diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/func.go b/vendor/github.com/bytecodealliance/wasmtime-go/func.go index 7c458aff7a..9759ec0089 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/func.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/func.go @@ -30,15 +30,6 @@ type Caller struct { ptr *C.wasmtime_caller_t } -type funcNewEntry struct { - callback func(*Caller, []Val) ([]Val, *Trap) - results []*ValType -} - -type funcWrapEntry struct { - callback reflect.Value -} - // NewFunc creates a new `Func` with the given `ty` which, when called, will call `f` // // The `ty` given is the wasm type signature of the `Func` to create. When called @@ -60,12 +51,7 @@ func NewFunc( ty *FuncType, f func(*Caller, []Val) ([]Val, *Trap), ) *Func { - data := getDataInStore(store) - idx := len(data.funcNew) - data.funcNew = append(data.funcNew, funcNewEntry{ - callback: f, - results: ty.Results(), - }) + idx := insertFuncNew(getDataInStore(store), ty, f) ret := C.wasmtime_func_t{} C.go_func_new( @@ -93,7 +79,7 @@ func goTrampolineNew( caller := &Caller{ptr: callerPtr} defer func() { caller.ptr = nil }() data := getDataInStore(caller) - entry := data.funcNew[int(env)] + entry := data.getFuncNew(int(env)) params := make([]Val, int(argsNum)) var val C.wasmtime_val_t @@ -126,7 +112,9 @@ func goTrampolineNew( }() if trap == nil && lastPanic != nil { data.lastPanic = lastPanic - return nil + trap := NewTrap("go panicked") + runtime.SetFinalizer(trap, nil) + return trap.ptr() } if trap != nil { runtime.SetFinalizer(trap, nil) @@ -157,7 +145,7 @@ func goTrampolineNew( // // `float32` - a wasm `f32` // -// `float64` - a wasm `f32` +// `float64` - a wasm `f64` // // `*Caller` - information about the caller's instance // @@ -176,8 +164,25 @@ func WrapFunc( store Storelike, f interface{}, ) *Func { - // Make sure the `interface{}` passed in was indeed a function val := reflect.ValueOf(f) + wasmTy := inferFuncType(val) + idx := insertFuncWrap(getDataInStore(store), val) + + ret := C.wasmtime_func_t{} + C.go_func_new( + store.Context(), + wasmTy.ptr(), + C.size_t(idx), + 1, // this is `WrapFunc`, not `NewFunc` + &ret, + ) + runtime.KeepAlive(store) + runtime.KeepAlive(wasmTy) + return mkFunc(ret) +} + +func inferFuncType(val reflect.Value) *FuncType { + // Make sure the `interface{}` passed in was indeed a function ty := val.Type() if ty.Kind() != reflect.Func { panic("callback provided must be a `func`") @@ -205,25 +210,7 @@ func WrapFunc( } results = append(results, typeToValType(resultTy)) } - wasmTy := NewFuncType(params, results) - - // Store our `f` callback into the list for wrapped functions, and now - // we've got everything necessary to make the wasm handle. - data := getDataInStore(store) - idx := len(data.funcWrap) - data.funcWrap = append(data.funcWrap, funcWrapEntry{callback: val}) - - ret := C.wasmtime_func_t{} - C.go_func_new( - store.Context(), - wasmTy.ptr(), - C.size_t(idx), - 1, // this is `WrapFunc`, not `NewFunc` - &ret, - ) - runtime.KeepAlive(store) - runtime.KeepAlive(wasmTy) - return mkFunc(ret) + return NewFuncType(params, results) } func typeToValType(ty reflect.Type) *ValType { @@ -264,7 +251,7 @@ func goTrampolineWrap( caller := &Caller{ptr: callerPtr} defer func() { caller.ptr = nil }() data := getDataInStore(caller) - entry := data.funcWrap[int(env)] + entry := data.getFuncWrap(int(env)) ty := entry.callback.Type() params := make([]reflect.Value, ty.NumIn()) @@ -291,7 +278,9 @@ func goTrampolineWrap( }() if lastPanic != nil { data.lastPanic = lastPanic - return nil + trap := NewTrap("go panicked") + runtime.SetFinalizer(trap, nil) + return trap.ptr() } // And now we write all the results into memory depending on the type diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/includebuild.go b/vendor/github.com/bytecodealliance/wasmtime-go/includebuild.go index f8eceb5b99..1e0dcc7009 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/includebuild.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/includebuild.go @@ -1,3 +1,4 @@ +//go:build includebuild // +build includebuild package wasmtime @@ -10,9 +11,12 @@ import ( // Import these build directories in order to have them // included in vendored dependencies. // Cf. https://github.com/golang/go/issues/26366 + _ "github.com/bytecodealliance/wasmtime-go/build/include" _ "github.com/bytecodealliance/wasmtime-go/build/include/wasmtime" + _ "github.com/bytecodealliance/wasmtime-go/build/linux-aarch64" _ "github.com/bytecodealliance/wasmtime-go/build/linux-x86_64" + _ "github.com/bytecodealliance/wasmtime-go/build/macos-aarch64" _ "github.com/bytecodealliance/wasmtime-go/build/macos-x86_64" _ "github.com/bytecodealliance/wasmtime-go/build/windows-x86_64" ) diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/instance.go b/vendor/github.com/bytecodealliance/wasmtime-go/instance.go index 7cb03a18e8..e17a6dede9 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/instance.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/instance.go @@ -55,13 +55,6 @@ func mkInstance(val C.wasmtime_instance_t) *Instance { return &Instance{val} } -// Type returns an `InstanceType` that corresponds for this instance. -func (i *Instance) Type(store Storelike) *InstanceType { - ptr := C.wasmtime_instance_type(store.Context(), &i.val) - runtime.KeepAlive(store) - return mkInstanceType(ptr, nil) -} - type externList struct { vec C.wasm_extern_vec_t } @@ -113,7 +106,7 @@ func (i *Instance) GetExport(store Storelike, name string) *Extern { return nil } -// GetFunc attemps to find a function on this instance by `name`. +// GetFunc attempts to find a function on this instance by `name`. // // May return `nil` if this instance has no function named `name`, // it is not a function, etc. @@ -124,9 +117,3 @@ func (i *Instance) GetFunc(store Storelike, name string) *Func { } return f.Func() } - -func (i *Instance) AsExtern() C.wasmtime_extern_t { - ret := C.wasmtime_extern_t{kind: C.WASMTIME_EXTERN_INSTANCE} - C.go_wasmtime_extern_instance_set(&ret, i.val) - return ret -} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/instancetype.go b/vendor/github.com/bytecodealliance/wasmtime-go/instancetype.go deleted file mode 100644 index 2e7651e4b0..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/instancetype.go +++ /dev/null @@ -1,49 +0,0 @@ -package wasmtime - -// #include -import "C" -import "runtime" - -// InstanceType describes the exports of an instance. -type InstanceType struct { - _ptr *C.wasmtime_instancetype_t - _owner interface{} -} - -func mkInstanceType(ptr *C.wasmtime_instancetype_t, owner interface{}) *InstanceType { - instancetype := &InstanceType{_ptr: ptr, _owner: owner} - if owner == nil { - runtime.SetFinalizer(instancetype, func(instancetype *InstanceType) { - C.wasmtime_instancetype_delete(instancetype._ptr) - }) - } - return instancetype -} - -func (ty *InstanceType) ptr() *C.wasmtime_instancetype_t { - ret := ty._ptr - maybeGC() - return ret -} - -func (ty *InstanceType) owner() interface{} { - if ty._owner != nil { - return ty._owner - } - return ty -} - -// AsExternType converts this type to an instance of `ExternType` -func (ty *InstanceType) AsExternType() *ExternType { - ptr := C.wasmtime_instancetype_as_externtype(ty.ptr()) - return mkExternType(ptr, ty.owner()) -} - -// Exports returns a list of `ExportType` items which are the items that will -// be exported by this instance after instantiation. -func (ty *InstanceType) Exports() []*ExportType { - exports := &exportTypeList{} - C.wasmtime_instancetype_exports(ty.ptr(), &exports.vec) - runtime.KeepAlive(ty) - return exports.mkGoList() -} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/limits.go b/vendor/github.com/bytecodealliance/wasmtime-go/limits.go deleted file mode 100644 index 7655dc7b91..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/limits.go +++ /dev/null @@ -1,45 +0,0 @@ -package wasmtime - -// #include -import "C" -import "runtime" - -// LimitsMaxNone is the value for the Max field in Limits -const LimitsMaxNone = 0xffffffff - -// Limits is the resource limits specified for a TableType and MemoryType -type Limits struct { - // The minimum size of this resource, in units specified by the resource - // itself. - Min uint32 - // The maximum size of this resource, in units specified by the resource - // itself. - // - // A value of LimitsMaxNone will mean that there is no maximum. - Max uint32 -} - -// NewLimits creates a new resource limits specified for a TableType and MemoryType, -// in which min and max are the minimum and maximum size of this resource. -func NewLimits(min, max uint32) *Limits { - return &Limits{ - Min: min, - Max: max, - } -} - -func (limits Limits) ffi() C.wasm_limits_t { - return C.wasm_limits_t{ - min: C.uint32_t(limits.Min), - max: C.uint32_t(limits.Max), - } -} - -func mkLimits(ptr *C.wasm_limits_t, owner interface{}) Limits { - ret := Limits{ - Min: uint32(ptr.min), - Max: uint32(ptr.max), - } - runtime.KeepAlive(owner) - return ret -} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/linker.go b/vendor/github.com/bytecodealliance/wasmtime-go/linker.go index e19db99510..df2f068965 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/linker.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/linker.go @@ -3,7 +3,10 @@ package wasmtime // #include // #include "shims.h" import "C" -import "runtime" +import ( + "reflect" + "runtime" +) // Linker implements a wasmtime Linking module, which can link instantiated modules together. // More details you can see [examples for C](https://bytecodealliance.github.io/wasmtime/examples-c-linking.html) or @@ -65,6 +68,70 @@ func (l *Linker) DefineFunc(store Storelike, module, name string, f interface{}) return l.Define(module, name, WrapFunc(store, f)) } +// FuncNew defines a function in this linker in the same style as `NewFunc` +// +// Note that this function does not require a `Storelike`, which is +// intentional. This function can be used to insert store-independent functions +// into this linker which allows this linker to be used for instantiating +// modules in multiple different stores. +// +// Returns an error if shadowing is disabled and the name is already defined. +func (l *Linker) FuncNew(module, name string, ty *FuncType, f func(*Caller, []Val) ([]Val, *Trap)) error { + idx := insertFuncNew(nil, ty, f) + err := C.go_linker_define_func( + l.ptr(), + C._GoStringPtr(module), + C._GoStringLen(module), + C._GoStringPtr(name), + C._GoStringLen(name), + ty.ptr(), + 0, // this is "new" + C.size_t(idx), + ) + runtime.KeepAlive(l) + runtime.KeepAlive(module) + runtime.KeepAlive(name) + runtime.KeepAlive(ty) + if err == nil { + return nil + } + + return mkError(err) +} + +// FuncWrap defines a function in this linker in the same style as `WrapFunc` +// +// Note that this function does not require a `Storelike`, which is +// intentional. This function can be used to insert store-independent functions +// into this linker which allows this linker to be used for instantiating +// modules in multiple different stores. +// +// Returns an error if shadowing is disabled and the name is already defined. +func (l *Linker) FuncWrap(module, name string, f interface{}) error { + val := reflect.ValueOf(f) + ty := inferFuncType(val) + idx := insertFuncWrap(nil, val) + err := C.go_linker_define_func( + l.ptr(), + C._GoStringPtr(module), + C._GoStringLen(module), + C._GoStringPtr(name), + C._GoStringLen(name), + ty.ptr(), + 1, // this is "wrap" + C.size_t(idx), + ) + runtime.KeepAlive(l) + runtime.KeepAlive(module) + runtime.KeepAlive(name) + runtime.KeepAlive(ty) + if err == nil { + return nil + } + + return mkError(err) +} + // DefineInstance defines all exports of an instance provided under the module name provided. // // Returns an error if shadowing is disabled and names are already defined. @@ -126,7 +193,7 @@ func (l *Linker) DefineWasi() error { return mkError(err) } -// Instantiate instantates a module with all imports defined in this linker. +// Instantiate instantiates a module with all imports defined in this linker. // // Returns an error if the instance's imports couldn't be satisfied, had the // wrong types, or if a trap happened executing the start function. diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_actual.go b/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_actual.go index 7ef37c434a..c6171042c9 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_actual.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_actual.go @@ -1,3 +1,4 @@ +//go:build debug // +build debug package wasmtime diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_no.go b/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_no.go index 5b8f39821a..d69382ed1f 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_no.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/maybe_gc_no.go @@ -1,3 +1,4 @@ +//go:build !debug // +build !debug package wasmtime diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/memory.go b/vendor/github.com/bytecodealliance/wasmtime-go/memory.go index f060bbfbe7..4b0d1fd6ee 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/memory.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/memory.go @@ -73,21 +73,21 @@ func (mem *Memory) DataSize(store Storelike) uintptr { } // Size returns the size, in wasm pages, of this memory -func (mem *Memory) Size(store Storelike) uint32 { - ret := uint32(C.wasmtime_memory_size(store.Context(), &mem.val)) +func (mem *Memory) Size(store Storelike) uint64 { + ret := uint64(C.wasmtime_memory_size(store.Context(), &mem.val)) runtime.KeepAlive(store) return ret } // Grow grows this memory by `delta` pages -func (mem *Memory) Grow(store Storelike, delta uint) (uint32, error) { - prev := C.uint32_t(0) - err := C.wasmtime_memory_grow(store.Context(), &mem.val, C.wasm_memory_pages_t(delta), &prev) +func (mem *Memory) Grow(store Storelike, delta uint64) (uint64, error) { + prev := C.uint64_t(0) + err := C.wasmtime_memory_grow(store.Context(), &mem.val, C.uint64_t(delta), &prev) runtime.KeepAlive(store) if err != nil { return 0, mkError(err) } - return uint32(prev), nil + return uint64(prev), nil } func (mem *Memory) AsExtern() C.wasmtime_extern_t { diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/memorytype.go b/vendor/github.com/bytecodealliance/wasmtime-go/memorytype.go index fb354cf7b5..3a5b7d6ceb 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/memorytype.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/memorytype.go @@ -1,6 +1,6 @@ package wasmtime -// #include +// #include import "C" import "runtime" @@ -11,10 +11,34 @@ type MemoryType struct { _owner interface{} } -// NewMemoryType creates a new `MemoryType` with the `limits` on size provided -func NewMemoryType(limits Limits) *MemoryType { - limitsFFI := limits.ffi() - ptr := C.wasm_memorytype_new(&limitsFFI) +// NewMemoryType creates a new `MemoryType` with the limits on size provided +// +// The `min` value is the minimum size, in WebAssembly pages, of this memory. +// The `has_max` boolean indicates whether a maximum size is present, and if so +// `max` is used as the maximum size of memory, in wasm pages. +// +// Note that this will create a 32-bit memory type, the default outside of the +// memory64 proposal. +func NewMemoryType(min uint32, has_max bool, max uint32) *MemoryType { + if min > (1<<16) || max > (1<<16) { + panic("provided sizes are too large") + } + ptr := C.wasmtime_memorytype_new(C.uint64_t(min), C._Bool(has_max), C.uint64_t(max), false) + return mkMemoryType(ptr, nil) +} + +// NewMemoryType64 creates a new 64-bit `MemoryType` with the provided limits +// +// The `min` value is the minimum size, in WebAssembly pages, of this memory. +// The `has_max` boolean indicates whether a maximum size is present, and if so +// `max` is used as the maximum size of memory, in wasm pages. +// +// Note that 64-bit memories are part of the memory64 WebAssembly proposal. +func NewMemoryType64(min uint64, has_max bool, max uint64) *MemoryType { + if min > (1<<48) || max > (1<<48) { + panic("provided sizes are too large") + } + ptr := C.wasmtime_memorytype_new(C.uint64_t(min), C._Bool(has_max), C.uint64_t(max), true) return mkMemoryType(ptr, nil) } @@ -41,10 +65,30 @@ func (ty *MemoryType) owner() interface{} { return ty } -// Limits returns the limits on the size of this memory type -func (ty *MemoryType) Limits() Limits { - ptr := C.wasm_memorytype_limits(ty.ptr()) - return mkLimits(ptr, ty.owner()) +// Minimum returns the minimum size of this memory, in WebAssembly pages +func (ty *MemoryType) Minimum() uint64 { + ret := C.wasmtime_memorytype_minimum(ty.ptr()) + runtime.KeepAlive(ty) + return uint64(ret) +} + +// Maximum returns the maximum size of this memory, in WebAssembly pages, if +// specified. +// +// If the maximum size is not specified then `(false, 0)` is returned, otherwise +// `(true, N)` is returned where `N` is the listed maximum size of this memory. +func (ty *MemoryType) Maximum() (bool, uint64) { + size := C.uint64_t(0) + present := C.wasmtime_memorytype_maximum(ty.ptr(), &size) + runtime.KeepAlive(ty) + return bool(present), uint64(size) +} + +// Is64 returns whether this is a 64-bit memory or not. +func (ty *MemoryType) Is64() bool { + ok := C.wasmtime_memorytype_is64(ty.ptr()) + runtime.KeepAlive(ty) + return bool(ok) } // AsExternType converts this type to an instance of `ExternType` diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/module.go b/vendor/github.com/bytecodealliance/wasmtime-go/module.go index fb43ea0882..4c076184b6 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/module.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/module.go @@ -1,6 +1,7 @@ package wasmtime // #include "shims.h" +// #include import "C" import ( "io/ioutil" @@ -91,11 +92,22 @@ func (m *Module) ptr() *C.wasmtime_module_t { return ret } -// Type returns a `ModuleType` that corresponds for this module. -func (m *Module) Type() *ModuleType { - ptr := C.wasmtime_module_type(m.ptr()) +// Imports returns a list of `ImportType` which are the items imported by +// this module and are required for instantiation +func (m *Module) Imports() []*ImportType { + imports := &importTypeList{} + C.wasmtime_module_imports(m.ptr(), &imports.vec) runtime.KeepAlive(m) - return mkModuleType(ptr, nil) + return imports.mkGoList() +} + +// Exports returns a list of `ExportType` which are the items that will be +// exported by this module after instantiation. +func (m *Module) Exports() []*ExportType { + exports := &exportTypeList{} + C.wasmtime_module_exports(m.ptr(), &exports.vec) + runtime.KeepAlive(m) + return exports.mkGoList() } type importTypeList struct { @@ -148,8 +160,8 @@ func (list *exportTypeList) mkGoList() []*ExportType { // If deserialization is successful then a compiled module is returned, // otherwise nil and an error are returned. // -// Note that to deserialize successfully the bytes provided must have beeen -// produced with an `Engine` that has the same commpilation options as the +// Note that to deserialize successfully the bytes provided must have been +// produced with an `Engine` that has the same compilation options as the // provided engine, and from the same version of this library. func NewModuleDeserialize(engine *Engine, encoded []byte) (*Module, error) { var encodedPtr *C.uint8_t @@ -173,6 +185,22 @@ func NewModuleDeserialize(engine *Engine, encoded []byte) (*Module, error) { return mkModule(ptr), nil } +// NewModuleDeserializeFile is the same as `NewModuleDeserialize` except that +// the bytes are read from a file instead of provided as an argument. +func NewModuleDeserializeFile(engine *Engine, path string) (*Module, error) { + cs := C.CString(path) + var ptr *C.wasmtime_module_t + err := C.wasmtime_module_deserialize_file(engine.ptr(), cs, &ptr) + runtime.KeepAlive(engine) + C.free(unsafe.Pointer(cs)) + + if err != nil { + return nil, mkError(err) + } + + return mkModule(ptr), nil +} + // Serialize will convert this in-memory compiled module into a list of bytes. // // The purpose of this method is to extract an artifact which can be stored @@ -192,9 +220,3 @@ func (m *Module) Serialize() ([]byte, error) { C.wasm_byte_vec_delete(&retVec) return ret, nil } - -func (m *Module) AsExtern() C.wasmtime_extern_t { - ret := C.wasmtime_extern_t{kind: C.WASMTIME_EXTERN_MODULE} - C.go_wasmtime_extern_module_set(&ret, m.ptr()) - return ret -} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/moduletype.go b/vendor/github.com/bytecodealliance/wasmtime-go/moduletype.go deleted file mode 100644 index c348e15de2..0000000000 --- a/vendor/github.com/bytecodealliance/wasmtime-go/moduletype.go +++ /dev/null @@ -1,58 +0,0 @@ -package wasmtime - -// #include -import "C" -import "runtime" - -// ModuleType describes the imports/exports of a module. -type ModuleType struct { - _ptr *C.wasmtime_moduletype_t - _owner interface{} -} - -func mkModuleType(ptr *C.wasmtime_moduletype_t, owner interface{}) *ModuleType { - moduletype := &ModuleType{_ptr: ptr, _owner: owner} - if owner == nil { - runtime.SetFinalizer(moduletype, func(moduletype *ModuleType) { - C.wasmtime_moduletype_delete(moduletype._ptr) - }) - } - return moduletype -} - -func (ty *ModuleType) ptr() *C.wasmtime_moduletype_t { - ret := ty._ptr - maybeGC() - return ret -} - -func (ty *ModuleType) owner() interface{} { - if ty._owner != nil { - return ty._owner - } - return ty -} - -// AsExternType converts this type to an instance of `ExternType` -func (ty *ModuleType) AsExternType() *ExternType { - ptr := C.wasmtime_moduletype_as_externtype(ty.ptr()) - return mkExternType(ptr, ty.owner()) -} - -// Imports returns a list of `ImportType` items which are the items imported by -// this module and are required for instantiation. -func (m *ModuleType) Imports() []*ImportType { - imports := &importTypeList{} - C.wasmtime_moduletype_imports(m.ptr(), &imports.vec) - runtime.KeepAlive(m) - return imports.mkGoList() -} - -// Exports returns a list of `ExportType` items which are the items that will -// be exported by this module after instantiation. -func (m *ModuleType) Exports() []*ExportType { - exports := &exportTypeList{} - C.wasmtime_moduletype_exports(m.ptr(), &exports.vec) - runtime.KeepAlive(m) - return exports.mkGoList() -} diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/shims.c b/vendor/github.com/bytecodealliance/wasmtime-go/shims.c index f121c3f85c..6940f95fe3 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/shims.c +++ b/vendor/github.com/bytecodealliance/wasmtime-go/shims.c @@ -31,13 +31,38 @@ static wasm_trap_t* wrap_trampoline( results, nresults); } -void go_func_new(wasmtime_context_t *store, wasm_functype_t *ty, size_t env, int wrap, wasmtime_func_t *ret) { +void go_func_new( + wasmtime_context_t *store, + wasm_functype_t *ty, + size_t env, + int wrap, + wasmtime_func_t *ret +) { wasmtime_func_callback_t callback = trampoline; if (wrap) callback = wrap_trampoline; return wasmtime_func_new(store, ty, callback, (void*) env, NULL, ret); } +wasmtime_error_t *go_linker_define_func( + wasmtime_linker_t *linker, + const char *module, + size_t module_len, + const char *name, + size_t name_len, + const wasm_functype_t *ty, + int wrap, + size_t env +) { + wasmtime_func_callback_t cb = trampoline; + void(*finalizer)(void*) = goFinalizeFuncNew; + if (wrap) { + cb = wrap_trampoline; + finalizer = goFinalizeFuncWrap; + } + return wasmtime_linker_define_func(linker, module, module_len, name, name_len, ty, cb, (void*) env, finalizer); +} + wasmtime_externref_t *go_externref_new(size_t env) { return wasmtime_externref_new((void*) env, goFinalizeExternref); } diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/shims.h b/vendor/github.com/bytecodealliance/wasmtime-go/shims.h index 3b58a8e28e..3b42c48e72 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/shims.h +++ b/vendor/github.com/bytecodealliance/wasmtime-go/shims.h @@ -2,7 +2,17 @@ #include wasmtime_store_t *go_store_new(wasm_engine_t *engine, size_t env); -void go_func_new(wasmtime_context_t *context, wasm_functype_t *ty, size_t env, int wrap, wasmtime_func_t *ret); +void go_func_new(wasmtime_context_t *context, wasm_functype_t *ty, size_t env, int wrap, wasmtime_func_t *ret); +wasmtime_error_t *go_linker_define_func( + wasmtime_linker_t *linker, + const char *module, + size_t module_len, + const char *name, + size_t name_len, + const wasm_functype_t *ty, + int wrap, + size_t env +); wasmtime_externref_t *go_externref_new(size_t env); #define EACH_UNION_ACCESSOR(name) \ @@ -15,10 +25,8 @@ wasmtime_externref_t *go_externref_new(size_t env); \ UNION_ACCESSOR(wasmtime_extern, func, wasmtime_func_t) \ UNION_ACCESSOR(wasmtime_extern, memory, wasmtime_memory_t) \ - UNION_ACCESSOR(wasmtime_extern, instance, wasmtime_instance_t) \ UNION_ACCESSOR(wasmtime_extern, table, wasmtime_table_t) \ - UNION_ACCESSOR(wasmtime_extern, global, wasmtime_global_t) \ - UNION_ACCESSOR(wasmtime_extern, module, wasmtime_module_t*) + UNION_ACCESSOR(wasmtime_extern, global, wasmtime_global_t) #define UNION_ACCESSOR(name, field, ty) \ ty go_##name##_##field##_get(const name##_t *val); \ diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/store.go b/vendor/github.com/bytecodealliance/wasmtime-go/store.go index 7b28177060..7dc8c59fae 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/store.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/store.go @@ -4,7 +4,7 @@ package wasmtime // #include "shims.h" import "C" import ( - "errors" + "reflect" "runtime" "sync" "unsafe" @@ -39,18 +39,28 @@ var gStoreSlab slab // information through invocations as well as store Go closures that have been // added to the store. type storeData struct { + engine *Engine funcNew []funcNewEntry funcWrap []funcWrapEntry lastPanic interface{} } +type funcNewEntry struct { + callback func(*Caller, []Val) ([]Val, *Trap) + results []*ValType +} + +type funcWrapEntry struct { + callback reflect.Value +} + // NewStore creates a new `Store` from the configuration provided in `engine` func NewStore(engine *Engine) *Store { // Allocate an index for this store and allocate some internal data to go with // the store. gStoreLock.Lock() idx := gStoreSlab.allocate() - gStoreMap[idx] = &storeData{} + gStoreMap[idx] = &storeData{engine: engine} gStoreLock.Unlock() ptr := C.go_store_new(engine.ptr(), C.size_t(idx)) @@ -77,25 +87,6 @@ func goFinalizeStore(env unsafe.Pointer) { gStoreSlab.deallocate(idx) } -// InterruptHandle returns a handle, if enabled, which can be used to interrupt -// execution of WebAssembly within this `Store` from any goroutine. -// -// This requires that `SetInterruptable` is set to `true` on the `Config` -// associated with this `Store`. Returns an error if interrupts aren't enabled. -func (store *Store) InterruptHandle() (*InterruptHandle, error) { - ptr := C.wasmtime_interrupt_handle_new(store.Context()) - runtime.KeepAlive(store) - if ptr == nil { - return nil, errors.New("interrupts not enabled in `Config`") - } - - handle := &InterruptHandle{_ptr: ptr} - runtime.SetFinalizer(handle, func(handle *InterruptHandle) { - C.wasmtime_interrupt_handle_delete(handle._ptr) - }) - return handle, nil -} - // GC will clean up any `externref` values that are no longer actually // referenced. // @@ -129,6 +120,13 @@ func (store *Store) Context() *C.wasmtime_context_t { return ret } +// SetEpochDeadline will configure the relative deadline, from the current +// engine's epoch number, after which wasm code will be interrupted. +func (store *Store) SetEpochDeadline(deadline uint64) { + C.wasmtime_context_set_epoch_deadline(store.Context(), C.uint64_t(deadline)) + runtime.KeepAlive(store) +} + // Returns the underlying `*storeData` that this store references in Go, used // for inserting functions or storing panic data. func getDataInStore(store Storelike) *storeData { @@ -138,27 +136,153 @@ func getDataInStore(store Storelike) *storeData { return gStoreMap[int(data)] } -// InterruptHandle is used to interrupt the execution of currently running -// wasm code. +var gEngineFuncLock sync.Mutex +var gEngineFuncNew = make(map[int]*funcNewEntry) +var gEngineFuncNewSlab slab +var gEngineFuncWrap = make(map[int]*funcWrapEntry) +var gEngineFuncWrapSlab slab + +func insertFuncNew(data *storeData, ty *FuncType, callback func(*Caller, []Val) ([]Val, *Trap)) int { + var idx int + entry := funcNewEntry{ + callback: callback, + results: ty.Results(), + } + if data == nil { + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + idx = gEngineFuncNewSlab.allocate() + gEngineFuncNew[idx] = &entry + idx = (idx << 1) + } else { + idx = len(data.funcNew) + data.funcNew = append(data.funcNew, entry) + idx = (idx << 1) | 1 + } + return idx +} + +func (data *storeData) getFuncNew(idx int) *funcNewEntry { + if idx&1 == 0 { + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + return gEngineFuncNew[idx>>1] + } else { + return &data.funcNew[idx>>1] + } +} + +func insertFuncWrap(data *storeData, callback reflect.Value) int { + var idx int + entry := funcWrapEntry{callback} + if data == nil { + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + idx = gEngineFuncWrapSlab.allocate() + gEngineFuncWrap[idx] = &entry + idx = (idx << 1) + } else { + idx = len(data.funcWrap) + data.funcWrap = append(data.funcWrap, entry) + idx = (idx << 1) | 1 + } + return idx + +} + +func (data *storeData) getFuncWrap(idx int) *funcWrapEntry { + if idx&1 == 0 { + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + return gEngineFuncWrap[idx>>1] + } else { + return &data.funcWrap[idx>>1] + } +} + +//export goFinalizeFuncNew +func goFinalizeFuncNew(env unsafe.Pointer) { + idx := int(uintptr(env)) + if idx&1 != 0 { + panic("shouldn't finalize a store-local index") + } + idx = idx >> 1 + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + delete(gEngineFuncNew, idx) + gEngineFuncNewSlab.deallocate(idx) + +} + +//export goFinalizeFuncWrap +func goFinalizeFuncWrap(env unsafe.Pointer) { + idx := int(uintptr(env)) + if idx&1 != 0 { + panic("shouldn't finalize a store-local index") + } + idx = idx >> 1 + gEngineFuncLock.Lock() + defer gEngineFuncLock.Unlock() + delete(gEngineFuncWrap, idx) + gEngineFuncWrapSlab.deallocate(idx) +} + +// FuelConsumed returns the amount of fuel consumed by this context's store +// execution so far. +// +// If fuel consumption is not enabled via `Config.SetConsumeFuel` then this function +// will return false. Otherwise true is returned and the fuel parameter is +// filled in with fuel consumed so far. // -// For more information see -// https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Store.html#method.interrupt_handle -type InterruptHandle struct { - _ptr *C.wasmtime_interrupt_handle_t +// Also note that fuel, if enabled, must be originally configured via `Store.AddFuel`. +func (store *Store) FuelConsumed() (uint64, bool) { + fuel := C.uint64_t(0) + enable := C.wasmtime_context_fuel_consumed(store.Context(), &fuel) + runtime.KeepAlive(store) + + return uint64(fuel), bool(enable) } -// Interrupt interrupts currently executing WebAssembly code, if it's currently running, -// or interrupts wasm the next time it starts running. +// AddFuel adds fuel to this context's store for wasm to consume while executing. +// +// For this method to work fuel consumption must be enabled via +// `Config.SetConsumeFuel`. By default a store starts with 0 fuel +// for wasm to execute with (meaning it will immediately trap). +// This function must be called for the store to have +// some fuel to allow WebAssembly to execute. // -// For more information see -// https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Store.html#method.interrupt_handle -func (i *InterruptHandle) Interrupt() { - C.wasmtime_interrupt_handle_interrupt(i.ptr()) - runtime.KeepAlive(i) +// Note that at this time when fuel is entirely consumed it will cause +// wasm to trap. More usages of fuel are planned for the future. +// +// If fuel is not enabled within this store then an error is returned. +func (store *Store) AddFuel(fuel uint64) error { + err := C.wasmtime_context_add_fuel(store.Context(), C.uint64_t(fuel)) + runtime.KeepAlive(store) + if err != nil { + return mkError(err) + } + + return nil } -func (i *InterruptHandle) ptr() *C.wasmtime_interrupt_handle_t { - ret := i._ptr - maybeGC() - return ret +// ConsumeFuel attempts to manually consume fuel from the store. +// +// If fuel consumption is not enabled via `Config.SetConsumeFuel` then +// this function will return an error. Otherwise this will attempt to consume +// the specified amount of `fuel` from the store. If successful the remaining +// amount of fuel is returned. If `fuel` couldn't be consumed +// then an error is returned. +// +// Also note that fuel, if enabled, must be originally configured via +// `Store.AddFuel`. +func (store *Store) ConsumeFuel(fuel uint64) (uint64, error) { + var remaining uint64 + c_remaining := C.uint64_t(remaining) + err := C.wasmtime_context_consume_fuel(store.Context(), C.uint64_t(fuel), &c_remaining) + runtime.KeepAlive(store) + if err != nil { + return 0, mkError(err) + } + + return uint64(c_remaining), nil } diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/tabletype.go b/vendor/github.com/bytecodealliance/wasmtime-go/tabletype.go index a7a2930061..50da0c8acc 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/tabletype.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/tabletype.go @@ -10,12 +10,22 @@ type TableType struct { _owner interface{} } -// NewTableType creates a new `TableType` with the `element` type provided as well as -// `limits` on its size. -func NewTableType(element *ValType, limits Limits) *TableType { +// NewTableType creates a new `TableType` with the `element` type provided as +// well as limits on its size. +// +// The `min` value is the minimum size, in elements, of this table. The +// `has_max` boolean indicates whether a maximum size is present, and if so +// `max` is used as the maximum size of the table, in elements. +func NewTableType(element *ValType, min uint32, has_max bool, max uint32) *TableType { valptr := C.wasm_valtype_new(C.wasm_valtype_kind(element.ptr())) runtime.KeepAlive(element) - limitsFFI := limits.ffi() + if !has_max { + max = 0xffffffff + } + limitsFFI := C.wasm_limits_t{ + min: C.uint32_t(min), + max: C.uint32_t(max), + } ptr := C.wasm_tabletype_new(valptr, &limitsFFI) return mkTableType(ptr, nil) @@ -50,10 +60,27 @@ func (ty *TableType) Element() *ValType { return mkValType(ptr, ty.owner()) } -// Limits returns limits on the size of this table type -func (ty *TableType) Limits() Limits { +// Minimum returns the minimum size, in elements, of this table. +func (ty *TableType) Minimum() uint32 { ptr := C.wasm_tabletype_limits(ty.ptr()) - return mkLimits(ptr, ty.owner()) + ret := uint32(ptr.min) + runtime.KeepAlive(ty) + return ret +} + +// Maximum returns the maximum size, in elements, of this table. +// +// If no maximum size is listed then `(false, 0)` is returned, otherwise +// `(true, N)` is returned where `N` is the maximum size. +func (ty *TableType) Maximum() (bool, uint32) { + ptr := C.wasm_tabletype_limits(ty.ptr()) + ret := uint32(ptr.max) + runtime.KeepAlive(ty) + if ret == 0xffffffff { + return false, 0 + } else { + return true, ret + } } // AsExternType converts this type to an instance of `ExternType` diff --git a/vendor/github.com/bytecodealliance/wasmtime-go/trap.go b/vendor/github.com/bytecodealliance/wasmtime-go/trap.go index c44bb11f26..55c0a42778 100644 --- a/vendor/github.com/bytecodealliance/wasmtime-go/trap.go +++ b/vendor/github.com/bytecodealliance/wasmtime-go/trap.go @@ -24,6 +24,34 @@ type Frame struct { _owner interface{} } +// TrapCode is the code of an instruction trap. +type TrapCode uint8 + +const ( + // StackOverflow: the current stack space was exhausted. + StackOverflow TrapCode = iota + // MemoryOutOfBounds: out-of-bounds memory access. + MemoryOutOfBounds + // HeapMisaligned: a wasm atomic operation was presented with a not-naturally-aligned linear-memory address. + HeapMisaligned + // TableOutOfBounds: out-of-bounds access to a table. + TableOutOfBounds + // IndirectCallToNull: indirect call to a null table entry. + IndirectCallToNull + // BadSignature: signature mismatch on indirect call. + BadSignature + // IntegerOverflow: an integer arithmetic operation caused an overflow. + IntegerOverflow + // IntegerDivisionByZero: integer division by zero. + IntegerDivisionByZero + // BadConversionToInteger: failed float-to-int conversion. + BadConversionToInteger + // UnreachableCodeReached: code that was supposed to have been unreachable was reached. + UnreachableCodeReached + // Interrupt: execution has been interrupted. + Interrupt +) + // NewTrap creates a new `Trap` with the `name` and the type provided. func NewTrap(message string) *Trap { ptr := C.wasmtime_trap_new(C._GoStringPtr(message), C._GoStringLen(message)) @@ -45,7 +73,7 @@ func (t *Trap) ptr() *C.wasm_trap_t { return ret } -// Message returns the name in the module this export type is exporting +// Message returns the message of the `Trap` func (t *Trap) Message() string { message := C.wasm_byte_vec_t{} C.wasm_trap_message(t.ptr(), &message) @@ -55,6 +83,18 @@ func (t *Trap) Message() string { return ret } +// Code returns the code of the `Trap` if it exists, nil otherwise. +func (t *Trap) Code() *TrapCode { + var code C.uint8_t + var ret *TrapCode + ok := C.wasmtime_trap_code(t.ptr(), &code) + if ok == C._Bool(true) { + ret = (*TrapCode)(&code) + } + runtime.KeepAlive(t) + return ret +} + func (t *Trap) Error() string { return t.Message() } diff --git a/vendor/modules.txt b/vendor/modules.txt index 42c1005f8d..bad5e595f5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -3,12 +3,14 @@ github.com/OneOfOne/xxhash # github.com/beorn7/perks v1.0.1 github.com/beorn7/perks/quantile -# github.com/bytecodealliance/wasmtime-go v0.28.0 +# github.com/bytecodealliance/wasmtime-go v0.38.0 ## explicit github.com/bytecodealliance/wasmtime-go github.com/bytecodealliance/wasmtime-go/build/include github.com/bytecodealliance/wasmtime-go/build/include/wasmtime +github.com/bytecodealliance/wasmtime-go/build/linux-aarch64 github.com/bytecodealliance/wasmtime-go/build/linux-x86_64 +github.com/bytecodealliance/wasmtime-go/build/macos-aarch64 github.com/bytecodealliance/wasmtime-go/build/macos-x86_64 github.com/bytecodealliance/wasmtime-go/build/windows-x86_64 # github.com/cespare/xxhash/v2 v2.1.1