bytecodealliance / bytecodealliance/wasmtime

FACT can't handle async-to-async adapters using memory64

Open
#13,979 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:component-model wasm-proposal:memory64
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

The component-model-memory64 integration is still a work in progress but I wanted to note this nonetheless.

This input:

```wasm
(component
(component $A
(core module $a
(memory (export "memory") i64 1)
(func (export "realloc") (param i64 i64 i64 i64) (result i64) (i64.const 128))
(func (export "run") (result i32) (i32.const 0))
(func (export "cb") (param i32 i32 i32) (result i32) (i32.const 0))
)
(core instance $a (instantiate $a))
(type $r (tuple u64 u64 u64))
(func (export "run") async (result $r)
(canon lift (core func $a "run") async
(callback (func $a "cb"))
(memory $a "memory")
(realloc (func $a "realloc"))))
)
(instance $ia (instantiate $A))

(component $B
(type $r (tuple u64 u64 u64))
(import "run" (func $f async (result $r)))
(core module $libc
(memory (export "memory") 1)
(func (export "realloc") (param i32 i32 i32 i32) (result i32) (i32.const 128))
)
(core instance $libc (instantiate $libc))
(core func $lower
(canon lower (func $f) (memory $libc "memory") (realloc (func $libc "realloc"))))
(core module $main
(import "" "f" (func (param i32)))
(func (export "run") (call 0 (i32.const 256)))
)
(core instance $imain (instantiate $main (with "" (instance (export "f" (func $lower))))))
(func (export "run") (canon lift (core func $imain "run")))
)
(instance $ib (instantiate $B (with "run" (func $ia "run"))))
(export "run" (func $ib "run"))
)
```

fails with:

```
$ cargo run compile async-retptr64.wat -W component-model-memory64
Finished `dev` profile [unoptimized + debuginfo] target(s) in 20.00s
Running `/home/alex/code/wasmtime2/target/debug/wasmtime compile async-retptr64.wat -W component-model-memory64`

thread 'main' (2603957) panicked at crates/environ/src/fact/trampoline.rs:1093:13:
assertion `left == right` failed
left: I64
right: I32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' (2603957) panicked at crates/environ/src/fact/trampoline.rs:4607:13:
temporary local not free'd
stack backtrace:
0: 0x5ee098ae86e8 - std[bcb96dfbba0ab899]::backtrace_rs::backtrace::libunwind::trace
at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
...
45: 0x5ee0938d5325 - _start
46: 0x0 -

thread 'main' (2603957) panicked at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/panicking.rs:233:5:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
zsh: IOT instruction (core dumped) cargo run compile async-retptr64.wat -W component-model-memory64
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.