49
49
import com .oracle .truffle .api .Assumption ;
50
50
import com .oracle .truffle .api .CompilerDirectives ;
51
51
import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
52
+ import com .oracle .truffle .api .HostCompilerDirectives .InliningCutoff ;
52
53
import com .oracle .truffle .api .Truffle ;
53
54
import com .oracle .truffle .api .dsl .Bind ;
54
55
import com .oracle .truffle .api .dsl .Cached ;
@@ -176,6 +177,7 @@ protected Object readGlobalCached(@SuppressWarnings("unused") PythonModule globa
176
177
return returnGlobalOrBuiltin (result );
177
178
}
178
179
180
+ @ InliningCutoff
179
181
@ Specialization (replaces = "readGlobalCached" )
180
182
protected Object readGlobal (PythonModule globals ,
181
183
@ Shared ("readFromModule" ) @ Cached ReadAttributeFromObjectNode readFromModuleNode ) {
@@ -193,6 +195,7 @@ protected Object readGlobalBuiltinDictCachedUnchangedStorage(@SuppressWarnings("
193
195
return returnGlobalOrBuiltin (result == null ? PNone .NO_VALUE : result );
194
196
}
195
197
198
+ @ InliningCutoff
196
199
@ Specialization (guards = {"isSingleContext()" , "globals == cachedGlobals" ,
197
200
"isBuiltinDict(cachedGlobals)" }, replaces = "readGlobalBuiltinDictCachedUnchangedStorage" , limit = "1" )
198
201
protected Object readGlobalBuiltinDictCached (@ SuppressWarnings ("unused" ) PDict globals ,
@@ -202,6 +205,7 @@ protected Object readGlobalBuiltinDictCached(@SuppressWarnings("unused") PDict g
202
205
return returnGlobalOrBuiltin (result == null ? PNone .NO_VALUE : result );
203
206
}
204
207
208
+ @ InliningCutoff
205
209
@ Specialization (guards = "isBuiltinDict(globals)" , replaces = {"readGlobalBuiltinDictCached" , "readGlobalBuiltinDictCachedUnchangedStorage" }, limit = "3" )
206
210
protected Object readGlobalBuiltinDict (@ SuppressWarnings ("unused" ) PDict globals ,
207
211
@ Bind ("globals.getDictStorage()" ) HashingStorage storage ,
@@ -210,6 +214,7 @@ protected Object readGlobalBuiltinDict(@SuppressWarnings("unused") PDict globals
210
214
return returnGlobalOrBuiltin (result == null ? PNone .NO_VALUE : result );
211
215
}
212
216
217
+ @ InliningCutoff
213
218
@ Specialization
214
219
protected Object readGlobalDictGeneric (VirtualFrame frame , PDict globals ,
215
220
@ Cached GetItemNode getItemNode ,
@@ -281,14 +286,20 @@ Object returnBuiltinFromConstantModule(
281
286
if (isBuiltinProfile .profile (builtin != PNone .NO_VALUE )) {
282
287
return builtin ;
283
288
} else {
284
- if (raiseNode == null ) {
285
- CompilerDirectives .transferToInterpreterAndInvalidate ();
286
- raiseNode = insert (PRaiseNode .create ());
287
- }
288
- throw raiseNode .raise (NameError , ErrorMessages .NAME_NOT_DEFINED , attributeId );
289
+ throw raiseNameNotDefined ();
290
+ }
291
+ }
292
+
293
+ @ InliningCutoff
294
+ private PException raiseNameNotDefined () {
295
+ if (raiseNode == null ) {
296
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
297
+ raiseNode = insert (PRaiseNode .create ());
289
298
}
299
+ throw raiseNode .raise (NameError , ErrorMessages .NAME_NOT_DEFINED , attributeId );
290
300
}
291
301
302
+ @ InliningCutoff
292
303
@ Specialization
293
304
Object returnBuiltin () {
294
305
PythonModule builtins = getBuiltins ();
0 commit comments