Skip to content

Commit c20966f

Browse files
committed
Use slot lookup for __set_name__ in type ctor
1 parent 95d5beb commit c20966f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ Object typeNew(VirtualFrame frame, Object cls, Object wName, PTuple bases, PDict
21422142
@Cached BranchProfile updatedStorage,
21432143
@Cached("create(New)") LookupInheritedSlotNode getNewFuncNode,
21442144
@Cached("create(__INIT_SUBCLASS__)") GetAttributeNode getInitSubclassNode,
2145-
@Cached("create(__SET_NAME__)") LookupInheritedAttributeNode getSetNameNode,
2145+
@Cached("create(SetName)") LookupInheritedSlotNode getSetNameNode,
21462146
@Cached("create(__MRO_ENTRIES__)") LookupInheritedAttributeNode lookupMroEntriesNode,
21472147
@Cached CastToJavaStringNode castStr,
21482148
@Cached CallNode callSetNameNode,

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
*/
4141
package com.oracle.graal.python.builtins.objects.type;
4242

43+
import static com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot.Flags.NO_BUILTIN_DESCRIPTORS;
4344
import static com.oracle.graal.python.nodes.SpecialAttributeNames.__CLASS__;
4445
import static com.oracle.graal.python.nodes.SpecialAttributeNames.__DICT__;
4546
import static com.oracle.graal.python.nodes.SpecialMethodNames.__ADD__;
@@ -159,10 +160,10 @@ public enum SpecialMethodSlot {
159160
Iter(__ITER__),
160161
Next(__NEXT__),
161162

162-
New(__NEW__, false),
163-
Init(__INIT__, false),
163+
New(__NEW__, NO_BUILTIN_DESCRIPTORS),
164+
Init(__INIT__, NO_BUILTIN_DESCRIPTORS),
164165
Prepare(__PREPARE__),
165-
SetName(__SET_NAME__),
166+
SetName(__SET_NAME__, NO_BUILTIN_DESCRIPTORS),
166167
InstanceCheck(__INSTANCECHECK__),
167168
Subclasscheck(__SUBCLASSCHECK__),
168169
Call(__CALL__),
@@ -202,6 +203,10 @@ public enum SpecialMethodSlot {
202203
Reversed(__REVERSED__),
203204
Bytes(__BYTES__);
204205

206+
static class Flags {
207+
static final boolean NO_BUILTIN_DESCRIPTORS = false;
208+
}
209+
205210
public static final SpecialMethodSlot[] VALUES = values();
206211
private final String name;
207212
/**

0 commit comments

Comments
 (0)