Skip to content

Commit bcafc82

Browse files
committed
remove ReferenceLibrary from NativeReferenceCache
1 parent d3f514a commit bcafc82

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/NativeReferenceCache.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
import com.oracle.truffle.api.nodes.Node;
7070
import com.oracle.truffle.api.profiles.ConditionProfile;
7171
import com.oracle.truffle.api.profiles.IntValueProfile;
72-
import com.oracle.truffle.llvm.spi.ReferenceLibrary;
7372

7473
@ExportLibrary(InteropLibrary.class)
7574
public final class NativeReferenceCache implements TruffleObject {
@@ -118,15 +117,15 @@ static Object doNativeWrapper(Object pointerObject, @SuppressWarnings("unused")
118117
return pointerObject;
119118
}
120119

121-
@Specialization(guards = {"!isResolved(pointerObject)", "ref != null", "isSame(referenceLibrary, pointerObject, ref)"}, //
120+
@Specialization(guards = {"!isResolved(pointerObject)", "ref != null", "isSame(interoplibrary, pointerObject, ref)"}, //
122121
rewriteOn = {CannotCastException.class, InvalidCacheEntry.class}, //
123122
assumptions = "singleContextAssumption()", //
124123
limit = "1")
125124
static PythonAbstractNativeObject doCachedPointer(@SuppressWarnings("unused") Object pointerObject, @SuppressWarnings("unused") Object refCnt, boolean steal,
126125
@Shared("context") @CachedContext(PythonLanguage.class) @SuppressWarnings("unused") PythonContext context,
127126
@Shared("stealProfile") @Cached("createBinaryProfile()") ConditionProfile stealProfile,
128127
@Cached("lookupNativeReference(context, pointerObject, refCnt)") NativeObjectReference ref,
129-
@CachedLibrary("ref.ptrObject") @SuppressWarnings("unused") ReferenceLibrary referenceLibrary) {
128+
@CachedLibrary(limit = "2") @SuppressWarnings("unused") InteropLibrary interoplibrary) {
130129
PythonAbstractNativeObject wrapper = ref.get();
131130
if (wrapper != null) {
132131
// If this is stealing the reference, we need to fixup the managed reference count.
@@ -207,8 +206,8 @@ private static Object lookupNativeObjectReference(Object pointerObject, int idx,
207206
return pointerObject;
208207
}
209208

210-
static boolean isSame(ReferenceLibrary referenceLibrary, Object pointerObject, NativeObjectReference cachedObjectRef) {
211-
return referenceLibrary.isSame(cachedObjectRef.ptrObject, pointerObject);
209+
static boolean isSame(InteropLibrary interoplibrary, Object pointerObject, NativeObjectReference cachedObjectRef) {
210+
return interoplibrary.isIdentical(cachedObjectRef.ptrObject, pointerObject, interoplibrary);
212211
}
213212

214213
static NativeObjectReference lookupNativeReference(PythonContext context, Object pointerObject, Object refCnt) {

0 commit comments

Comments
 (0)