File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 7777import static com .oracle .graal .python .nodes .ErrorMessages .NATIVE_S_SUBTYPES_NOT_IMPLEMENTED ;
7878import static com .oracle .graal .python .nodes .StringLiterals .J_LLVM_LANGUAGE ;
7979import static com .oracle .graal .python .nodes .StringLiterals .J_NFI_LANGUAGE ;
80+ import static com .oracle .graal .python .nodes .StringLiterals .J_NATIVE ;
8081import static com .oracle .graal .python .util .PythonUtils .EMPTY_OBJECT_ARRAY ;
8182import static com .oracle .graal .python .util .PythonUtils .TS_ENCODING ;
8283import static com .oracle .graal .python .util .PythonUtils .toTruffleStringUncached ;
@@ -1707,10 +1708,14 @@ int doIt(Object object) {
17071708 }
17081709 return 1 ;
17091710 }
1710- Env env = getContext ().getEnv ();
1711- LanguageInfo llvmInfo = env .getInternalLanguages ().get (J_LLVM_LANGUAGE );
1712- Toolchain toolchain = env .lookup (llvmInfo , Toolchain .class );
1713- if ("native" .equals (toolchain .getIdentifier ())) {
1711+ if (!getContext ().getOption (PythonOptions .NativeModules )) {
1712+ Env env = getContext ().getEnv ();
1713+ LanguageInfo llvmInfo = env .getInternalLanguages ().get (J_LLVM_LANGUAGE );
1714+ Toolchain toolchain = env .lookup (llvmInfo , Toolchain .class );
1715+ if (J_NATIVE .equals (toolchain .getIdentifier ())) {
1716+ InteropLibrary .getUncached ().toNative (object );
1717+ }
1718+ } else {
17141719 InteropLibrary .getUncached ().toNative (object );
17151720 }
17161721 return 0 ;
Original file line number Diff line number Diff line change @@ -2514,14 +2514,16 @@ public long getDeserializationId(TruffleString fileName) {
25142514
25152515 @ TruffleBoundary
25162516 public String getLLVMSupportExt (String libName ) {
2517- LanguageInfo llvmInfo = env .getInternalLanguages ().get (J_LLVM_LANGUAGE );
2518- Toolchain toolchain = env .lookup (llvmInfo , Toolchain .class );
2519- String toolchainIdentifier = toolchain .getIdentifier ();
2520- if (J_NATIVE .equals (toolchainIdentifier )) {
2521- return PythonContext .getSupportLibName (libName + '-' + J_NATIVE );
2522- }
2523- // if not native, we always assume a Linux-like system
2524- return PythonContext .getSupportLibName (PythonOS .PLATFORM_LINUX , libName + '-' + toolchainIdentifier );
2517+ if (!getOption (PythonOptions .NativeModules )) {
2518+ LanguageInfo llvmInfo = env .getInternalLanguages ().get (J_LLVM_LANGUAGE );
2519+ Toolchain toolchain = env .lookup (llvmInfo , Toolchain .class );
2520+ String toolchainIdentifier = toolchain .getIdentifier ();
2521+ if (!J_NATIVE .equals (toolchainIdentifier )) {
2522+ // if not native, we always assume a Linux-like system
2523+ return PythonContext .getSupportLibName (PythonOS .PLATFORM_LINUX , libName + '-' + toolchainIdentifier );
2524+ }
2525+ }
2526+ return PythonContext .getSupportLibName (libName + '-' + J_NATIVE );
25252527 }
25262528
25272529 @ TruffleBoundary
You can’t perform that action at this time.
0 commit comments