|
223 | 223 | import com.oracle.truffle.api.dsl.TypeSystemReference;
|
224 | 224 | import com.oracle.truffle.api.frame.VirtualFrame;
|
225 | 225 | import com.oracle.truffle.api.interop.InteropLibrary;
|
226 |
| -import com.oracle.truffle.api.interop.UnsupportedMessageException; |
227 | 226 | import com.oracle.truffle.api.library.CachedLibrary;
|
228 | 227 | import com.oracle.truffle.api.nodes.ControlFlowException;
|
229 | 228 | import com.oracle.truffle.api.nodes.Node;
|
@@ -1431,25 +1430,14 @@ static boolean doManaged(PythonBuiltinClass left, PythonBuiltinClassType right)
|
1431 | 1430 |
|
1432 | 1431 | @Specialization
|
1433 | 1432 | static boolean doNativeSingleContext(PythonAbstractNativeObject left, PythonAbstractNativeObject right,
|
1434 |
| - @CachedLibrary(limit = "3") InteropLibrary lib1, |
1435 |
| - @CachedLibrary(limit = "3") InteropLibrary lib2) { |
1436 |
| - if (lib1.isPointer(left.getPtr())) { |
1437 |
| - if (lib2.isPointer(right.getPtr())) { |
1438 |
| - try { |
1439 |
| - return lib1.asPointer(left.getPtr()) == lib2.asPointer(right.getPtr()); |
1440 |
| - } catch (UnsupportedMessageException e) { |
1441 |
| - throw CompilerDirectives.shouldNotReachHere(e); |
1442 |
| - } |
1443 |
| - } else { |
1444 |
| - return false; |
1445 |
| - } |
1446 |
| - } else { |
1447 |
| - if (lib2.isPointer(right.getPtr())) { |
1448 |
| - return false; |
1449 |
| - } else { |
1450 |
| - return lib1.isIdentical(left.getPtr(), right.getPtr(), lib2); |
1451 |
| - } |
| 1433 | + @CachedLibrary(limit = "1") InteropLibrary lib) { |
| 1434 | + if (left == right) { |
| 1435 | + return true; |
| 1436 | + } |
| 1437 | + if (left.getPtr() instanceof Long && right.getPtr() instanceof Long) { |
| 1438 | + return (long) left.getPtr() == (long) right.getPtr(); |
1452 | 1439 | }
|
| 1440 | + return lib.isIdentical(left.getPtr(), right.getPtr(), lib); |
1453 | 1441 | }
|
1454 | 1442 |
|
1455 | 1443 | @Fallback
|
|
0 commit comments