@@ -1438,8 +1438,22 @@ private static boolean executeCFunction(int op, Object a, Object b, InteropLibra
1438
1438
}
1439
1439
}
1440
1440
1441
+ @ Specialization (guards = "isEq(opName)" , limit = "2" )
1442
+ static boolean doEq (@ SuppressWarnings ("unused" ) String opName , PythonAbstractNativeObject a , PythonAbstractNativeObject b ,
1443
+ @ CachedLibrary ("a.getPtr()" ) InteropLibrary aLib ,
1444
+ @ CachedLibrary (limit = "3" ) InteropLibrary bLib ) {
1445
+ return aLib .isIdentical (a .getPtr (), b .getPtr (), bLib );
1446
+ }
1447
+
1448
+ @ Specialization (guards = "isNe(opName)" , limit = "2" )
1449
+ static boolean doNe (@ SuppressWarnings ("unused" ) String opName , PythonAbstractNativeObject a , PythonAbstractNativeObject b ,
1450
+ @ CachedLibrary ("a.getPtr()" ) InteropLibrary aLib ,
1451
+ @ CachedLibrary (limit = "3" ) InteropLibrary bLib ) {
1452
+ return !aLib .isIdentical (a .getPtr (), b .getPtr (), bLib );
1453
+ }
1454
+
1441
1455
@ Specialization (guards = "cachedOpName.equals(opName)" , limit = "1" )
1442
- public boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeObject a , PythonNativeObject b ,
1456
+ static boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeObject a , PythonNativeObject b ,
1443
1457
@ Shared ("cachedOpName" ) @ Cached ("opName" ) @ SuppressWarnings ("unused" ) String cachedOpName ,
1444
1458
@ Shared ("op" ) @ Cached (value = "findOp(opName)" , allowUncached = true ) int op ,
1445
1459
@ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ,
@@ -1448,7 +1462,7 @@ public boolean execute(@SuppressWarnings("unused") String opName, PythonNativeOb
1448
1462
}
1449
1463
1450
1464
@ Specialization (guards = "cachedOpName.equals(opName)" , limit = "1" )
1451
- public boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeObject a , long b ,
1465
+ static boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeObject a , long b ,
1452
1466
@ Shared ("cachedOpName" ) @ Cached ("opName" ) @ SuppressWarnings ("unused" ) String cachedOpName ,
1453
1467
@ Shared ("op" ) @ Cached (value = "findOp(opName)" , allowUncached = true ) int op ,
1454
1468
@ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ,
@@ -1457,15 +1471,15 @@ public boolean execute(@SuppressWarnings("unused") String opName, PythonNativeOb
1457
1471
}
1458
1472
1459
1473
@ Specialization (guards = "cachedOpName.equals(opName)" , limit = "1" )
1460
- public boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeVoidPtr a , long b ,
1474
+ static boolean execute (@ SuppressWarnings ("unused" ) String opName , PythonNativeVoidPtr a , long b ,
1461
1475
@ Shared ("cachedOpName" ) @ Cached ("opName" ) @ SuppressWarnings ("unused" ) String cachedOpName ,
1462
1476
@ Shared ("op" ) @ Cached (value = "findOp(opName)" , allowUncached = true ) int op ,
1463
1477
@ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ,
1464
1478
@ Shared ("importCAPISymbolNode" ) @ Cached ImportCAPISymbolNode importCAPISymbolNode ) {
1465
1479
return executeCFunction (op , a .getPointerObject (), b , interopLibrary , importCAPISymbolNode );
1466
1480
}
1467
1481
1468
- public static int findOp (String specialMethodName ) {
1482
+ static int findOp (String specialMethodName ) {
1469
1483
for (int i = 0 ; i < SpecialMethodNames .COMPARE_OP_COUNT ; i ++) {
1470
1484
if (SpecialMethodNames .getCompareName (i ).equals (specialMethodName )) {
1471
1485
return i ;
@@ -1474,12 +1488,12 @@ public static int findOp(String specialMethodName) {
1474
1488
throw new RuntimeException ("The special method used for Python C API pointer comparison must be a constant literal (i.e., interned) string" );
1475
1489
}
1476
1490
1477
- public static PointerCompareNode create ( ) {
1478
- return PointerCompareNodeGen . create ( );
1491
+ static boolean isEq ( String opName ) {
1492
+ return SpecialMethodNames . __EQ__ . equals ( opName );
1479
1493
}
1480
1494
1481
- public static PointerCompareNode getUncached ( ) {
1482
- return PointerCompareNodeGen . getUncached ( );
1495
+ static boolean isNe ( String opName ) {
1496
+ return SpecialMethodNames . __NE__ . equals ( opName );
1483
1497
}
1484
1498
}
1485
1499
0 commit comments