|
69 | 69 | import com.oracle.truffle.api.nodes.Node;
|
70 | 70 | import com.oracle.truffle.api.profiles.ConditionProfile;
|
71 | 71 | import com.oracle.truffle.api.profiles.IntValueProfile;
|
72 |
| -import com.oracle.truffle.llvm.spi.ReferenceLibrary; |
73 | 72 |
|
74 | 73 | @ExportLibrary(InteropLibrary.class)
|
75 | 74 | public final class NativeReferenceCache implements TruffleObject {
|
@@ -118,15 +117,15 @@ static Object doNativeWrapper(Object pointerObject, @SuppressWarnings("unused")
|
118 | 117 | return pointerObject;
|
119 | 118 | }
|
120 | 119 |
|
121 |
| - @Specialization(guards = {"!isResolved(pointerObject)", "ref != null", "isSame(referenceLibrary, pointerObject, ref)"}, // |
| 120 | + @Specialization(guards = {"!isResolved(pointerObject)", "ref != null", "isSame(interoplibrary, pointerObject, ref)"}, // |
122 | 121 | rewriteOn = {CannotCastException.class, InvalidCacheEntry.class}, //
|
123 | 122 | assumptions = "singleContextAssumption()", //
|
124 | 123 | limit = "1")
|
125 | 124 | static PythonAbstractNativeObject doCachedPointer(@SuppressWarnings("unused") Object pointerObject, @SuppressWarnings("unused") Object refCnt, boolean steal,
|
126 | 125 | @Shared("context") @CachedContext(PythonLanguage.class) @SuppressWarnings("unused") PythonContext context,
|
127 | 126 | @Shared("stealProfile") @Cached("createBinaryProfile()") ConditionProfile stealProfile,
|
128 | 127 | @Cached("lookupNativeReference(context, pointerObject, refCnt)") NativeObjectReference ref,
|
129 |
| - @CachedLibrary("ref.ptrObject") @SuppressWarnings("unused") ReferenceLibrary referenceLibrary) { |
| 128 | + @CachedLibrary(limit = "2") @SuppressWarnings("unused") InteropLibrary interoplibrary) { |
130 | 129 | PythonAbstractNativeObject wrapper = ref.get();
|
131 | 130 | if (wrapper != null) {
|
132 | 131 | // 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,
|
207 | 206 | return pointerObject;
|
208 | 207 | }
|
209 | 208 |
|
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); |
212 | 211 | }
|
213 | 212 |
|
214 | 213 | static NativeObjectReference lookupNativeReference(PythonContext context, Object pointerObject, Object refCnt) {
|
|
0 commit comments