37
37
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___AND__ ;
38
38
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___CALL__ ;
39
39
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___CONTAINS__ ;
40
- import static com .oracle .graal .python .nodes .SpecialMethodNames .J___DELATTR__ ;
41
40
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___DELITEM__ ;
42
41
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___DIR__ ;
43
42
import static com .oracle .graal .python .nodes .SpecialMethodNames .J___DIVMOD__ ;
@@ -1038,13 +1037,13 @@ static Object doIt(Node inliningTarget, Object object, Object memberObj,
1038
1037
@ Slot (value = SlotKind .tp_setattro , isComplex = true )
1039
1038
@ GenerateNodeFactory
1040
1039
abstract static class SetattrNode extends SetAttrBuiltinNode {
1041
- @ Specialization
1042
- static void doIt (Object object , Object key , Object value ,
1040
+ @ Specialization ( guards = "!isNoValue(value)" )
1041
+ static void doSet (Object object , Object key , Object value ,
1043
1042
@ Bind ("this" ) Node inliningTarget ,
1044
- @ CachedLibrary (limit = "3" ) InteropLibrary lib ,
1045
- @ Cached CastToJavaStringNode castToString ,
1046
- @ Cached GilNode gil ,
1047
- @ Cached PRaiseNode .Lazy raiseNode ) {
1043
+ @ Shared @ CachedLibrary (limit = "3" ) InteropLibrary lib ,
1044
+ @ Shared @ Cached CastToJavaStringNode castToString ,
1045
+ @ Shared @ Cached GilNode gil ,
1046
+ @ Shared @ Cached PRaiseNode .Lazy raiseNode ) {
1048
1047
gil .release (true );
1049
1048
try {
1050
1049
lib .writeMember (object , castToString .execute (key ), value );
@@ -1056,30 +1055,14 @@ static void doIt(Object object, Object key, Object value,
1056
1055
gil .acquire ();
1057
1056
}
1058
1057
}
1059
- }
1060
-
1061
- @ Builtin (name = J___SETITEM__ , minNumOfPositionalArgs = 3 )
1062
- @ GenerateNodeFactory
1063
- abstract static class SetitemNode extends PythonTernaryBuiltinNode {
1064
- @ Child private AccessForeignItemNodes .SetForeignItemNode setForeignItemNode = AccessForeignItemNodes .SetForeignItemNode .create ();
1065
-
1066
- @ Specialization
1067
- Object doit (VirtualFrame frame , Object object , Object key , Object value ) {
1068
- setForeignItemNode .execute (frame , object , key , value );
1069
- return PNone .NONE ;
1070
- }
1071
- }
1072
1058
1073
- @ Builtin (name = J___DELATTR__ , minNumOfPositionalArgs = 2 )
1074
- @ GenerateNodeFactory
1075
- abstract static class DelattrNode extends PythonBinaryBuiltinNode {
1076
- @ Specialization
1077
- static PNone doIt (Object object , Object key ,
1059
+ @ Specialization (guards = "isNoValue(value)" )
1060
+ static void doDelete (Object object , Object key , @ SuppressWarnings ("unused" ) PNone value ,
1078
1061
@ Bind ("this" ) Node inliningTarget ,
1079
- @ CachedLibrary (limit = "3" ) InteropLibrary lib ,
1080
- @ Cached CastToJavaStringNode castToString ,
1081
- @ Cached GilNode gil ,
1082
- @ Cached PRaiseNode .Lazy raiseNode ) {
1062
+ @ Shared @ CachedLibrary (limit = "3" ) InteropLibrary lib ,
1063
+ @ Shared @ Cached CastToJavaStringNode castToString ,
1064
+ @ Shared @ Cached GilNode gil ,
1065
+ @ Shared @ Cached PRaiseNode .Lazy raiseNode ) {
1083
1066
gil .release (true );
1084
1067
try {
1085
1068
lib .removeMember (object , castToString .execute (key ));
@@ -1090,6 +1073,17 @@ static PNone doIt(Object object, Object key,
1090
1073
} finally {
1091
1074
gil .acquire ();
1092
1075
}
1076
+ }
1077
+ }
1078
+
1079
+ @ Builtin (name = J___SETITEM__ , minNumOfPositionalArgs = 3 )
1080
+ @ GenerateNodeFactory
1081
+ abstract static class SetitemNode extends PythonTernaryBuiltinNode {
1082
+ @ Child private AccessForeignItemNodes .SetForeignItemNode setForeignItemNode = AccessForeignItemNodes .SetForeignItemNode .create ();
1083
+
1084
+ @ Specialization
1085
+ Object doit (VirtualFrame frame , Object object , Object key , Object value ) {
1086
+ setForeignItemNode .execute (frame , object , key , value );
1093
1087
return PNone .NONE ;
1094
1088
}
1095
1089
}
0 commit comments