Skip to content

Commit b093f63

Browse files
committed
Improve TypeNodes.ProfileClassNode for built-in classes
1 parent 737946c commit b093f63

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
import com.oracle.truffle.api.CompilerAsserts;
139139
import com.oracle.truffle.api.CompilerDirectives;
140140
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
141+
import com.oracle.truffle.api.dsl.Bind;
141142
import com.oracle.truffle.api.dsl.Cached;
142143
import com.oracle.truffle.api.dsl.Cached.Shared;
143144
import com.oracle.truffle.api.dsl.CachedContext;
@@ -1191,6 +1192,13 @@ static PythonBuiltinClassType doPythonBuiltinClassType(@SuppressWarnings("unused
11911192
return cachedClassType;
11921193
}
11931194

1195+
@Specialization(guards = {"classType == cachedClassType"}, limit = "1")
1196+
static PythonBuiltinClassType doPythonBuiltinClassType(@SuppressWarnings("unused") PythonBuiltinClass builtinClass,
1197+
@Bind("builtinClass.getType()") @SuppressWarnings("unused") PythonBuiltinClassType classType,
1198+
@Cached("classType") PythonBuiltinClassType cachedClassType) {
1199+
return cachedClassType;
1200+
}
1201+
11941202
@Specialization(guards = "isPythonAbstractClass(object)", assumptions = "singleContextAssumption()", rewriteOn = NotSameTypeException.class)
11951203
static Object doPythonAbstractClass(Object object,
11961204
@Cached(value = "object", weak = true) Object cachedObject,

0 commit comments

Comments
 (0)