Remove the module linking implementation in Wasmtime (#3958)
* Remove the module linking implementation in Wasmtime This commit removes the experimental implementation of the module linking WebAssembly proposal from Wasmtime. The module linking is no longer intended for core WebAssembly but is instead incorporated into the component model now at this point. This means that very large parts of Wasmtime's implementation of module linking are no longer applicable and would change greatly with an implementation of the component model. The main purpose of this is to remove Wasmtime's reliance on the support for module-linking in `wasmparser` and tooling crates. With this reliance removed we can move over to the `component-model` branch of `wasmparser` and use the updated support for the component model. Additionally given the trajectory of the component model proposal the embedding API of Wasmtime will not look like what it looks like today for WebAssembly. For example the core wasm `Instance` will not change and instead a `Component` is likely to be added instead. Some more rationale for this is in #3941, but the basic idea is that I feel that it's not going to be viable to develop support for the component model on a non-`main` branch of Wasmtime. Additionaly I don't think it's viable, for the same reasons as `wasm-tools`, to support the old module linking proposal and the new component model at the same time. This commit takes a moment to not only delete the existing module linking implementation but some abstractions are also simplified. For example module serialization is a bit simpler that there's only one module. Additionally instantiation is much simpler since the only initializer we have to deal with are imports and nothing else. Closes #3941 * Fix doc link * Update comments
This commit is contained in:
@@ -16,39 +16,19 @@
|
||||
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 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 Instantiate a wasm module.
|
||||
@@ -91,16 +71,6 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_instance_new(
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user