59
59
import com .oracle .graal .python .builtins .objects .PNone ;
60
60
import com .oracle .graal .python .builtins .objects .bytes .BytesNodes ;
61
61
import com .oracle .graal .python .builtins .objects .bytes .PBytes ;
62
+ import com .oracle .graal .python .builtins .objects .common .SequenceStorageNodes ;
62
63
import com .oracle .graal .python .builtins .objects .exception .OSErrorEnum ;
63
64
import com .oracle .graal .python .builtins .objects .exception .OSErrorEnum .ErrorAndMessagePair ;
64
65
import com .oracle .graal .python .builtins .objects .function .PArguments ;
@@ -101,18 +102,18 @@ abstract static class ForkExecNode extends PythonBuiltinNode {
101
102
@ Child private BytesNodes .ToBytesNode toBytes = BytesNodes .ToBytesNode .create ();
102
103
103
104
@ Specialization
104
- @ SuppressWarnings ("try" )
105
105
int forkExec (VirtualFrame frame , PList args , @ SuppressWarnings ("unused" ) PList execList , @ SuppressWarnings ("unused" ) boolean closeFds ,
106
106
@ SuppressWarnings ("unused" ) PList fdsToKeep , String cwd , PList env ,
107
107
int p2cread , int p2cwrite , int c2pread , int c2pwrite ,
108
108
int errread , int errwrite , @ SuppressWarnings ("unused" ) int errpipe_read , int errpipe_write ,
109
- @ SuppressWarnings ("unused" ) boolean restore_signals , @ SuppressWarnings ("unused" ) boolean call_setsid , @ SuppressWarnings ("unused" ) PNone preexec_fn ) {
109
+ @ SuppressWarnings ("unused" ) boolean restore_signals , @ SuppressWarnings ("unused" ) boolean call_setsid , @ SuppressWarnings ("unused" ) PNone preexec_fn ,
110
+ @ Cached SequenceStorageNodes .CopyInternalArrayNode copy ) {
110
111
111
112
PythonContext context = getContext ();
112
113
Object state = IndirectCallContext .enter (frame , context , this );
113
114
try {
114
115
return forkExec (args , execList , closeFds , fdsToKeep , cwd , env , p2cread , p2cwrite , c2pread , c2pwrite , errread , errwrite , errpipe_read , errpipe_write , restore_signals , call_setsid ,
115
- preexec_fn );
116
+ preexec_fn , copy );
116
117
} finally {
117
118
IndirectCallContext .exit (frame , context , state );
118
119
}
@@ -123,15 +124,16 @@ private synchronized int forkExec(PList args, @SuppressWarnings("unused") PList
123
124
@ SuppressWarnings ("unused" ) PList fdsToKeep , String cwd , PList env ,
124
125
int p2cread , int p2cwrite , int c2pread , int c2pwrite ,
125
126
int errread , int errwrite , @ SuppressWarnings ("unused" ) int errpipe_read , int errpipe_write ,
126
- @ SuppressWarnings ("unused" ) boolean restore_signals , @ SuppressWarnings ("unused" ) boolean call_setsid , @ SuppressWarnings ("unused" ) PNone preexec_fn ) {
127
+ @ SuppressWarnings ("unused" ) boolean restore_signals , @ SuppressWarnings ("unused" ) boolean call_setsid , @ SuppressWarnings ("unused" ) PNone preexec_fn ,
128
+ @ Cached SequenceStorageNodes .CopyInternalArrayNode copy ) {
127
129
PythonContext context = getContext ();
128
130
PosixResources resources = context .getResources ();
129
131
if (!context .isExecutableAccessAllowed ()) {
130
132
return -1 ;
131
133
}
132
134
133
135
ArrayList <String > argStrings = new ArrayList <>();
134
- Object [] copyOfInternalArray = args .getSequenceStorage (). getCopyOfInternalArray ( );
136
+ Object [] copyOfInternalArray = copy . execute ( args .getSequenceStorage ());
135
137
for (Object o : copyOfInternalArray ) {
136
138
if (o instanceof String ) {
137
139
argStrings .add ((String ) o );
@@ -249,6 +251,7 @@ int forkExecDefault(VirtualFrame frame, Object args, Object executable_list, Obj
249
251
@ Cached CastToListNode castFdsToKeep ,
250
252
@ Cached CastToJavaStringNode castCwd ,
251
253
@ Cached CastToListNode castEnv ,
254
+ @ Cached SequenceStorageNodes .CopyInternalArrayNode copy ,
252
255
@ CachedLibrary (limit = "3" ) PythonObjectLibrary lib ) {
253
256
254
257
String actualCwd ;
@@ -281,7 +284,7 @@ int forkExecDefault(VirtualFrame frame, Object args, Object executable_list, Obj
281
284
lib .asSizeWithState (errpipe_read , PArguments .getThreadState (frame )),
282
285
lib .asSizeWithState (errpipe_write , PArguments .getThreadState (frame )),
283
286
lib .isTrueWithState (restore_signals , PArguments .getThreadState (frame )),
284
- lib .isTrueWithState (call_setsid , PArguments .getThreadState (frame )), preexec_fn );
287
+ lib .isTrueWithState (call_setsid , PArguments .getThreadState (frame )), preexec_fn , copy );
285
288
}
286
289
}
287
290
}
0 commit comments