8
8
import com .oracle .truffle .api .CompilerDirectives ;
9
9
import com .oracle .truffle .api .TruffleLanguage ;
10
10
import com .oracle .truffle .api .frame .FrameDescriptor ;
11
- import org . graalvm . collections . EconomicMap ;
11
+ import java . util . HashMap ;
12
12
13
13
/**
14
14
* 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 {
19
19
20
20
// ----- Attributes -----
21
21
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 ;
24
29
25
30
// ----- Constructors -----
26
31
@@ -35,7 +40,7 @@ protected MemoizedRootNode(
35
40
final FrameDescriptor frameDescriptor
36
41
) {
37
42
super (language , frameDescriptor );
38
- this .memoizationCache = EconomicMap . create ();
43
+ this .memoizationCache = new HashMap <> ();
39
44
}
40
45
41
46
// ----- Instance methods -----
@@ -59,7 +64,7 @@ protected boolean isMemoized(final K key) {
59
64
*/
60
65
@ CompilerDirectives .TruffleBoundary
61
66
protected V getMemoized (final K key ) {
62
- return this .memoizationCache .get (key , null );
67
+ return this .memoizationCache .get (key );
63
68
}
64
69
65
70
/**
0 commit comments