alexcrichton opened issue #4310:
For core wasm Wasmtime offers the
FuncandTypedFuncAPIs for calling into WebAssembly. The current intention is to provide the same for the component model. Currently theTypedFuncAPI exists, but theFuncAPI doesn't actually support calls.The intended use case for this feature is for something like the wasmtime CLI where it wants to be able to call any component it loads so we can't statically enumerate the signatures ahead of time. It's expected that this version of calling a component is slower (perhaps significantly so) than calling a typed function.
Currently I don't have many ideas about how the implementation will be done. The rough idea is that there'd be some sort of
wasmtime::Valequivalent but for the component model. Like withValthe actual value iteslf is "tagged" with the type information. The actual implementation of this is going to be much trickier than core wasm becauseValonly deals with primitives and a component model value can recursively contain other component model values. This will likely imply a significant overhead in terms of allocations, indirection, and management.I do not think that the
wasmtime::component::Valtype will implement any ofComponentValue,Lift, orLower. Those are intended only for types where the type in the component model is statically known at compile-time.This work is also motivated by unlocking half of the fuzzing possiblities in https://github.com/bytecodealliance/wasmtime/issues/4307
alexcrichton labeled issue #4310:
For core wasm Wasmtime offers the
FuncandTypedFuncAPIs for calling into WebAssembly. The current intention is to provide the same for the component model. Currently theTypedFuncAPI exists, but theFuncAPI doesn't actually support calls.The intended use case for this feature is for something like the wasmtime CLI where it wants to be able to call any component it loads so we can't statically enumerate the signatures ahead of time. It's expected that this version of calling a component is slower (perhaps significantly so) than calling a typed function.
Currently I don't have many ideas about how the implementation will be done. The rough idea is that there'd be some sort of
wasmtime::Valequivalent but for the component model. Like withValthe actual value iteslf is "tagged" with the type information. The actual implementation of this is going to be much trickier than core wasm becauseValonly deals with primitives and a component model value can recursively contain other component model values. This will likely imply a significant overhead in terms of allocations, indirection, and management.I do not think that the
wasmtime::component::Valtype will implement any ofComponentValue,Lift, orLower. Those are intended only for types where the type in the component model is statically known at compile-time.This work is also motivated by unlocking half of the fuzzing possiblities in https://github.com/bytecodealliance/wasmtime/issues/4307
alexcrichton commented on issue #4310:
One other thing worth mentioning here is that the support here not only applies to
wasmtime::component::Funcbut also thewasmtime::component::Linkertype. Ideally a host function can be defined generically with a runtime-defined signature which allows other interesting forms of fuzzing and such. My hope would be that if untyped values work inFuncit would be relatively easy to add support toLinkerto do the same thing.
dicej commented on issue #4310:
I'm going to start experimenting with this today.
dicej commented on issue #4310:
Quick update: I've mostly finished with this -- just fleshing out the test suite. Should have a PR up today.
alexcrichton commented on issue #4310:
Implemented in https://github.com/bytecodealliance/wasmtime/pull/4442
alexcrichton closed issue #4310:
For core wasm Wasmtime offers the
FuncandTypedFuncAPIs for calling into WebAssembly. The current intention is to provide the same for the component model. Currently theTypedFuncAPI exists, but theFuncAPI doesn't actually support calls.The intended use case for this feature is for something like the wasmtime CLI where it wants to be able to call any component it loads so we can't statically enumerate the signatures ahead of time. It's expected that this version of calling a component is slower (perhaps significantly so) than calling a typed function.
Currently I don't have many ideas about how the implementation will be done. The rough idea is that there'd be some sort of
wasmtime::Valequivalent but for the component model. Like withValthe actual value iteslf is "tagged" with the type information. The actual implementation of this is going to be much trickier than core wasm becauseValonly deals with primitives and a component model value can recursively contain other component model values. This will likely imply a significant overhead in terms of allocations, indirection, and management.I do not think that the
wasmtime::component::Valtype will implement any ofComponentValue,Lift, orLower. Those are intended only for types where the type in the component model is statically known at compile-time.This work is also motivated by unlocking half of the fuzzing possiblities in https://github.com/bytecodealliance/wasmtime/issues/4307
Last updated: Dec 13 2025 at 21:03 UTC