@@ -537,7 +537,7 @@ private static PythonAbstractClass[] cast(Object[] arr) {
537
537
public abstract static class IsSameTypeNode extends PNodeWithContext {
538
538
@ Child private CExtNodes .PointerCompareNode pointerCompareNode ;
539
539
540
- protected final boolean fastCheck ;
540
+ private final boolean fastCheck ;
541
541
542
542
public IsSameTypeNode (boolean fastCheck ) {
543
543
this .fastCheck = fastCheck ;
@@ -550,16 +550,11 @@ boolean doManaged(PythonManagedClass left, PythonManagedClass right) {
550
550
return left == right ;
551
551
}
552
552
553
- @ Specialization (guards = "fastCheck" )
554
- boolean doNativeFast (PythonAbstractNativeObject left , PythonAbstractNativeObject right ) {
555
- // This check is a bit dangerous since we cannot be sure about the code that is running.
556
- // Currently, we assume that the pointer object is a Sulong pointer and for this it's
557
- // fine.
558
- return left .object .equals (right .object );
559
- }
560
-
561
- @ Specialization (guards = "!fastCheck" )
553
+ @ Specialization
562
554
boolean doNativeSlow (PythonAbstractNativeObject left , PythonAbstractNativeObject right ) {
555
+ if (fastCheck ) {
556
+ return doNativeFast (left , right );
557
+ }
563
558
if (doNativeFast (left , right )) {
564
559
return true ;
565
560
}
@@ -575,6 +570,13 @@ boolean doOther(@SuppressWarnings("unused") Object left, @SuppressWarnings("unus
575
570
return false ;
576
571
}
577
572
573
+ private static boolean doNativeFast (PythonAbstractNativeObject left , PythonAbstractNativeObject right ) {
574
+ // This check is a bit dangerous since we cannot be sure about the code that is running.
575
+ // Currently, we assume that the pointer object is a Sulong pointer and for this it's
576
+ // fine.
577
+ return left .object .equals (right .object );
578
+ }
579
+
578
580
@ TruffleBoundary
579
581
public static boolean doSlowPath (Object left , Object right ) {
580
582
if (left instanceof PythonManagedClass && right instanceof PythonManagedClass ) {
0 commit comments