81
81
import java .util .concurrent .atomic .AtomicReference ;
82
82
import java .util .logging .Level ;
83
83
84
- import com .oracle .graal .python .builtins .objects .common .EconomicMapStorage ;
85
- import com .oracle .truffle .api .strings .TruffleString ;
86
- import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .HPyRaiseNode ;
87
- import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .HPyTransformExceptionToNativeNode ;
88
- import com .oracle .graal .python .lib .PyObjectGetItem ;
89
- import com .oracle .graal .python .lib .PyObjectSetItem ;
90
- import com .oracle .graal .python .runtime .GilNode .UncachedAcquire ;
91
- import com .oracle .truffle .api .dsl .Fallback ;
92
84
import org .graalvm .nativeimage .ImageInfo ;
93
85
94
86
import com .oracle .graal .python .PythonLanguage ;
205
197
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyContextFunctions .GraalHPyUnicodeSubstring ;
206
198
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyContextFunctions .ReturnType ;
207
199
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .HPyAttachFunctionTypeNode ;
200
+ import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .HPyRaiseNode ;
201
+ import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .HPyTransformExceptionToNativeNode ;
208
202
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodes .PCallHPyFunction ;
209
203
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodesFactory .HPyAsPythonObjectNodeGen ;
210
204
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodesFactory .HPyGetNativeSpacePointerNodeGen ;
211
205
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodesFactory .HPyRaiseNodeGen ;
212
206
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodesFactory .HPyTransformExceptionToNativeNodeGen ;
213
207
import com .oracle .graal .python .builtins .objects .cext .hpy .GraalHPyNodesFactory .PCallHPyFunctionNodeGen ;
214
208
import com .oracle .graal .python .builtins .objects .cext .hpy .HPyExternalFunctionNodes .HPyCheckFunctionResultNode ;
209
+ import com .oracle .graal .python .builtins .objects .common .EconomicMapStorage ;
215
210
import com .oracle .graal .python .builtins .objects .common .EmptyStorage ;
216
211
import com .oracle .graal .python .builtins .objects .common .HashingStorage ;
217
212
import com .oracle .graal .python .builtins .objects .common .HashingStorageLibrary ;
234
229
import com .oracle .graal .python .lib .PyFloatAsDoubleNodeGen ;
235
230
import com .oracle .graal .python .lib .PyIndexCheckNodeGen ;
236
231
import com .oracle .graal .python .lib .PyLongAsDoubleNodeGen ;
232
+ import com .oracle .graal .python .lib .PyObjectGetItem ;
233
+ import com .oracle .graal .python .lib .PyObjectSetItem ;
237
234
import com .oracle .graal .python .lib .PyObjectSizeNodeGen ;
238
235
import com .oracle .graal .python .nodes .BuiltinNames ;
239
236
import com .oracle .graal .python .nodes .ErrorMessages ;
255
252
import com .oracle .graal .python .nodes .util .CastToJavaIntExactNode ;
256
253
import com .oracle .graal .python .runtime .AsyncHandler ;
257
254
import com .oracle .graal .python .runtime .GilNode ;
255
+ import com .oracle .graal .python .runtime .GilNode .UncachedAcquire ;
258
256
import com .oracle .graal .python .runtime .PythonContext ;
259
257
import com .oracle .graal .python .runtime .PythonOptions ;
260
258
import com .oracle .graal .python .runtime .PythonOptions .HPyBackendMode ;
279
277
import com .oracle .truffle .api .TruffleLogger ;
280
278
import com .oracle .truffle .api .dsl .Cached ;
281
279
import com .oracle .truffle .api .dsl .Cached .Shared ;
280
+ import com .oracle .truffle .api .dsl .Fallback ;
282
281
import com .oracle .truffle .api .dsl .GenerateUncached ;
283
282
import com .oracle .truffle .api .dsl .ImportStatic ;
284
283
import com .oracle .truffle .api .dsl .Specialization ;
299
298
import com .oracle .truffle .api .object .Shape ;
300
299
import com .oracle .truffle .api .source .Source ;
301
300
import com .oracle .truffle .api .source .Source .SourceBuilder ;
301
+ import com .oracle .truffle .api .strings .TruffleString ;
302
302
import com .oracle .truffle .llvm .spi .NativeTypeLibrary ;
303
303
import com .oracle .truffle .nfi .api .SignatureLibrary ;
304
304
@@ -1302,7 +1302,7 @@ public long getWcharSize() {
1302
1302
public long getHPyDebugContext () throws ApiInitException {
1303
1303
if (hPyDebugContext == 0 ) {
1304
1304
CompilerDirectives .transferToInterpreter ();
1305
- if (!getContext ().getEnv ().isNativeAccessAllowed ()) {
1305
+ if (!getContext ().getEnv ().isNativeAccessAllowed () || getContext (). getLanguage (). getEngineOption ( PythonOptions . HPyBackend ) != HPyBackendMode . JNI ) {
1306
1306
throw new ApiInitException (null , null , ErrorMessages .HPY_DEBUG_MODE_NOT_AVAILABLE );
1307
1307
}
1308
1308
try {
@@ -1322,7 +1322,7 @@ public long getHPyDebugContext() throws ApiInitException {
1322
1322
1323
1323
@ TruffleBoundary
1324
1324
public PythonModule getHPyDebugModule () throws ImportException {
1325
- if (!getContext ().getEnv ().isNativeAccessAllowed ()) {
1325
+ if (!getContext ().getEnv ().isNativeAccessAllowed () || getContext (). getLanguage (). getEngineOption ( PythonOptions . HPyBackend ) != HPyBackendMode . JNI ) {
1326
1326
throw new ImportException (null , null , null , ErrorMessages .HPY_DEBUG_MODE_NOT_AVAILABLE );
1327
1327
}
1328
1328
0 commit comments