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 77
77
import static com .oracle .graal .python .nodes .ErrorMessages .NATIVE_S_SUBTYPES_NOT_IMPLEMENTED ;
78
78
import static com .oracle .graal .python .nodes .StringLiterals .J_LLVM_LANGUAGE ;
79
79
import static com .oracle .graal .python .nodes .StringLiterals .J_NFI_LANGUAGE ;
80
+ import static com .oracle .graal .python .nodes .StringLiterals .J_NATIVE ;
80
81
import static com .oracle .graal .python .util .PythonUtils .EMPTY_OBJECT_ARRAY ;
81
82
import static com .oracle .graal .python .util .PythonUtils .TS_ENCODING ;
82
83
import static com .oracle .graal .python .util .PythonUtils .toTruffleStringUncached ;
@@ -1707,10 +1708,14 @@ int doIt(Object object) {
1707
1708
}
1708
1709
return 1 ;
1709
1710
}
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 {
1714
1719
InteropLibrary .getUncached ().toNative (object );
1715
1720
}
1716
1721
return 0 ;
Original file line number Diff line number Diff line change @@ -2514,14 +2514,16 @@ public long getDeserializationId(TruffleString fileName) {
2514
2514
2515
2515
@ TruffleBoundary
2516
2516
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 );
2525
2527
}
2526
2528
2527
2529
@ TruffleBoundary
You can’t perform that action at this time.
0 commit comments