Skip to content

Commit 8f9dab1

Browse files
committed
first draft of async lift/lower for Rust generator
Signed-off-by: Joel Dice <joel.dice@fermyon.com> more work on async lift/lower Signed-off-by: Joel Dice <joel.dice@fermyon.com> emit callback (and no post-return) for async exports Signed-off-by: Joel Dice <joel.dice@fermyon.com> flesh out async support Signed-off-by: Joel Dice <joel.dice@fermyon.com> flesh out async_support.rs Signed-off-by: Joel Dice <joel.dice@fermyon.com> add future and stream support Signed-off-by: Joel Dice <joel.dice@fermyon.com> support `task.wait` Signed-off-by: Joel Dice <joel.dice@fermyon.com> compile fixes Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 5fe5336 commit 8f9dab1

File tree

14 files changed

+1613
-232
lines changed

14 files changed

+1613
-232
lines changed

Cargo.lock

Lines changed: 91 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ indexmap = "2.0.0"
3232
prettyplease = "0.2.20"
3333
syn = { version = "2.0", features = ["printing"] }
3434

35-
wasmparser = "0.217.0"
36-
wasm-encoder = "0.217.0"
37-
wasm-metadata = "0.217.0"
38-
wit-parser = "0.217.0"
39-
wit-component = "0.217.0"
35+
wasmparser = { path = "../wasm-tools/crates/wasmparser" }#{ git = "https://github.com/dicej/wasm-tools", branch = "async" }
36+
wasm-encoder = { path = "../wasm-tools/crates/wasm-encoder" }#{ git = "https://github.com/dicej/wasm-tools", branch = "async" }
37+
wasm-metadata = { path = "../wasm-tools/crates/wasm-metadata" }#{ git = "https://github.com/dicej/wasm-tools", branch = "async" }
38+
wit-parser = { path = "../wasm-tools/crates/wit-parser" }#{ git = "https://github.com/dicej/wasm-tools", branch = "async" }
39+
wit-component = { path = "../wasm-tools/crates/wit-component" }#{ git = "https://github.com/dicej/wasm-tools", branch = "async" }
4040

4141
wit-bindgen-core = { path = 'crates/core', version = '0.32.0' }
4242
wit-bindgen-c = { path = 'crates/c', version = '0.32.0' }

crates/c/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,6 +1750,7 @@ impl InterfaceGenerator<'_> {
17501750
LiftLower::LowerArgsLiftResults,
17511751
func,
17521752
&mut f,
1753+
false,
17531754
);
17541755

17551756
let FunctionBindgen {
@@ -1822,6 +1823,7 @@ impl InterfaceGenerator<'_> {
18221823
LiftLower::LiftArgsLowerResults,
18231824
func,
18241825
&mut f,
1826+
false,
18251827
);
18261828
let FunctionBindgen { src, .. } = f;
18271829
self.src.c_adapters(&src);
@@ -1852,7 +1854,7 @@ impl InterfaceGenerator<'_> {
18521854

18531855
let mut f = FunctionBindgen::new(self, c_sig, &import_name);
18541856
f.params = params;
1855-
abi::post_return(f.gen.resolve, func, &mut f);
1857+
abi::post_return(f.gen.resolve, func, &mut f, false);
18561858
let FunctionBindgen { src, .. } = f;
18571859
self.src.c_fns(&src);
18581860
self.src.c_fns("}\n");
@@ -2753,7 +2755,7 @@ impl Bindgen for FunctionBindgen<'_, '_> {
27532755
self.src.push_str(");\n");
27542756
}
27552757

2756-
Instruction::CallInterface { func } => {
2758+
Instruction::CallInterface { func, .. } => {
27572759
let mut args = String::new();
27582760
for (i, (op, (byref, _))) in operands.iter().zip(&self.sig.params).enumerate() {
27592761
if i > 0 {

0 commit comments

Comments
 (0)