102
102
public abstract class TypeNodes {
103
103
104
104
public abstract static class GetTypeFlagsNode extends PNodeWithContext {
105
+ private static final int HEAPTYPE = 1 << 9 ;
105
106
106
107
public abstract long execute (PythonAbstractClass clazz );
107
108
@@ -113,7 +114,7 @@ long doInitialized(PythonManagedClass clazz) {
113
114
@ Specialization
114
115
long doGeneric (PythonManagedClass clazz ) {
115
116
if (!isInitialized (clazz )) {
116
- return getValue (clazz .getFlagsContainer ());
117
+ return getValue (clazz , clazz .getFlagsContainer ());
117
118
}
118
119
return clazz .getFlagsContainer ().flags ;
119
120
}
@@ -125,12 +126,16 @@ long doNative(PythonNativeClass clazz,
125
126
}
126
127
127
128
@ TruffleBoundary
128
- private static long getValue (FlagsContainer fc ) {
129
+ private static long getValue (PythonManagedClass clazz , FlagsContainer fc ) {
129
130
// This method is only called from C code, i.e., the flags of the initial super class
130
131
// must be available.
131
132
if (fc .initialDominantBase != null ) {
132
133
fc .flags = doSlowPath (fc .initialDominantBase );
133
134
fc .initialDominantBase = null ;
135
+ if (clazz instanceof PythonClass ) {
136
+ // user classes are heap types
137
+ fc .flags |= HEAPTYPE ;
138
+ }
134
139
}
135
140
return fc .flags ;
136
141
}
@@ -142,7 +147,7 @@ public static long doSlowPath(PythonAbstractClass clazz) {
142
147
if (isInitialized (mclazz )) {
143
148
return mclazz .getFlagsContainer ().flags ;
144
149
} else {
145
- return getValue (mclazz .getFlagsContainer ());
150
+ return getValue (mclazz , mclazz .getFlagsContainer ());
146
151
}
147
152
} else if (PGuards .isNativeClass (clazz )) {
148
153
return doNativeGeneric ((PythonNativeClass ) clazz , createReadNode ());
0 commit comments