Skip to content

Commit

Permalink
Use table.fill in externref-xform (TODO)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslihotzki committed May 22, 2023
1 parent a9dea47 commit 85c8e1d
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/externref-xform/src/lib.rs
Expand Up @@ -648,19 +648,12 @@ impl Transform<'_> {
// Note that we pave over all our stack slots with `ref.null` to ensure
// that the table doesn't accidentally hold a strong reference to items
// no longer in use by our wasm instance.
//
// TODO: use `table.fill` once that's spec'd
if externref_stack > 0 {
for i in 0..externref_stack {
body.local_get(fp);
if i > 0 {
body.i32_const(i).binop(BinaryOp::I32Add);
}
body.ref_null(ValType::Externref);
body.table_set(self.table);
}

body.local_get(fp)
.ref_null(ValType::Externref)
.i32_const(externref_stack)
.table_fill(self.table)
.local_get(fp)
.i32_const(externref_stack)
.binop(BinaryOp::I32Add)
.global_set(self.stack_pointer);
Expand Down

0 comments on commit 85c8e1d

Please sign in to comment.