Skip to content

Commit 3109ef6

Browse files
committed
do not cache concrete objects in shared ASTs
1 parent ca7def6 commit 3109ef6

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/CExtNodes.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public Object execute(PythonNativeClass object, Object arg) {
111111
public static class FromNativeSubclassNode<T> extends PBaseNode {
112112
private final PythonBuiltinClassType expectedType;
113113
private final String conversionFuncName;
114-
@CompilationFinal private PythonBuiltinClass expectedClass;
115114
@CompilationFinal private TruffleObject conversionFunc;
116115
@Child private Node executeNode;
117116
@Child private GetClassNode getClass = GetClassNode.create();
@@ -124,11 +123,7 @@ private FromNativeSubclassNode(PythonBuiltinClassType expectedType, String conve
124123
}
125124

126125
private PythonBuiltinClass getExpectedClass() {
127-
if (expectedClass == null) {
128-
CompilerDirectives.transferToInterpreterAndInvalidate();
129-
expectedClass = getCore().lookupType(expectedType);
130-
}
131-
return expectedClass;
126+
return getCore().lookupType(expectedType);
132127
}
133128

134129
private Node getExecNode() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/datamodel/IsHashableNode.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ protected boolean isHashableGeneric(@SuppressWarnings("unused") Object object) {
7676
@Specialization
7777
protected boolean isHashableGeneric(Object object,
7878
@Cached("create(__HASH__)") LookupAndCallUnaryNode lookupHashAttributeNode,
79-
@Cached("create()") BuiltinFunctions.IsInstanceNode isInstanceNode,
80-
@Cached("getBuiltinIntType()") PythonClass IntType) {
79+
@Cached("create()") BuiltinFunctions.IsInstanceNode isInstanceNode) {
8180
Object hashValue = lookupHashAttributeNode.executeObject(object);
82-
if (isInstanceNode.executeWith(hashValue, IntType)) {
81+
if (isInstanceNode.executeWith(hashValue, getBuiltinIntType())) {
8382
return true;
8483
}
8584
throw raise(PythonErrorType.TypeError, "__hash__ method should return an integer");

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/frame/FrameSlotNode.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727

2828
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
2929
import com.oracle.graal.python.builtins.objects.ints.PInt;
30-
import com.oracle.graal.python.builtins.objects.type.PythonClass;
3130
import com.oracle.graal.python.nodes.PNode;
3231
import com.oracle.truffle.api.CompilerDirectives;
33-
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
3432
import com.oracle.truffle.api.frame.Frame;
3533
import com.oracle.truffle.api.frame.FrameSlot;
3634
import com.oracle.truffle.api.frame.FrameSlotKind;
@@ -40,14 +38,9 @@
4038

4139
public abstract class FrameSlotNode extends PNode {
4240
private final ConditionProfile isPrimitiveProfile = ConditionProfile.createBinaryProfile();
43-
@CompilationFinal private PythonClass intClass;
4441

4542
protected boolean isPrimitiveInt(PInt cls) {
46-
if (intClass == null) {
47-
CompilerDirectives.transferToInterpreterAndInvalidate();
48-
intClass = getCore().lookupType(PythonBuiltinClassType.PInt);
49-
}
50-
return isPrimitiveProfile.profile(cls.getPythonClass() == intClass);
43+
return isPrimitiveProfile.profile(cls.getPythonClass() == getCore().lookupType(PythonBuiltinClassType.PInt));
5144
}
5245

5346
protected final FrameSlot frameSlot;

0 commit comments

Comments
 (0)