Skip to content

Commit ea13231

Browse files
committed
Align names of SlotKind members with CPython naming
1 parent 2022e28 commit ea13231

File tree

17 files changed

+47
-170
lines changed

17 files changed

+47
-170
lines changed

graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/Slot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ enum SlotKind {
9696
sq_length,
9797
mp_length,
9898
tp_descr_get,
99-
tp_get_attro,
10099
tp_descr_set,
101-
tp_set_attro,
100+
tp_getattro,
101+
tp_setattro,
102102
}
103103
}

graalpython/com.oracle.graal.python.processor/src/com/oracle/graal/python/processor/SlotsMapping.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ static String getSlotBaseClass(Slot s) {
5252
return switch (s.value()) {
5353
case nb_bool -> "TpSlotInquiry.TpSlotInquiryBuiltin";
5454
case sq_length, mp_length -> "TpSlotLen.TpSlotLenBuiltin" + getSuffix(s.isComplex());
55-
case tp_get_attro -> "TpSlotGetAttr.TpSlotGetAttrBuiltin";
55+
case tp_getattro -> "TpSlotGetAttr.TpSlotGetAttrBuiltin";
5656
case tp_descr_get -> "TpSlotDescrGet.TpSlotDescrGetBuiltin" + getSuffix(s.isComplex());
5757
case tp_descr_set -> "TpSlotDescrSet.TpSlotDescrSetBuiltin";
58-
case tp_set_attro -> "TpSlotSetAttr.TpSlotSetAttrBuiltin";
58+
case tp_setattro -> "TpSlotSetAttr.TpSlotSetAttrBuiltin";
5959
};
6060
}
6161

@@ -64,9 +64,9 @@ static String getSlotNodeBaseClass(Slot s) {
6464
case tp_descr_get -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotDescrGet.DescrGetBuiltinNode";
6565
case nb_bool -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotInquiry.NbBoolBuiltinNode";
6666
case sq_length, mp_length -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotLen.LenBuiltinNode";
67-
case tp_get_attro -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotGetAttr.GetAttrBuiltinNode";
67+
case tp_getattro -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotGetAttr.GetAttrBuiltinNode";
6868
case tp_descr_set -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotDescrSet.DescrSetBuiltinNode";
69-
case tp_set_attro -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotSetAttr.SetAttrBuiltinNode";
69+
case tp_setattro -> "com.oracle.graal.python.builtins.objects.type.slots.TpSlotSetAttr.SetAttrBuiltinNode";
7070
};
7171
}
7272

@@ -75,22 +75,22 @@ static String getUncachedExecuteSignature(SlotKind s) {
7575
case nb_bool -> "boolean executeUncached(Object self)";
7676
case tp_descr_get -> "Object executeUncached(Object self, Object obj, Object type)";
7777
case sq_length, mp_length -> "int executeUncached(Object self)";
78-
case tp_get_attro, tp_descr_set, tp_set_attro ->
78+
case tp_getattro, tp_descr_set, tp_setattro ->
7979
throw new AssertionError("Should not reach here: should be always complex");
8080
};
8181
}
8282

8383
static boolean supportsComplex(SlotKind s) {
8484
return switch (s) {
8585
case nb_bool -> false;
86-
case sq_length, mp_length, tp_get_attro, tp_descr_get, tp_descr_set, tp_set_attro -> true;
86+
case sq_length, mp_length, tp_getattro, tp_descr_get, tp_descr_set, tp_setattro -> true;
8787
};
8888
}
8989

9090
static boolean supportsSimple(SlotKind s) {
9191
return switch (s) {
9292
case nb_bool, sq_length, mp_length, tp_descr_get -> true;
93-
case tp_get_attro, tp_descr_set, tp_set_attro -> false;
93+
case tp_getattro, tp_descr_set, tp_setattro -> false;
9494
};
9595
}
9696

@@ -99,7 +99,7 @@ static String getUncachedExecuteCall(SlotKind s) {
9999
case nb_bool -> "executeBool(null, self)";
100100
case sq_length, mp_length -> "executeInt(null, self)";
101101
case tp_descr_get -> "execute(null, self, obj, type)";
102-
case tp_get_attro, tp_descr_set, tp_set_attro ->
102+
case tp_getattro, tp_descr_set, tp_setattro ->
103103
throw new AssertionError("Should not reach here: should be always complex");
104104
};
105105
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/builtin/objects/TpSlotsTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ public void testBuilderBasic() {
6565

6666
checkSlotValue(TpSlotMeta.SQ_LENGTH, slots.combined_sq_mp_length());
6767
checkSlotValue(TpSlotMeta.MP_LENGTH, slots.combined_mp_sq_length());
68-
checkSlotValue(TpSlotMeta.TP_GET_ATTRO, slots.combined_tp_getattro_getattr());
69-
checkSlotValue(TpSlotMeta.TP_SET_ATTRO, slots.combined_tp_setattro_setattr());
68+
checkSlotValue(TpSlotMeta.TP_GETATTRO, slots.combined_tp_getattro_getattr());
69+
checkSlotValue(TpSlotMeta.TP_SETATTRO, slots.combined_tp_setattro_setattr());
7070
}
7171

