This commit updates the wasm-tools family of crates, notably pulling in the refactorings and updates from bytecodealliance/wasm-tools#621 for the latest iteration of the component model. This commit additionally updates all support for the component model for these changes, notably: * Many bits and pieces of type information was refactored. Many `FooTypeIndex` namings are now `TypeFooIndex`. Additionally there is now `TypeIndex` as well as `ComponentTypeIndex` for the two type index spaces in a component. * A number of new sections are now processed to handle the core and component variants. * Internal maps were split such as the `funcs` map into `component_funcs` and `funcs` (same for `instances`). * Canonical options are now processed individually instead of one bulk `into` definition. Overall this was not a major update to the internals of handling the component model in Wasmtime. Instead this was mostly a surface-level refactoring to make sure that everything lines up with the new binary format for components. * All text syntax used in tests was updated to the new syntax.
73 lines
1.4 KiB
Plaintext
73 lines
1.4 KiB
Plaintext
;; basic function lifting
|
|
(component
|
|
(core module $m
|
|
(func (export ""))
|
|
)
|
|
(core instance $i (instantiate $m))
|
|
|
|
(func (export "thunk")
|
|
(canon lift (core func $i ""))
|
|
)
|
|
)
|
|
|
|
;; use an aliased type
|
|
(component $c
|
|
(core module $m
|
|
(func (export ""))
|
|
)
|
|
(core instance $i (instantiate $m))
|
|
|
|
(type $to_alias (func))
|
|
(alias outer $c $to_alias (type $alias))
|
|
|
|
(func (export "thunk") (type $alias)
|
|
(canon lift (core func $i ""))
|
|
)
|
|
)
|
|
|
|
;; test out some various canonical abi
|
|
(component $c
|
|
(core module $m
|
|
(func (export "") (param i32 i32))
|
|
(memory (export "memory") 1)
|
|
(func (export "realloc") (param i32 i32 i32 i32) (result i32)
|
|
unreachable)
|
|
)
|
|
(core instance $i (instantiate $m))
|
|
|
|
(func (export "thunk") (param string)
|
|
(canon lift
|
|
(core func $i "")
|
|
(memory $i "memory")
|
|
(realloc (func $i "realloc"))
|
|
)
|
|
)
|
|
|
|
(func (export "thunk8") (param string)
|
|
(canon lift
|
|
(core func $i "")
|
|
string-encoding=utf8
|
|
(memory $i "memory")
|
|
(realloc (func $i "realloc"))
|
|
)
|
|
)
|
|
|
|
(func (export "thunk16") (param string)
|
|
(canon lift
|
|
(core func $i "")
|
|
string-encoding=utf16
|
|
(memory $i "memory")
|
|
(realloc (func $i "realloc"))
|
|
)
|
|
)
|
|
|
|
(func (export "thunklatin16") (param string)
|
|
(canon lift
|
|
(core func $i "")
|
|
string-encoding=latin1+utf16
|
|
(memory $i "memory")
|
|
(realloc (func $i "realloc"))
|
|
)
|
|
)
|
|
)
|