48
48
import static com .oracle .graal .python .nodes .ErrorMessages .BAD_ARG_TO_INTERNAL_FUNC_S ;
49
49
import static com .oracle .graal .python .nodes .ErrorMessages .BAD_ARG_TO_INTERNAL_FUNC_WAS_S_P ;
50
50
import static com .oracle .graal .python .nodes .ErrorMessages .BASE_MUST_BE ;
51
+ import static com .oracle .graal .python .nodes .ErrorMessages .BAD_ARG_TYPE_FOR_BUILTIN_OP ;
51
52
import static com .oracle .graal .python .nodes .ErrorMessages .CANNOT_CONVERT_P_OBJ_TO_S ;
52
53
import static com .oracle .graal .python .nodes .ErrorMessages .HASH_MISMATCH ;
53
54
import static com .oracle .graal .python .nodes .ErrorMessages .LIST_INDEX_OUT_OF_RANGE ;
61
62
import static com .oracle .graal .python .nodes .SpecialMethodNames .KEYS ;
62
63
import static com .oracle .graal .python .nodes .SpecialMethodNames .VALUES ;
63
64
import static com .oracle .graal .python .nodes .SpecialMethodNames .__FLOAT__ ;
64
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__ITER__ ;
65
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__NEW__ ;
66
65
import static com .oracle .graal .python .nodes .SpecialMethodNames .__GETITEM__ ;
67
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__NEW__ ;
68
66
import static com .oracle .graal .python .nodes .SpecialMethodNames .__IADD__ ;
69
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__ITER__ ;
70
67
import static com .oracle .graal .python .nodes .SpecialMethodNames .__IMUL__ ;
68
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__ITER__ ;
69
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__NEW__ ;
71
70
import static com .oracle .graal .python .nodes .SpecialMethodNames .__SETITEM__ ;
72
71
import static com .oracle .graal .python .runtime .exception .PythonErrorType .OverflowError ;
73
72
import static com .oracle .graal .python .util .PythonUtils .EMPTY_BYTE_ARRAY ;
111
110
import com .oracle .graal .python .builtins .modules .BuiltinConstructors .TupleNode ;
112
111
import com .oracle .graal .python .builtins .modules .BuiltinFunctions .ChrNode ;
113
112
import com .oracle .graal .python .builtins .modules .CodecsModuleBuiltins .CodecsEncodeNode ;
114
- import com .oracle .graal .python .builtins .modules .CodecsModuleBuiltins .DecodeNode ;
115
113
import com .oracle .graal .python .builtins .modules .PythonCextBuiltinsFactory .CreateFunctionNodeGen ;
116
114
import com .oracle .graal .python .builtins .modules .SysModuleBuiltins .InternNode ;
117
115
import com .oracle .graal .python .builtins .objects .PNone ;
118
116
import com .oracle .graal .python .builtins .objects .PNotImplemented ;
119
117
import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins ;
120
- import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins .AddNode ;
121
- import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins .JoinNode ;
118
+ import com .oracle .graal .python .builtins .objects .bytes .BytesBuiltins .DecodeNode ;
122
119
import com .oracle .graal .python .builtins .objects .bytes .BytesNodes ;
123
120
import com .oracle .graal .python .builtins .objects .bytes .PBytes ;
124
121
import com .oracle .graal .python .builtins .objects .bytes .PBytesLike ;
@@ -1666,7 +1663,7 @@ public Object check(VirtualFrame frame, Object obj,
1666
1663
public abstract static class PyBytesConcatNode extends PythonBinaryBuiltinNode {
1667
1664
@ Specialization
1668
1665
public Object concat (VirtualFrame frame , PBytes original , Object newPart ,
1669
- @ Cached AddNode addNode ,
1666
+ @ Cached BytesBuiltins . AddNode addNode ,
1670
1667
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
1671
1668
@ Cached GetNativeNullNode getNativeNullNode ) {
1672
1669
try {
@@ -1706,7 +1703,7 @@ protected boolean isBytesSubtype(VirtualFrame frame, Object obj, GetClassNode ge
1706
1703
public abstract static class PyBytesJoinNode extends PythonBinaryBuiltinNode {
1707
1704
@ Specialization
1708
1705
public Object join (VirtualFrame frame , PBytes original , Object newPart ,
1709
- @ Cached JoinNode joinNode ,
1706
+ @ Cached BytesBuiltins . JoinNode joinNode ,
1710
1707
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
1711
1708
@ Cached GetNativeNullNode getNativeNullNode ) {
1712
1709
try {
@@ -2902,7 +2899,7 @@ abstract static class PySequenceConcatNode extends PythonBinaryBuiltinNode {
2902
2899
@ Specialization (guards = {"checkNode.execute(s1)" , "checkNode.execute(s1)" })
2903
2900
Object concat (VirtualFrame frame , Object s1 , Object s2 ,
2904
2901
@ SuppressWarnings ("unused" ) @ Cached PySequenceCheckNode checkNode ,
2905
- @ Cached ("createAdd()" ) com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode addNode ,
2902
+ @ Cached ("createAdd()" ) BinaryArithmetic .AddNode addNode ,
2906
2903
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
2907
2904
@ Cached GetNativeNullNode getNativeNullNode ) {
2908
2905
try {
@@ -2921,8 +2918,8 @@ protected Object cantConcat(VirtualFrame frame, Object s1, @SuppressWarnings("un
2921
2918
return raiseNativeNode .raise (frame , getNativeNullNode .execute (), TypeError , ErrorMessages .OBJ_CANT_BE_CONCATENATED , s1 );
2922
2919
}
2923
2920
2924
- protected com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode createAdd () {
2925
- return (com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode ) BinaryArithmetic .Add .create ();
2921
+ protected BinaryArithmetic .AddNode createAdd () {
2922
+ return (BinaryArithmetic .AddNode ) BinaryArithmetic .Add .create ();
2926
2923
}
2927
2924
}
2928
2925
@@ -2934,7 +2931,7 @@ abstract static class PySequenceInPlaceConcatNode extends PythonBinaryBuiltinNod
2934
2931
Object concat (VirtualFrame frame , Object s1 , Object s2 ,
2935
2932
@ Cached PyObjectLookupAttr lookupNode ,
2936
2933
@ Cached CallNode callNode ,
2937
- @ Cached ("createAdd()" ) com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode addNode ,
2934
+ @ Cached ("createAdd()" ) BinaryArithmetic .AddNode addNode ,
2938
2935
@ SuppressWarnings ("unused" ) @ Cached PySequenceCheckNode checkNode ,
2939
2936
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
2940
2937
@ Cached GetNativeNullNode getNativeNullNode ) {
@@ -2958,8 +2955,8 @@ protected Object concat(VirtualFrame frame, Object s1, @SuppressWarnings("unused
2958
2955
return raiseNativeNode .raise (frame , getNativeNullNode .execute (), TypeError , ErrorMessages .OBJ_CANT_BE_CONCATENATED , s1 );
2959
2956
}
2960
2957
2961
- protected com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode createAdd () {
2962
- return (com . oracle . graal . python . nodes . expression . BinaryArithmetic .AddNode ) BinaryArithmetic .Add .create ();
2958
+ protected BinaryArithmetic .AddNode createAdd () {
2959
+ return (BinaryArithmetic .AddNode ) BinaryArithmetic .Add .create ();
2963
2960
}
2964
2961
}
2965
2962
@@ -3087,7 +3084,7 @@ public abstract static class PyUnicodeConcatNode extends PythonBinaryBuiltinNode
3087
3084
3088
3085
@ Specialization (guards = {"isString(left) || isStringSubtype(frame, left, getClassNode, isSubtypeNode)" , "isString(right) || isStringSubtype(frame, right, getClassNode, isSubtypeNode)" })
3089
3086
public Object concat (VirtualFrame frame , Object left , Object right ,
3090
- @ Cached com . oracle . graal . python . builtins . objects . str . StringBuiltins .AddNode addNode ,
3087
+ @ Cached StringBuiltins .AddNode addNode ,
3091
3088
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
3092
3089
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
3093
3090
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -3321,7 +3318,7 @@ protected boolean isStringSubtype(VirtualFrame frame, Object obj, GetClassNode g
3321
3318
public abstract static class PyUnicodeJoinNode extends PythonBinaryBuiltinNode {
3322
3319
@ Specialization (guards = {"isString(separator) || isStringSubtype(frame, separator, getClassNode, isSubtypeNode)" })
3323
3320
public Object find (VirtualFrame frame , Object separator , Object seq ,
3324
- @ Cached com . oracle . graal . python . builtins . objects . str . StringBuiltins .JoinNode joinNode ,
3321
+ @ Cached StringBuiltins .JoinNode joinNode ,
3325
3322
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
3326
3323
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
3327
3324
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -3389,7 +3386,7 @@ private static boolean isStringSubtype(VirtualFrame frame, Object obj, GetClassN
3389
3386
@ GenerateNodeFactory
3390
3387
public abstract static class PyUnicodeTailmatchNode extends PythonBuiltinNode {
3391
3388
@ Specialization (guards = {"isAnyString(frame, string, getClassNode, isSubtypeNode)" , "isAnyString(frame, substring, getClassNode, isSubtypeNode)" , "direction > 0" })
3392
- public Object tailmatch (VirtualFrame frame , Object string , Object substring , long start , long end , @ SuppressWarnings ("unused" ) long direction ,
3389
+ public int tailmatch (VirtualFrame frame , Object string , Object substring , long start , long end , @ SuppressWarnings ("unused" ) long direction ,
3393
3390
@ Cached PyObjectLookupAttr lookupAttrNode ,
3394
3391
@ Cached SliceLiteralNode sliceNode ,
3395
3392
@ Cached CallNode callNode ,
@@ -3408,7 +3405,7 @@ public Object tailmatch(VirtualFrame frame, Object string, Object substring, lon
3408
3405
}
3409
3406
3410
3407
@ Specialization (guards = {"isAnyString(frame, string, getClassNode, isSubtypeNode)" , "isAnyString(frame, substring, getClassNode, isSubtypeNode)" , "direction <= 0" })
3411
- public Object tailmatch (VirtualFrame frame , Object string , Object substring , long start , long end , @ SuppressWarnings ("unused" ) long direction ,
3408
+ public int tailmatch (VirtualFrame frame , Object string , Object substring , long start , long end , @ SuppressWarnings ("unused" ) long direction ,
3412
3409
@ Cached PyObjectLookupAttr lookupAttrNode ,
3413
3410
@ Cached SliceLiteralNode sliceNode ,
3414
3411
@ Cached CallNode callNode ,
@@ -3462,13 +3459,12 @@ public Object encode(VirtualFrame frame, Object obj, String encoding, String err
3462
3459
}
3463
3460
3464
3461
@ Specialization (guards = {"!isString(obj)" , "!isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3465
- public Object encode (VirtualFrame frame , Object obj , @ SuppressWarnings ("unused" ) String encoding , @ SuppressWarnings ("unused" ) String errors ,
3466
- @ Cached StrNode strNode ,
3462
+ public Object encode (VirtualFrame frame , @ SuppressWarnings ("unused" ) Object obj , @ SuppressWarnings ("unused" ) String encoding , @ SuppressWarnings ("unused" ) String errors ,
3467
3463
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
3468
3464
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
3469
3465
@ Cached PRaiseNativeNode raiseNativeNode ,
3470
3466
@ Cached GetNativeNullNode getNativeNullNode ) {
3471
- return raiseNativeNode .raise (frame , getNativeNullNode .execute (), SystemError , BAD_ARG_TO_INTERNAL_FUNC_WAS_S_P , strNode . executeWith ( frame , obj ), obj );
3467
+ return raiseNativeNode .raise (frame , getNativeNullNode .execute (), TypeError , BAD_ARG_TYPE_FOR_BUILTIN_OP );
3472
3468
}
3473
3469
3474
3470
protected static boolean isStringSubtype (VirtualFrame frame , Object obj , GetClassNode getClassNode , IsSubtypeNode isSubtypeNode ) {
@@ -3553,13 +3549,12 @@ public Object escape(VirtualFrame frame, Object s,
3553
3549
}
3554
3550
3555
3551
@ Specialization (guards = {"!isString(obj)" , "!isStringSubtype(frame, obj, getClassNode, isSubtypeNode)" })
3556
- public Object escape (VirtualFrame frame , Object obj ,
3552
+ public Object escape (VirtualFrame frame , @ SuppressWarnings ( "unused" ) Object obj ,
3557
3553
@ SuppressWarnings ("unused" ) @ Cached GetClassNode getClassNode ,
3558
3554
@ SuppressWarnings ("unused" ) @ Cached IsSubtypeNode isSubtypeNode ,
3559
- @ Cached StrNode strNode ,
3560
3555
@ Cached PRaiseNativeNode raiseNativeNode ,
3561
3556
@ Cached GetNativeNullNode getNativeNullNode ) {
3562
- return raiseNativeNode .raise (frame , getNativeNullNode .execute (), SystemError , BAD_ARG_TO_INTERNAL_FUNC_WAS_S_P , strNode . executeWith ( frame , obj ), obj );
3557
+ return raiseNativeNode .raise (frame , getNativeNullNode .execute (), TypeError , BAD_ARG_TYPE_FOR_BUILTIN_OP );
3563
3558
}
3564
3559
3565
3560
protected static boolean isStringSubtype (VirtualFrame frame , Object obj , GetClassNode getClassNode , IsSubtypeNode isSubtypeNode ) {
0 commit comments