44
44
import com .oracle .graal .python .builtins .PythonBuiltinClassType ;
45
45
import com .oracle .graal .python .builtins .objects .PNone ;
46
46
import com .oracle .graal .python .builtins .objects .exception .PBaseException ;
47
- import com .oracle .graal .python .builtins .objects .type .PythonBuiltinClass ;
48
- import com .oracle .graal .python .builtins .objects .type .PythonManagedClass ;
49
47
import com .oracle .graal .python .runtime .PythonOptions ;
50
48
import com .oracle .graal .python .runtime .exception .PException ;
51
49
import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
65
63
@ GenerateUncached
66
64
public abstract class PRaiseNode extends Node {
67
65
68
- public abstract PException execute (Node raisingNode , Object type , Object cause , Object format , Object [] arguments );
66
+ public abstract PException execute (Node raisingNode , PythonBuiltinClassType type , Object cause , Object format , Object [] arguments );
69
67
70
68
public final PException raise (PythonBuiltinClassType type ) {
71
69
throw execute (this , type , PNone .NO_VALUE , PNone .NO_VALUE , PythonUtils .EMPTY_OBJECT_ARRAY );
@@ -91,11 +89,11 @@ public final PException raise(PythonBuiltinClassType type, PBaseException cause,
91
89
throw execute (this , type , cause , format , arguments );
92
90
}
93
91
94
- public static PException raiseUncached (Node raisingNode , Object exceptionType ) {
92
+ public static PException raiseUncached (Node raisingNode , PythonBuiltinClassType exceptionType ) {
95
93
throw PRaiseNodeGen .getUncached ().execute (raisingNode , exceptionType , PNone .NO_VALUE , PNone .NO_VALUE , PythonUtils .EMPTY_OBJECT_ARRAY );
96
94
}
97
95
98
- public static PException raiseUncached (Node raisingNode , Object exceptionType , Object message ) {
96
+ public static PException raiseUncached (Node raisingNode , PythonBuiltinClassType exceptionType , Object message ) {
99
97
throw PRaiseNodeGen .getUncached ().execute (raisingNode , exceptionType , PNone .NO_VALUE , message , PythonUtils .EMPTY_OBJECT_ARRAY );
100
98
}
101
99
@@ -119,7 +117,7 @@ public static PException raiseUncached(Node raisingNode, PythonBuiltinClassType
119
117
* Raise an error saying that the {@code result} cannot fit into an index-sized integer. Use the
120
118
* specified {@code type} as exception class.
121
119
*/
122
- public final PException raiseNumberTooLarge (Object type , Object result ) {
120
+ public final PException raiseNumberTooLarge (PythonBuiltinClassType type , Object result ) {
123
121
return execute (this , type , PNone .NO_VALUE , ErrorMessages .CANNOT_FIT_P_INTO_INDEXSIZED_INT , new Object []{result });
124
122
}
125
123
@@ -170,42 +168,6 @@ protected static Assumption singleContextAssumption() {
170
168
return PythonLanguage .getCurrent ().singleContextAssumption ;
171
169
}
172
170
173
- @ Specialization (guards = {"isNoValue(cause)" , "isNoValue(format)" , "arguments.length == 0" , "exceptionType == cachedType" }, limit = "3" , assumptions = "singleContextAssumption()" )
174
- static PException doPythonBuiltinClassCached (Node raisingNode , @ SuppressWarnings ("unused" ) PythonBuiltinClass exceptionType , @ SuppressWarnings ("unused" ) PNone cause ,
175
- @ SuppressWarnings ("unused" ) PNone format ,
176
- @ SuppressWarnings ("unused" ) Object [] arguments ,
177
- @ Cached ("exceptionType" ) PythonBuiltinClass cachedType ,
178
- @ Cached PythonObjectFactory factory ,
179
- @ CachedLanguage PythonLanguage language ) {
180
- throw raiseExceptionObject (raisingNode , factory .createBaseException (cachedType ), language );
181
- }
182
-
183
- @ Specialization (guards = {"isNoValue(cause)" , "isNoValue(format)" , "arguments.length == 0" , "exceptionType.getType() == cachedType" }, limit = "3" )
184
- static PException doPythonBuiltinClassCachedMulti (Node raisingNode , @ SuppressWarnings ("unused" ) PythonBuiltinClass exceptionType , @ SuppressWarnings ("unused" ) PNone cause ,
185
- @ SuppressWarnings ("unused" ) PNone format ,
186
- @ SuppressWarnings ("unused" ) Object [] arguments ,
187
- @ Cached ("exceptionType.getType()" ) PythonBuiltinClassType cachedType ,
188
- @ Cached PythonObjectFactory factory ,
189
- @ CachedLanguage PythonLanguage language ) {
190
- throw raiseExceptionObject (raisingNode , factory .createBaseException (cachedType ), language );
191
- }
192
-
193
- @ Specialization (guards = {"isNoValue(cause)" , "isNoValue(format)" , "arguments.length == 0" }, replaces = {"doPythonBuiltinClassCached" , "doPythonBuiltinClassCachedMulti" })
194
- static PException doPythonBuiltinClass (Node raisingNode , PythonBuiltinClass exceptionType , @ SuppressWarnings ("unused" ) PNone cause , @ SuppressWarnings ("unused" ) PNone format ,
195
- @ SuppressWarnings ("unused" ) Object [] arguments ,
196
- @ Shared ("factory" ) @ Cached PythonObjectFactory factory ,
197
- @ Shared ("language" ) @ CachedLanguage PythonLanguage language ) {
198
- throw raiseExceptionObject (raisingNode , factory .createBaseException (exceptionType ), language );
199
- }
200
-
201
- @ Specialization (guards = {"isNoValue(cause)" , "isNoValue(format)" , "arguments.length == 0" })
202
- static PException doPythonManagedClass (Node raisingNode , PythonManagedClass exceptionType , @ SuppressWarnings ("unused" ) PNone cause , @ SuppressWarnings ("unused" ) PNone format ,
203
- @ SuppressWarnings ("unused" ) Object [] arguments ,
204
- @ Shared ("factory" ) @ Cached PythonObjectFactory factory ,
205
- @ Shared ("language" ) @ CachedLanguage PythonLanguage language ) {
206
- throw raiseExceptionObject (raisingNode , factory .createBaseException (exceptionType ), language );
207
- }
208
-
209
171
@ Specialization (guards = {"isNoValue(cause)" , "isNoValue(format)" , "arguments.length > 0" })
210
172
static PException doBuiltinType (Node raisingNode , PythonBuiltinClassType type , @ SuppressWarnings ("unused" ) PNone cause , @ SuppressWarnings ("unused" ) PNone format , Object [] arguments ,
211
173
@ Shared ("factory" ) @ Cached PythonObjectFactory factory ,
0 commit comments