|
41 | 41 | package com.oracle.graal.python.lib;
|
42 | 42 |
|
43 | 43 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
| 44 | +import com.oracle.graal.python.builtins.objects.floats.PFloat; |
44 | 45 | import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
|
45 |
| -import com.oracle.graal.python.nodes.object.BuiltinClassProfiles.InlineIsBuiltinClassProfile; |
46 | 46 | import com.oracle.graal.python.nodes.object.InlinedGetClassNode;
|
47 |
| -import com.oracle.truffle.api.dsl.Bind; |
48 | 47 | import com.oracle.truffle.api.dsl.Cached;
|
| 48 | +import com.oracle.truffle.api.dsl.GenerateInline; |
49 | 49 | import com.oracle.truffle.api.dsl.GenerateUncached;
|
50 | 50 | import com.oracle.truffle.api.dsl.Specialization;
|
51 | 51 | import com.oracle.truffle.api.nodes.Node;
|
|
54 | 54 | * Equivalent of CPython's {@code PyFloat_Check}.
|
55 | 55 | */
|
56 | 56 | @GenerateUncached
|
| 57 | +@GenerateInline |
57 | 58 | public abstract class PyFloatCheckNode extends Node {
|
58 |
| - public abstract boolean execute(Object object); |
| 59 | + public abstract boolean execute(Node inliningTarget, Object object); |
59 | 60 |
|
60 | 61 | @Specialization
|
61 | 62 | static boolean doDouble(@SuppressWarnings("unused") Double object) {
|
62 | 63 | return true;
|
63 | 64 | }
|
64 | 65 |
|
65 | 66 | @Specialization
|
66 |
| - static boolean doGeneric(Object object, |
67 |
| - @Bind("this") Node inliningTarget, |
68 |
| - @Cached InlineIsBuiltinClassProfile isBuiltinClass, |
| 67 | + static boolean doPFloat(@SuppressWarnings("unused") PFloat object) { |
| 68 | + return true; |
| 69 | + } |
| 70 | + |
| 71 | + @Specialization |
| 72 | + static boolean doGeneric(Node inliningTarget, Object object, |
69 | 73 | @Cached InlinedGetClassNode getClassNode,
|
70 | 74 | @Cached IsSubtypeNode isSubtypeNode) {
|
71 |
| - Object clazz = getClassNode.execute(inliningTarget, object); |
72 |
| - if (isBuiltinClass.profileIsBuiltinClass(inliningTarget, clazz, PythonBuiltinClassType.PFloat)) { |
73 |
| - return true; |
74 |
| - } |
75 |
| - return isSubtypeNode.execute(clazz, PythonBuiltinClassType.PFloat); |
| 75 | + // PyFloat_CheckExact is implicitly checked in IsSubtypeNode |
| 76 | + return isSubtypeNode.execute(getClassNode.execute(inliningTarget, object), PythonBuiltinClassType.PFloat); |
76 | 77 | }
|
77 | 78 |
|
78 | 79 | public static PyFloatCheckNode getUncached() {
|
|
0 commit comments