Skip to content

Commit

Permalink
Expand on activations table invariants comment in libcalls.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen authored and alexcrichton committed Feb 2, 2022
1 parent dc670ff commit 296596c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/runtime/src/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ pub unsafe extern "C" fn wasmtime_activations_table_insert_with_gc(
// Invariant: all `externref`s on the stack have an entry in the activations
// table. So we need to ensure that this `externref` is in the table
// *before* we GC, even though `insert_with_gc` will ensure that it is in
// the table *after* the GC.
// the table *after* the GC. This technically results in one more hash table
// look up than is strictly necessary -- which we could avoid by having an
// additional GC method that is aware of these GC-triggering references --
// but it isn't really a concern because this is already a slow path.
activations_table.insert_without_gc(externref.clone());

activations_table.insert_with_gc(externref, module_info_lookup);
Expand Down

0 comments on commit 296596c

Please sign in to comment.