From 20ce60c7bddfba5f83c39ebcfd996acd98980c76 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Fri, 7 Nov 2025 20:42:10 +0000 Subject: [PATCH 1/3] fix(internal): use a plain Map as the backing cache for wrapped marshaller --- packages/internal/src/marshal/wrap-marshaller.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/internal/src/marshal/wrap-marshaller.js b/packages/internal/src/marshal/wrap-marshaller.js index 4cb0a571d01..3ece11d7ebc 100644 --- a/packages/internal/src/marshal/wrap-marshaller.js +++ b/packages/internal/src/marshal/wrap-marshaller.js @@ -89,8 +89,6 @@ const { slotToWrapper, wrapperToSlot } = (() => { const capacityOfDefaultCache = 50; -// TODO(https://github.com/Agoric/agoric-sdk/issues/12111) -// Check cost of using virtual-aware WeakMap in liveslots /** * @template K * @template V @@ -99,7 +97,7 @@ const capacityOfDefaultCache = 50; const makeDefaultCacheMap = weakKey => /** @type {WeakMapAPI} */ ( makeCacheMapKit(capacityOfDefaultCache, { - makeMap: weakKey ? WeakMap : Map, + makeMap: Map, }).cache ); From d6b0f21536e7ee629703d592c4f17b02d717d013 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Fri, 7 Nov 2025 21:24:01 +0000 Subject: [PATCH 2/3] fixup! fix(internal): use a plain Map as the backing cache for wrapped marshaller --- packages/internal/src/marshal/wrap-marshaller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/internal/src/marshal/wrap-marshaller.js b/packages/internal/src/marshal/wrap-marshaller.js index 3ece11d7ebc..75722a305a1 100644 --- a/packages/internal/src/marshal/wrap-marshaller.js +++ b/packages/internal/src/marshal/wrap-marshaller.js @@ -94,6 +94,7 @@ const capacityOfDefaultCache = 50; * @template V * @param {boolean} [weakKey] */ +// eslint-disable-next-line no-unused-vars const makeDefaultCacheMap = weakKey => /** @type {WeakMapAPI} */ ( makeCacheMapKit(capacityOfDefaultCache, { From 2d1547409409a6f887da3999700e45975d1ded08 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Mon, 10 Nov 2025 18:33:34 +0000 Subject: [PATCH 3/3] fixup! fix(internal): use a plain Map as the backing cache for wrapped marshaller --- packages/internal/src/marshal/wrap-marshaller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/internal/src/marshal/wrap-marshaller.js b/packages/internal/src/marshal/wrap-marshaller.js index 75722a305a1..37d2272ee65 100644 --- a/packages/internal/src/marshal/wrap-marshaller.js +++ b/packages/internal/src/marshal/wrap-marshaller.js @@ -94,11 +94,13 @@ const capacityOfDefaultCache = 50; * @template V * @param {boolean} [weakKey] */ -// eslint-disable-next-line no-unused-vars const makeDefaultCacheMap = weakKey => /** @type {WeakMapAPI} */ ( makeCacheMapKit(capacityOfDefaultCache, { - makeMap: Map, + // We use a Map even for weakKey as the assumption is that we run under + // liveslots which virtualizes WeakMap, and since the mapping is + // bidirectional by default, the key would be pinned anyway. + makeMap: weakKey ? Map : Map, }).cache );