Skip to content

Redesign grate execution flow to use a unified entry function and indirect call dispatch #442

@Yaxuan-w

Description

@Yaxuan-w

Since Wasm does not support machine-level function pointers and instead relies on function tables (table) and indirect calls (call_indirect), it is not possible to perform native-style function pointer jumps in Wasmtime.

Currently, each grate executes by name-based matching. For example, a system call such as open is matched to an exported function open_grate in the corresponding module.

In the redesigned scheme, all grates will expose a unified entry function (with the same name across modules). During handler registration, each grate records the corresponding function pointer from within the module (as seen from the C program’s perspective, but internally represented as a Wasm function reference). When Wasmtime enters the module through the unified entry function, it dispatches execution to the registered handler based on this function pointer.

Metadata

Metadata

Assignees

Labels

3iThreei related issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions