|
27 | 27 |
|
28 | 28 | import static com.oracle.graal.python.PythonLanguage.getPythonOS; |
29 | 29 | import static com.oracle.graal.python.PythonLanguage.throwIfUnsupported; |
30 | | -import static com.oracle.graal.python.annotations.PythonOS.PLATFORM_DARWIN; |
31 | 30 | import static com.oracle.graal.python.annotations.PythonOS.PLATFORM_WIN32; |
32 | 31 | import static com.oracle.graal.python.builtins.PythonBuiltinClassType.SystemError; |
33 | | -import static com.oracle.graal.python.builtins.modules.SysModuleBuiltins.T_ABIFLAGS; |
34 | | -import static com.oracle.graal.python.builtins.modules.SysModuleBuiltins.T_CACHE_TAG; |
35 | | -import static com.oracle.graal.python.builtins.modules.SysModuleBuiltins.T__MULTIARCH; |
36 | 32 | import static com.oracle.graal.python.builtins.modules.io.IONodes.T_CLOSED; |
37 | 33 | import static com.oracle.graal.python.builtins.modules.io.IONodes.T_FLUSH; |
38 | 34 | import static com.oracle.graal.python.builtins.objects.PythonAbstractObject.NATIVE_POINTER_FREED; |
39 | 35 | import static com.oracle.graal.python.builtins.objects.PythonAbstractObject.UNINITIALIZED; |
40 | | -import static com.oracle.graal.python.builtins.objects.str.StringUtils.cat; |
41 | 36 | import static com.oracle.graal.python.builtins.objects.thread.PThread.GRAALPYTHON_THREADS; |
42 | 37 | import static com.oracle.graal.python.nodes.BuiltinNames.T_PYEXPAT; |
43 | 38 | import static com.oracle.graal.python.nodes.BuiltinNames.T_SHA3; |
|
55 | 50 | import static com.oracle.graal.python.nodes.StringLiterals.J_EXT_DYLIB; |
56 | 51 | import static com.oracle.graal.python.nodes.StringLiterals.J_EXT_SO; |
57 | 52 | import static com.oracle.graal.python.nodes.StringLiterals.J_LIB_PREFIX; |
58 | | -import static com.oracle.graal.python.nodes.StringLiterals.T_DASH; |
59 | 53 | import static com.oracle.graal.python.nodes.StringLiterals.T_DOT; |
60 | 54 | import static com.oracle.graal.python.nodes.StringLiterals.T_EMPTY_STRING; |
61 | | -import static com.oracle.graal.python.nodes.StringLiterals.T_EXT_PYD; |
62 | | -import static com.oracle.graal.python.nodes.StringLiterals.T_EXT_SO; |
63 | 55 | import static com.oracle.graal.python.nodes.StringLiterals.T_JAVA; |
64 | 56 | import static com.oracle.graal.python.nodes.StringLiterals.T_NATIVE; |
65 | 57 | import static com.oracle.graal.python.nodes.StringLiterals.T_PATH; |
|
151 | 143 | import com.oracle.graal.python.nodes.SpecialAttributeNames; |
152 | 144 | import com.oracle.graal.python.nodes.SpecialMethodNames; |
153 | 145 | import com.oracle.graal.python.nodes.WriteUnraisableNode; |
154 | | -import com.oracle.graal.python.nodes.attributes.ReadAttributeFromModuleNode; |
155 | 146 | import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode; |
156 | 147 | import com.oracle.graal.python.nodes.bytecode_dsl.PBytecodeDSLRootNode; |
157 | 148 | import com.oracle.graal.python.nodes.call.CallNode; |
@@ -807,7 +798,7 @@ public enum CApiState { |
807 | 798 | @CompilationFinal private boolean nativeAccessAllowed; |
808 | 799 | @CompilationFinal private NativeContext nativeContext; |
809 | 800 |
|
810 | | - private TruffleString soABI; |
| 801 | + private TruffleString extensionSuffix; |
811 | 802 |
|
812 | 803 | private static final class GlobalInterpreterLock extends ReentrantLock { |
813 | 804 | private static final long serialVersionUID = 1L; |
@@ -2932,31 +2923,11 @@ public boolean isFinalizing() { |
2932 | 2923 | } |
2933 | 2924 |
|
2934 | 2925 | @TruffleBoundary |
2935 | | - public TruffleString getSoAbi() { |
2936 | | - if (soABI == null) { |
2937 | | - PythonModule sysModule = this.lookupBuiltinModule(T_SYS); |
2938 | | - Object implementationObj = ReadAttributeFromModuleNode.getUncached().execute(sysModule, T_IMPLEMENTATION); |
2939 | | - // sys.implementation.cache_tag |
2940 | | - TruffleString cacheTag = (TruffleString) PyObjectGetAttr.executeUncached(implementationObj, T_CACHE_TAG); |
2941 | | - TruffleString abiFlags = (TruffleString) ReadAttributeFromModuleNode.getUncached().execute(sysModule, T_ABIFLAGS); |
2942 | | - // sys.implementation._multiarch |
2943 | | - TruffleString multiArch = (TruffleString) PyObjectGetAttr.executeUncached(implementationObj, T__MULTIARCH); |
2944 | | - |
2945 | | - // only use '.pyd' if we are on 'Win32-native' |
2946 | | - TruffleString soExt; |
2947 | | - if (getPythonOS() == PLATFORM_DARWIN) { |
2948 | | - // not ".dylib", similar to CPython: |
2949 | | - // https://github.com/python/cpython/issues/37510 |
2950 | | - soExt = T_EXT_SO; |
2951 | | - } else if (getPythonOS() == PLATFORM_WIN32) { |
2952 | | - soExt = T_EXT_PYD; |
2953 | | - } else { |
2954 | | - soExt = T_EXT_SO; |
2955 | | - } |
2956 | | - |
2957 | | - soABI = cat(T_DOT, cacheTag, abiFlags, T_DASH, T_NATIVE, T_DASH, multiArch, soExt); |
| 2926 | + public TruffleString getExtensionSuffix() { |
| 2927 | + if (extensionSuffix == null) { |
| 2928 | + extensionSuffix = toTruffleStringUncached(PythonLanguage.GRAALPY_EXT_SUFFIX); |
2958 | 2929 | } |
2959 | | - return soABI; |
| 2930 | + return extensionSuffix; |
2960 | 2931 | } |
2961 | 2932 |
|
2962 | 2933 | public Thread getMainThread() { |
|
0 commit comments