Skip to content

Commit 54873c3

Browse files
committed
Fix: do not use exklusive guards with 'Fallback' annotation.
1 parent b9c92e7 commit 54873c3

File tree

1 file changed

+12
-10
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

1 file changed

+12
-10
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeNodes.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ private static PythonAbstractClass[] cast(Object[] arr) {
537537
public abstract static class IsSameTypeNode extends PNodeWithContext {
538538
@Child private CExtNodes.PointerCompareNode pointerCompareNode;
539539

540-
protected final boolean fastCheck;
540+
private final boolean fastCheck;
541541

542542
public IsSameTypeNode(boolean fastCheck) {
543543
this.fastCheck = fastCheck;
@@ -550,16 +550,11 @@ boolean doManaged(PythonManagedClass left, PythonManagedClass right) {
550550
return left == right;
551551
}
552552

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
562554
boolean doNativeSlow(PythonAbstractNativeObject left, PythonAbstractNativeObject right) {
555+
if (fastCheck) {
556+
return doNativeFast(left, right);
557+
}
563558
if (doNativeFast(left, right)) {
564559
return true;
565560
}
@@ -575,6 +570,13 @@ boolean doOther(@SuppressWarnings("unused") Object left, @SuppressWarnings("unus
575570
return false;
576571
}
577572

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+
578580
@TruffleBoundary
579581
public static boolean doSlowPath(Object left, Object right) {
580582
if (left instanceof PythonManagedClass && right instanceof PythonManagedClass) {

0 commit comments

Comments
 (0)