Skip to content

Commit a4b3772

Browse files
authored
Remove crossgen from superpmi tools (#53958)
* Remove crossgen SPMI collection * Remove reference of crossgen from superpmi.py * some misc crossgen references * put back deleted things
1 parent 327deea commit a4b3772

File tree

5 files changed

+11
-122
lines changed

5 files changed

+11
-122
lines changed

eng/pipelines/coreclr/superpmi.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,6 @@ jobs:
7777
collectionType: pmi
7878
collectionName: libraries
7979

80-
- template: /eng/pipelines/common/platform-matrix.yml
81-
parameters:
82-
jobTemplate: /eng/pipelines/coreclr/templates/superpmi-job.yml
83-
buildConfig: checked
84-
platforms:
85-
# Linux tests are built on the OSX machines.
86-
# - OSX_x64
87-
- Linux_arm
88-
- Linux_arm64
89-
- Linux_x64
90-
- windows_x64
91-
- windows_x86
92-
- windows_arm64
93-
helixQueueGroup: ci
94-
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
95-
jobParameters:
96-
testGroup: outerloop
97-
liveLibrariesBuildConfig: Release
98-
collectionType: crossgen
99-
collectionName: libraries
100-
10180
- template: /eng/pipelines/common/platform-matrix.yml
10281
parameters:
10382
jobTemplate: /eng/pipelines/coreclr/templates/superpmi-job.yml

src/coreclr/ToolBox/superpmi/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ speed up the disk operations.
9191
These are the general steps that are followed when doing a SuperPMI collection:
9292

9393
1. Collect .MC files. Set up for collection, then cause the JIT to be invoked
94-
by either running a scenario, running tests, crossgen compiling assemblies,
94+
by either running a scenario, running tests, crossgen2 compiling assemblies,
9595
or using PMI to force the JIT to compile functions in an assembly.
9696
During collection, the data for each JIT compiled function is stored
9797
in a uniquely named file with a ".MC" filename extension (for "method context").

src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,7 @@ uint16_t interceptor_ICJI::getRelocTypeHint(void* target)
21152115

21162116
// For what machine does the VM expect the JIT to generate code? The VM
21172117
// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM
2118-
// is cross-compiling (such as the case for crossgen), it will return a
2118+
// is cross-compiling (such as the case for crossgen2), it will return a
21192119
// different value than if it was compiling for the host architecture.
21202120
//
21212121
uint32_t interceptor_ICJI::getExpectedTargetArchitecture()

src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ uint16_t MyICJI::getRelocTypeHint(void* target)
18591859

18601860
// For what machine does the VM expect the JIT to generate code? The VM
18611861
// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM
1862-
// is cross-compiling (such as the case for crossgen), it will return a
1862+
// is cross-compiling (such as the case for crossgen2), it will return a
18631863
// different value than if it was compiling for the host architecture.
18641864
//
18651865
uint32_t MyICJI::getExpectedTargetArchitecture()

src/coreclr/scripts/superpmi.py

Lines changed: 8 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,8 @@
262262
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.")
263263

264264
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.")
266265
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.")
268267
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`.")
269268
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.")
270269
collect_parser.add_argument("-output_mch_path", help="Location to place the final MCH file.")
@@ -906,15 +905,12 @@ def __init__(self, coreclr_args):
906905
if coreclr_args.host_os == "OSX":
907906
self.collection_shim_name = "libsuperpmi-shim-collector.dylib"
908907
self.corerun_tool_name = "corerun"
909-
self.crossgen_tool_name = "crossgen"
910908
elif coreclr_args.host_os == "Linux":
911909
self.collection_shim_name = "libsuperpmi-shim-collector.so"
912910
self.corerun_tool_name = "corerun"
913-
self.crossgen_tool_name = "crossgen"
914911
elif coreclr_args.host_os == "windows":
915912
self.collection_shim_name = "superpmi-shim-collector.dll"
916913
self.corerun_tool_name = "corerun.exe"
917-
self.crossgen_tool_name = "crossgen.exe"
918914
else:
919915
raise RuntimeError("Unsupported OS.")
920916

@@ -931,9 +927,6 @@ def __init__(self, coreclr_args):
931927
self.pmi_location = determine_pmi_location(coreclr_args)
932928
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
933929

934-
if coreclr_args.crossgen:
935-
self.crossgen_tool = os.path.join(self.core_root, self.crossgen_tool_name)
936-
937930
if coreclr_args.crossgen2:
938931
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
939932
if coreclr_args.dotnet_tool_path is None:
@@ -942,7 +935,7 @@ def __init__(self, coreclr_args):
942935
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
943936
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)
944937

945-
if coreclr_args.pmi or coreclr_args.crossgen or coreclr_args.crossgen2:
938+
if coreclr_args.pmi or coreclr_args.crossgen2:
946939
self.assemblies = coreclr_args.assemblies
947940
self.exclude = coreclr_args.exclude
948941

@@ -1081,7 +1074,7 @@ def set_and_report_env(env, root_env, complus_env = None):
10811074

10821075
# If we need them, collect all the assemblies we're going to use for the collection(s).
10831076
# 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:
10851078
assemblies = []
10861079
for item in self.assemblies:
10871080
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):
11801173
os.environ.update(old_env)
11811174
################################################################################################ end of "self.coreclr_args.pmi is True"
11821175

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-
12611176
################################################################################################ Do collection using crossgen2
12621177
if self.coreclr_args.crossgen2 is True:
12631178
logging.debug("Starting collection using crossgen2")
@@ -3435,11 +3350,6 @@ def verify_replay_common_args():
34353350
lambda unused: True,
34363351
"Unable to set pmi")
34373352

3438-
coreclr_args.verify(args,
3439-
"crossgen",
3440-
lambda unused: True,
3441-
"Unable to set crossgen")
3442-
34433353
coreclr_args.verify(args,
34443354
"crossgen2",
34453355
lambda unused: True,
@@ -3512,8 +3422,8 @@ def verify_replay_common_args():
35123422
lambda unused: True,
35133423
"Unable to set tiered_compilation")
35143424

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")
35173427
sys.exit(1)
35183428

35193429
if (args.collection_command is not None) and (len(args.assemblies) > 0):
@@ -3524,13 +3434,13 @@ def verify_replay_common_args():
35243434
print("Don't specify `-exclude` if a collection command is given")
35253435
sys.exit(1)
35263436

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")
35293439
sys.exit(1)
35303440

35313441
if args.collection_command is None and args.merge_mch_files is not True:
35323442
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)
35343444
assert len(args.assemblies) > 0
35353445

35363446
if coreclr_args.merge_mch_files:

0 commit comments

Comments
 (0)