169
169
import com .oracle .graal .python .runtime .PythonOptions ;
170
170
import com .oracle .graal .python .runtime .exception .PException ;
171
171
import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
172
+ import com .oracle .graal .python .runtime .object .PythonObjectSlowPathFactory ;
172
173
import com .oracle .graal .python .util .PythonUtils ;
173
174
import com .oracle .truffle .api .CompilerDirectives ;
174
175
import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
@@ -704,14 +705,13 @@ private static TruffleString getErrMsg(Exception e) {
704
705
return toTruffleStringUncached (errmsg );
705
706
}
706
707
708
+ @ TruffleBoundary
707
709
@ Specialization
708
- static Object py_dl_open (VirtualFrame frame , PythonModule self , TruffleString name , int m ,
710
+ static Object py_dl_open (PythonModule self , TruffleString name , int m ,
709
711
@ Bind ("this" ) Node inliningTarget ,
710
- @ Cached PyObjectHashNode hashNode ,
711
- @ Cached AuditNode auditNode ,
712
- @ Cached EqualNode eqNode ,
713
- @ Cached PythonObjectFactory factory ,
714
- @ Cached PRaiseNode .Lazy raiseNode ) {
712
+ @ Cached AuditNode auditNode ) {
713
+ PythonContext context = PythonContext .get (inliningTarget );
714
+ PythonObjectSlowPathFactory factory = context .factory ();
715
715
auditNode .audit (inliningTarget , "ctypes.dlopen" , name );
716
716
if (name .isEmpty ()) {
717
717
return factory .createNativeVoidPtr (((CtypesModuleBuiltins ) self .getBuiltins ()).rtldDefault );
@@ -722,13 +722,12 @@ static Object py_dl_open(VirtualFrame frame, PythonModule self, TruffleString na
722
722
723
723
int mode = m != Integer .MIN_VALUE ? m : RTLD_LOCAL .getValueIfDefined ();
724
724
mode |= RTLD_NOW .getValueIfDefined ();
725
- PythonContext context = PythonContext .get (inliningTarget );
726
725
DLHandler handle ;
727
726
Exception exception = null ;
728
727
try {
729
728
if (!context .getEnv ().isNativeAccessAllowed () && !PythonOptions .NativeModules .getValue (context .getEnv ().getOptions ())) {
730
729
Object handler = loadLLVMLibrary (context , inliningTarget , name );
731
- long adr = hashNode . execute ( frame , inliningTarget , handler );
730
+ long adr = PyObjectHashNode . executeUncached ( handler );
732
731
handle = new DLHandler (handler , adr , name .toJavaStringUncached (), true );
733
732
registerAddress (context , handle .adr , handle );
734
733
return factory .createNativeVoidPtr (handle );
@@ -737,6 +736,7 @@ static Object py_dl_open(VirtualFrame frame, PythonModule self, TruffleString na
737
736
/*-
738
737
TODO: (mq) cryptography in macos isn't always compatible with ctypes.
739
738
*/
739
+ EqualNode eqNode = EqualNode .getUncached ();
740
740
if (!eqNode .execute (name , MACOS_Security_LIB , TS_ENCODING ) && !eqNode .execute (name , MACOS_CoreFoundation_LIB , TS_ENCODING )) {
741
741
handle = loadNFILibrary (context , ctypes .backendType , name .toJavaStringUncached (), mode );
742
742
registerAddress (context , handle .adr , handle );
@@ -746,7 +746,7 @@ static Object py_dl_open(VirtualFrame frame, PythonModule self, TruffleString na
746
746
} catch (Exception e ) {
747
747
exception = e ;
748
748
}
749
- throw raiseNode . get (inliningTarget ). raise ( OSError , getErrMsg (exception ));
749
+ throw PRaiseNode . raiseUncached (inliningTarget , OSError , getErrMsg (exception ));
750
750
}
751
751
}
752
752
0 commit comments