Skip to content

Commit 6869a15

Browse files
raph-amiardHugoGGuerrier
authored andcommitted
Perf: Don't store an uncached interopLibrary in LKQLValues
1 parent 38e16b0 commit 6869a15

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lkql_jit/language/src/main/java/com/adacore/lkql_jit/runtime/values/bases/BasicLKQLValue.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
@ExportLibrary(InteropLibrary.class)
1919
public abstract class BasicLKQLValue implements LKQLValue {
2020

21-
protected final InteropLibrary thisUncachedLibrary = InteropLibrary.getUncached(this);
21+
public InteropLibrary getUncachedLibrary() {
22+
return InteropLibrary.getUncached(this);
23+
}
2224

2325
// ----- Value methods -----
2426

@@ -47,21 +49,21 @@ public String toDisplayString(@SuppressWarnings("unused") boolean allowSideEffec
4749

4850
@Override
4951
public String toString() {
50-
return (String) thisUncachedLibrary.toDisplayString(this);
52+
return (String) getUncachedLibrary().toDisplayString(this);
5153
}
5254

5355
@Override
5456
public boolean equals(Object o) {
5557
if (this == o) return true;
5658
if (!(o instanceof BasicLKQLValue other)) return false;
5759
InteropLibrary otherUncached = InteropLibrary.getUncached(other);
58-
return thisUncachedLibrary.isIdentical(this, other, otherUncached);
60+
return getUncachedLibrary().isIdentical(this, other, otherUncached);
5961
}
6062

6163
@Override
6264
public int hashCode() {
6365
try {
64-
return thisUncachedLibrary.identityHashCode(this);
66+
return getUncachedLibrary().identityHashCode(this);
6567
} catch (UnsupportedMessageException e) {
6668
throw LKQLRuntimeException.shouldNotHappen(
6769
"All LKQL values must export an 'identityHashCode' message"

0 commit comments

Comments
 (0)