262
262
collect_parser .add_argument ("collection_args" , nargs = '?' , help = "Arguments to pass to the SuperPMI collect command. This is a single string; quote it if necessary if the arguments contain spaces." )
263
263
264
264
collect_parser .add_argument ("--pmi" , action = "store_true" , help = "Run PMI on a set of directories or assemblies." )
265
- collect_parser .add_argument ("--crossgen" , action = "store_true" , help = "Run crossgen on a set of directories or assemblies." )
266
265
collect_parser .add_argument ("--crossgen2" , action = "store_true" , help = "Run crossgen2 on a set of directories or assemblies." )
267
- collect_parser .add_argument ("-assemblies" , dest = "assemblies" , nargs = "+" , default = [], help = "A list of managed dlls or directories to recursively use while collecting with PMI, crossgen, or crossgen2. Required if --pmi, --crossgen, or --crossgen2 is specified." )
266
+ collect_parser .add_argument ("-assemblies" , dest = "assemblies" , nargs = "+" , default = [], help = "A list of managed dlls or directories to recursively use while collecting with PMI or crossgen2. Required if --pmi or --crossgen2 is specified." )
268
267
collect_parser .add_argument ("-exclude" , dest = "exclude" , nargs = "+" , default = [], help = "A list of files or directories to exclude from the files and directories specified by `-assemblies`." )
269
268
collect_parser .add_argument ("-pmi_location" , help = "Path to pmi.dll to use during PMI run. Optional; pmi.dll will be downloaded from Azure Storage if necessary." )
270
269
collect_parser .add_argument ("-output_mch_path" , help = "Location to place the final MCH file." )
@@ -906,15 +905,12 @@ def __init__(self, coreclr_args):
906
905
if coreclr_args .host_os == "OSX" :
907
906
self .collection_shim_name = "libsuperpmi-shim-collector.dylib"
908
907
self .corerun_tool_name = "corerun"
909
- self .crossgen_tool_name = "crossgen"
910
908
elif coreclr_args .host_os == "Linux" :
911
909
self .collection_shim_name = "libsuperpmi-shim-collector.so"
912
910
self .corerun_tool_name = "corerun"
913
- self .crossgen_tool_name = "crossgen"
914
911
elif coreclr_args .host_os == "windows" :
915
912
self .collection_shim_name = "superpmi-shim-collector.dll"
916
913
self .corerun_tool_name = "corerun.exe"
917
- self .crossgen_tool_name = "crossgen.exe"
918
914
else :
919
915
raise RuntimeError ("Unsupported OS." )
920
916
@@ -931,9 +927,6 @@ def __init__(self, coreclr_args):
931
927
self .pmi_location = determine_pmi_location (coreclr_args )
932
928
self .corerun = os .path .join (self .core_root , self .corerun_tool_name )
933
929
934
- if coreclr_args .crossgen :
935
- self .crossgen_tool = os .path .join (self .core_root , self .crossgen_tool_name )
936
-
937
930
if coreclr_args .crossgen2 :
938
931
self .corerun = os .path .join (self .core_root , self .corerun_tool_name )
939
932
if coreclr_args .dotnet_tool_path is None :
@@ -942,7 +935,7 @@ def __init__(self, coreclr_args):
942
935
self .crossgen2_driver_tool = coreclr_args .dotnet_tool_path
943
936
logging .debug ("Using crossgen2 driver tool %s" , self .crossgen2_driver_tool )
944
937
945
- if coreclr_args .pmi or coreclr_args .crossgen or coreclr_args . crossgen2 :
938
+ if coreclr_args .pmi or coreclr_args .crossgen2 :
946
939
self .assemblies = coreclr_args .assemblies
947
940
self .exclude = coreclr_args .exclude
948
941
@@ -1081,7 +1074,7 @@ def set_and_report_env(env, root_env, complus_env = None):
1081
1074
1082
1075
# If we need them, collect all the assemblies we're going to use for the collection(s).
1083
1076
# Remove the files matching the `-exclude` arguments (case-insensitive) from the list.
1084
- if self .coreclr_args .pmi or self .coreclr_args .crossgen or self . coreclr_args . crossgen2 :
1077
+ if self .coreclr_args .pmi or self .coreclr_args .crossgen2 :
1085
1078
assemblies = []
1086
1079
for item in self .assemblies :
1087
1080
assemblies += get_files_from_path (item , match_func = lambda file : any (file .endswith (extension ) for extension in [".dll" , ".exe" ]) and (self .exclude is None or not any (e .lower () in file .lower () for e in self .exclude )))
@@ -1180,84 +1173,6 @@ async def run_pmi(print_prefix, assembly, self):
1180
1173
os .environ .update (old_env )
1181
1174
################################################################################################ end of "self.coreclr_args.pmi is True"
1182
1175
1183
- ################################################################################################ Do collection using crossgen
1184
- if self .coreclr_args .crossgen is True :
1185
- logging .debug ("Starting collection using crossgen" )
1186
-
1187
- async def run_crossgen (print_prefix , assembly , self ):
1188
- """ Run crossgen over all dlls
1189
- """
1190
-
1191
- root_crossgen_output_filename = make_safe_filename ("crossgen_" + assembly ) + ".out.dll"
1192
- crossgen_output_assembly_filename = os .path .join (self .temp_location , root_crossgen_output_filename )
1193
- try :
1194
- if os .path .exists (crossgen_output_assembly_filename ):
1195
- os .remove (crossgen_output_assembly_filename )
1196
- except OSError as ose :
1197
- if "[WinError 32] The process cannot access the file because it is being used by another " \
1198
- "process:" in format (ose ):
1199
- logging .warning ("Skipping file %s. Got error: %s" , crossgen_output_assembly_filename , ose )
1200
- return
1201
- else :
1202
- raise ose
1203
-
1204
- command = [self .crossgen_tool , "/Platform_Assemblies_Paths" , self .core_root , "/in" , assembly , "/out" , crossgen_output_assembly_filename ]
1205
- command_string = " " .join (command )
1206
- logging .debug ("%s%s" , print_prefix , command_string )
1207
-
1208
- # Save the stdout and stderr to files, so we can see if crossgen wrote any interesting messages.
1209
- # Use the name of the assembly as the basename of the file. mkstemp() will ensure the file
1210
- # is unique.
1211
- root_output_filename = make_safe_filename ("crossgen_" + assembly + "_" )
1212
- try :
1213
- stdout_file_handle , stdout_filepath = tempfile .mkstemp (suffix = ".stdout" , prefix = root_output_filename , dir = self .temp_location )
1214
- stderr_file_handle , stderr_filepath = tempfile .mkstemp (suffix = ".stderr" , prefix = root_output_filename , dir = self .temp_location )
1215
-
1216
- proc = await asyncio .create_subprocess_shell (
1217
- command_string ,
1218
- stdout = stdout_file_handle ,
1219
- stderr = stderr_file_handle )
1220
-
1221
- await proc .communicate ()
1222
-
1223
- os .close (stdout_file_handle )
1224
- os .close (stderr_file_handle )
1225
-
1226
- # No need to keep zero-length files
1227
- if is_zero_length_file (stdout_filepath ):
1228
- os .remove (stdout_filepath )
1229
- if is_zero_length_file (stderr_filepath ):
1230
- os .remove (stderr_filepath )
1231
-
1232
- return_code = proc .returncode
1233
- if return_code != 0 :
1234
- logging .debug ("'%s': Error return code: %s" , command_string , return_code )
1235
- write_file_to_log (stdout_filepath , log_level = logging .DEBUG )
1236
-
1237
- write_file_to_log (stderr_filepath , log_level = logging .DEBUG )
1238
- except OSError as ose :
1239
- if "[WinError 32] The process cannot access the file because it is being used by another " \
1240
- "process:" in format (ose ):
1241
- logging .warning ("Skipping file %s. Got error: %s" , root_output_filename , ose )
1242
- else :
1243
- raise ose
1244
-
1245
- # Set environment variables.
1246
- crossgen_command_env = env_copy .copy ()
1247
- crossgen_complus_env = complus_env .copy ()
1248
- crossgen_complus_env ["JitName" ] = self .collection_shim_name
1249
- set_and_report_env (crossgen_command_env , root_env , crossgen_complus_env )
1250
-
1251
- old_env = os .environ .copy ()
1252
- os .environ .update (crossgen_command_env )
1253
-
1254
- helper = AsyncSubprocessHelper (assemblies , verbose = True )
1255
- helper .run_to_completion (run_crossgen , self )
1256
-
1257
- os .environ .clear ()
1258
- os .environ .update (old_env )
1259
- ################################################################################################ end of "self.coreclr_args.crossgen is True"
1260
-
1261
1176
################################################################################################ Do collection using crossgen2
1262
1177
if self .coreclr_args .crossgen2 is True :
1263
1178
logging .debug ("Starting collection using crossgen2" )
@@ -3435,11 +3350,6 @@ def verify_replay_common_args():
3435
3350
lambda unused : True ,
3436
3351
"Unable to set pmi" )
3437
3352
3438
- coreclr_args .verify (args ,
3439
- "crossgen" ,
3440
- lambda unused : True ,
3441
- "Unable to set crossgen" )
3442
-
3443
3353
coreclr_args .verify (args ,
3444
3354
"crossgen2" ,
3445
3355
lambda unused : True ,
@@ -3512,8 +3422,8 @@ def verify_replay_common_args():
3512
3422
lambda unused : True ,
3513
3423
"Unable to set tiered_compilation" )
3514
3424
3515
- if (args .collection_command is None ) and (args .pmi is False ) and (args .crossgen is False ) and ( args . crossgen2 is False ):
3516
- print ("Either a collection command or `--pmi` or `--crossgen` or `-- crossgen2` must be specified" )
3425
+ if (args .collection_command is None ) and (args .pmi is False ) and (args .crossgen2 is False ):
3426
+ print ("Either a collection command or `--pmi` or `--crossgen2` must be specified" )
3517
3427
sys .exit (1 )
3518
3428
3519
3429
if (args .collection_command is not None ) and (len (args .assemblies ) > 0 ):
@@ -3524,13 +3434,13 @@ def verify_replay_common_args():
3524
3434
print ("Don't specify `-exclude` if a collection command is given" )
3525
3435
sys .exit (1 )
3526
3436
3527
- if ((args .pmi is True ) or (args .crossgen is True ) or ( args . crossgen2 is True )) and (len (args .assemblies ) == 0 ):
3528
- print ("Specify `-assemblies` if `--pmi` or `--crossgen` or `-- crossgen2` is given" )
3437
+ if ((args .pmi is True ) or (args .crossgen2 is True )) and (len (args .assemblies ) == 0 ):
3438
+ print ("Specify `-assemblies` if `--pmi` or `--crossgen2` is given" )
3529
3439
sys .exit (1 )
3530
3440
3531
3441
if args .collection_command is None and args .merge_mch_files is not True :
3532
3442
assert args .collection_args is None
3533
- assert (args .pmi is True ) or (args .crossgen is True ) or ( args . crossgen2 is True )
3443
+ assert (args .pmi is True ) or (args .crossgen2 is True )
3534
3444
assert len (args .assemblies ) > 0
3535
3445
3536
3446
if coreclr_args .merge_mch_files :
0 commit comments