Skip to content

Commit f587121

Browse files
committed
Add missing specialization for comparing float and boolean
1 parent d5a3599 commit f587121

File tree

1 file changed

+13
-6
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/floats

1 file changed

+13
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/floats/FloatBuiltins.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public abstract static class AbstractComparisonNode extends PythonBinaryBuiltinN
701701
protected abstract boolean op(double a, double b);
702702

703703
@Specialization
704-
boolean eqDbDb(double a, double b) {
704+
boolean doDD(double a, double b) {
705705
return op(a, b);
706706
}
707707

@@ -710,8 +710,8 @@ boolean doDI(double a, int b) {
710710
return op(a, b);
711711
}
712712

713-
@Specialization(guards = "check.execute(inliningTarget, bObj)", replaces = "eqDbDb", limit = "1")
714-
boolean eqODb(Object aObj, Object bObj,
713+
@Specialization(guards = "check.execute(inliningTarget, bObj)", replaces = "doDD", limit = "1")
714+
boolean doOO(Object aObj, Object bObj,
715715
@SuppressWarnings("unused") @Bind("this") Node inliningTarget,
716716
@SuppressWarnings("unused") @Cached PyFloatCheckNode check,
717717
@Shared @Cached CastToJavaDoubleNode cast) {
@@ -728,7 +728,7 @@ boolean doOI(Object aObj, int b,
728728
}
729729

730730
@Specialization
731-
boolean eqOLn(Object aObj, long b,
731+
boolean doOL(Object aObj, long b,
732732
@Bind("this") Node inliningTarget,
733733
@Shared @Cached CastToJavaDoubleNode cast,
734734
@Cached InlinedConditionProfile longFitsToDoubleProfile) {
@@ -737,15 +737,22 @@ boolean eqOLn(Object aObj, long b,
737737
}
738738

739739
@Specialization
740-
boolean eqOPI(Object aObj, PInt b,
740+
boolean doOPInt(Object aObj, PInt b,
741741
@Shared @Cached CastToJavaDoubleNode cast) {
742742
double a = castToDoubleChecked(aObj, cast);
743743
return op(compareDoubleToLargeInt(a, b), 0.0);
744744
}
745745

746+
@Specialization
747+
boolean doOB(Object aObj, boolean b,
748+
@Shared @Cached CastToJavaDoubleNode cast) {
749+
double a = castToDoubleChecked(aObj, cast);
750+
return op(a, b ? 1 : 0);
751+
}
752+
746753
@Fallback
747754
@SuppressWarnings("unused")
748-
static PNotImplemented eq(Object a, Object b) {
755+
static PNotImplemented fallback(Object a, Object b) {
749756
return PNotImplemented.NOT_IMPLEMENTED;
750757
}
751758

0 commit comments

Comments
 (0)