88import com .oracle .truffle .api .CompilerDirectives ;
99import com .oracle .truffle .api .TruffleLanguage ;
1010import com .oracle .truffle .api .frame .FrameDescriptor ;
11- import org . graalvm . collections . EconomicMap ;
11+ import java . util . HashMap ;
1212
1313/**
1414 * This root node is the base of all root node which can be memoized in LKQL.
@@ -19,8 +19,13 @@ public abstract class MemoizedRootNode<K, V> extends BaseRootNode {
1919
2020 // ----- Attributes -----
2121
22- /** Cache to store the root node execution results. */
23- protected final EconomicMap <K , V > memoizationCache ;
22+ /**
23+ * Cache to store the root node execution results.
24+ *
25+ * IMPORTANT: We don't use the {@link org.graalvm.collections.EconomicMap} class to represent
26+ * the cache because there is an implementation error causing invalid cache hits.
27+ */
28+ protected final HashMap <K , V > memoizationCache ;
2429
2530 // ----- Constructors -----
2631
@@ -35,7 +40,7 @@ protected MemoizedRootNode(
3540 final FrameDescriptor frameDescriptor
3641 ) {
3742 super (language , frameDescriptor );
38- this .memoizationCache = EconomicMap . create ();
43+ this .memoizationCache = new HashMap <> ();
3944 }
4045
4146 // ----- Instance methods -----
@@ -59,7 +64,7 @@ protected boolean isMemoized(final K key) {
5964 */
6065 @ CompilerDirectives .TruffleBoundary
6166 protected V getMemoized (final K key ) {
62- return this .memoizationCache .get (key , null );
67+ return this .memoizationCache .get (key );
6368 }
6469
6570 /**
0 commit comments