bytecodealliance / bytecodealliance/wasmtime

Let `WasmTy` differentiate between passing ownership into Wasm vs a borrow

Open
#2,056 1 comment 0 reactions 0 assignees View on GitHub
wasmtime:api
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 16h
Merged PRs (30d)
135

Description

Only matters for reference types. But if we know the call is borrowing a reference type that will outlive the call, we don't need to add it into the activations table because the borrow checker already ensures it will live long enough.

Currently only `Func::{wrap,get}` will pass by value (and therefore need the activations table) while `Func::call` will pass borrows (and therefore we know the reference will outlive the call, and it doesn't need to go into the table).

See also https://github.com/bytecodealliance/wasmtime-dotnet/issues/27#issuecomment-662002571

Contributor guide

Open the contributing guide

Research direction

Start by tracing WasmTy and the Func::{wrap,get,call} paths described in the issue, then inspect how reference arguments enter the activations table. Confirm the existing ownership and borrow behavior before deciding how the type distinguishes them. Done means borrowed reference types passed through Func::call no longer require activation-table entries, while passed-by-value references still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.