Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Propose to provide an FVM implementation based on WasmEdge #1

Open
1 of 7 tasks
CaptainVincent opened this issue Aug 25, 2022 · 0 comments
Open
1 of 7 tasks
Assignees
Labels
enhancement New feature or request

Comments

@CaptainVincent
Copy link
Member

CaptainVincent commented Aug 25, 2022

Note: This is a root tracking issue

The goal of this project is to pass all test cases list in the wiki/test-bench. The roadmap to achieve this goal is broken into multiple stages.

Roadmap / Check List

  • Phase 1: Embedded Wasmedge
    pass hello-world test case (the one of integration tests) but simplify it without the need for binding any host functions.
    8ab3e9a
    Follow the build and run single test in tutorial, you can get the log as below
running 1 test
wasmtime results : Ok(0)
wasmedge result : Ok([WasmValue { ctx: WasmEdge_Value { Value: 0, Type: 127 }, ty: I32 }])
test hello_world ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.05s
  • Phase 2: (WIP) Binding host functions
  • Binding host functions through wasmedge-sys's vm interface
  • 13adbd7
    • make orgiginal hello-world test case (only use vm.abort())
      Follow the build and run single test steps in tutorial, you can get the log as below
    wasmtime results : Err(Trap { reason: Error(Envelope { inner: Mutex { data: Some(Exit(ExitCode { value: 16 }, "sample abort")), poisoned: false, .. } }) })
    [2022-08-25 17:20:09.563] [error] execution failed: unreachable, Code: 0x89
    [2022-08-25 17:20:09.563] [error]     In instruction: unreachable (0x00) , Bytecode offset: 0x000000e4
    [2022-08-25 17:20:09.563] [error]     When executing function name: "invoke"
    thread 'hello_world' panicked at 'called `Result::unwrap()` on an `Err` value: Core(Execution(Unreachable))', fvm/src/machine/engine.rs:458:14
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'hello_world' panicked at 'assertion failed: `(left == right)`
      left: `10`,
     right: `16`', testing/integration/tests/lib.rs:89:5
    test hello_world ... FAILED
    
    failures:
    
    failures:
        hello_world
    
    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.05s
    • The root cause is because host function return Wasmtime's Trap type and it should be catched and handle, but Wasmedge regarded it as a normal value and keep execute next unreachable byte code (need workaround)
    • finish all host functions binding in check list
  • Phase 3. Convert Wasmedge's return value as VM's result and add feature option to select engine use Wasmtime or Wasmedge
  • Phase 4. Pass integration test in the wiki/test-bench
  • Phase 5. Pass conformance test in the wiki/test-bench
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant