pub enum CallMode {
DefinedExport,
DeclaredExport,
DefinedImport,
DeclaredImport,
}
Expand description
Modes of calling a WebAssembly or host function.
Each mode may have a slightly different codegen for some types, so
Function::call
takes this as a parameter to know in what context
the invocation is happening within.
Variants§
DefinedExport
A defined export is being called.
This typically means that a code generator is generating a shim function to get exported from a WebAssembly module and the shim is calling a native language function defined within the wasm module. In this mode arguments are being lifted from wasm types to interface types, and results are being lowered.
DeclaredExport
A declared export is being called.
This typically means that a code generator is generating calls to a WebAssembly module, for example a JS host calling a WebAssembly instance. In this mode the native language’s arguments are being lowered to wasm values and the results of the function are lifted back into the native language.
DefinedImport
A defined import is being called.
This is typically used for code generators that are creating bindings in a host for a function imported by WebAssembly. In this mode a function with a wasm signature is generated and that function’s wasm arguments are lifted into the native language’s arguments. The results are then lowered back into wasm arguments to return.
DeclaredImport
A declared import is being called
This is typically used for code generators that are calling an imported function from within a wasm module. In this mode native language arguments are lowered to wasm values, and the results of the import are lifted back into the native language.