From 19f8d94959a78d6251a51c74195232e56a02a865 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 28 Jan 2022 09:47:05 -0800 Subject: [PATCH] Expand on activations table invariants comment in `libcalls.rs` --- crates/runtime/src/libcalls.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/runtime/src/libcalls.rs b/crates/runtime/src/libcalls.rs index 841dfaa1a2..a6b2911672 100644 --- a/crates/runtime/src/libcalls.rs +++ b/crates/runtime/src/libcalls.rs @@ -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);