7272
@Test
7373
public void testBuilderOptimizations1() {
7474
Builder builder = TpSlots.newBuilder();
7575
builder.set(TpSlotMeta.MP_LENGTH, new TpSlotNative(TpSlotMeta.MP_LENGTH));
76-
builder.set(TpSlotMeta.TP_GET_ATTR, new TpSlotNative(TpSlotMeta.TP_GET_ATTR));
77-
builder.set(TpSlotMeta.TP_SET_ATTR, new TpSlotNative(TpSlotMeta.TP_SET_ATTR));
76+
builder.set(TpSlotMeta.TP_GETATTR, new TpSlotNative(TpSlotMeta.TP_GETATTR));
77+
builder.set(TpSlotMeta.TP_SETATTR, new TpSlotNative(TpSlotMeta.TP_SETATTR));
7878

7979
TpSlots slots = builder.build();
80-
verifySlots(slots, def -> def == TpSlotMeta.MP_LENGTH || def == TpSlotMeta.TP_GET_ATTR || def == TpSlotMeta.TP_SET_ATTR);
80+
verifySlots(slots, def -> def == TpSlotMeta.MP_LENGTH || def == TpSlotMeta.TP_GETATTR || def == TpSlotMeta.TP_SETATTR);
8181

8282
checkSlotValue(TpSlotMeta.MP_LENGTH, slots.combined_sq_mp_length());
8383
checkSlotValue(TpSlotMeta.MP_LENGTH, slots.combined_mp_sq_length());
84-
checkSlotValue(TpSlotMeta.TP_GET_ATTR, slots.combined_tp_getattro_getattr());
85-
checkSlotValue(TpSlotMeta.TP_SET_ATTR, slots.combined_tp_setattro_setattr());
84+
checkSlotValue(TpSlotMeta.TP_GETATTR, slots.combined_tp_getattro_getattr());
85+
checkSlotValue(TpSlotMeta.TP_SETATTR, slots.combined_tp_setattro_setattr());
8686
}
8787

8888
@Test

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ctypes/PyCStructTypeBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
8585
protected abstract static class NewNode extends StructUnionTypeNewNode {
8686
}
8787

88-
@Slot(value = SlotKind.tp_set_attro, isComplex = true)
88+
@Slot(value = SlotKind.tp_setattro, isComplex = true)
8989
@GenerateNodeFactory
9090
protected abstract static class SetattrNode extends SetAttrBuiltinNode {
9191
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ctypes/UnionTypeBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected boolean isStruct() {
9292
}
9393
}
9494

95-
@Slot(value = SlotKind.tp_set_attro, isComplex = true)
95+
@Slot(value = SlotKind.tp_setattro, isComplex = true)
9696
@GenerateNodeFactory
9797
protected abstract static class SetattrNode extends SetAttrBuiltinNode {
9898
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/foreign/ForeignObjectBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ Object doit(VirtualFrame frame, Object object, Object key) {
985985
}
986986
}
987987

988-
@Slot(value = SlotKind.tp_get_attro, isComplex = true)
988+
@Slot(value = SlotKind.tp_getattro, isComplex = true)
989989
@GenerateNodeFactory
990990
abstract static class GetAttributeNode extends GetAttrBuiltinNode {
991991
@Specialization
@@ -1035,7 +1035,7 @@ static Object doIt(Node inliningTarget, Object object, Object memberObj,
10351035
}
10361036

10371037
@ImportStatic(PGuards.class)
1038-
@Slot(value = SlotKind.tp_set_attro, isComplex = true)
1038+
@Slot(value = SlotKind.tp_setattro, isComplex = true)
10391039
@GenerateNodeFactory
10401040
abstract static class SetattrNode extends SetAttrBuiltinNode {
10411041
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/method/InstancemethodBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected static Object func(PDecoratedMethod self) {
130130
}
131131

132132
@ImportStatic(PGuards.class)
133-
@Slot(value = SlotKind.tp_get_attro, isComplex = true)
133+
@Slot(value = SlotKind.tp_getattro, isComplex = true)
134134
@GenerateNodeFactory
135135
public abstract static class GetattributeNode extends GetAttrBuiltinNode {
136136
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/method/MethodBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected Object doIt(PMethod self,
123123
}
124124

125125
@ImportStatic(PGuards.class)
126-
@Slot(value = SlotKind.tp_get_attro, isComplex = true)
126+
@Slot(value = SlotKind.tp_getattro, isComplex = true)
127127
@GenerateNodeFactory
128128
public abstract static class GetattributeNode extends GetAttrBuiltinNode {
129129
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/module/ModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private static PDict createDict(Node inliningTarget, PythonModule self, SetDictN
226226
}
227227
}
228228

229-
@Slot(value = SlotKind.tp_get_attro, isComplex = true)
229+
@Slot(value = SlotKind.tp_getattro, isComplex = true)
230230
@GenerateNodeFactory
231231
public abstract static class ModuleGetattritbuteNode extends GetAttrBuiltinNode {
232232
@Specialization

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/ObjectBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static TruffleString repr(VirtualFrame frame, Object self,
358358
}
359359

360360
@ImportStatic(PGuards.class)
361-
@Slot(value = SlotKind.tp_get_attro, isComplex = true)
361+
@Slot(value = SlotKind.tp_getattro, isComplex = true)
362362
@GenerateNodeFactory
363363
public abstract static class GetAttributeNode extends GetAttrBuiltinNode {
364364
@CompilationFinal private int profileFlags = 0;
@@ -471,7 +471,7 @@ public static GetAttributeNode create() {
471471
}
472472
}
473473

474-
@Slot(value = SlotKind.tp_set_attro, isComplex = true)
474+
@Slot(value = SlotKind.tp_setattro, isComplex = true)
475475
@GenerateNodeFactory
476476
public abstract static class SetattrNode extends SetAttrBuiltinNode {
477477
@Specialization

0 commit comments

Comments
 (0)