Skip to content

Commit 0ee2f17

Browse files
imx_substratevm_benchmark: Set java.home while running Dotty
1 parent c0c6676 commit 0ee2f17

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

substratevm/mx.substratevm/mx_substratevm_benchmark.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,21 @@ def run(self, benchmarks, bmSuiteArgs) -> mx_benchmark.DataPoints:
194194

195195
def extra_run_arg(self, benchmark, args, image_run_args):
196196
run_args = super(RenaissanceNativeImageBenchmarkSuite, self).extra_run_arg(benchmark, args, image_run_args)
197-
if benchmark == "dotty" and self.version() not in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]:
198-
# Before Renaissance 0.14.0, mx was manually placing all dependencies on the same classpath at build time
199-
# and at run time. As of Renaissance 0.14.0, we use the standalone mode which uses the classpath defined
200-
# in the manifest file at build time only. Dotty is a special benchmark since it also needs to know
201-
# this classpath at runtime to be able to perform compilations. The location of the fatjar must then be
202-
# explicitly passed also to the final image.
203-
return ["-Djava.class.path={}".format(self.standalone_jar_path(self.benchmarkName()))] + run_args
204-
else:
205-
return run_args
197+
return self._extra_native_run_args(benchmark) + run_args
198+
199+
def _extra_native_run_args(self, benchmark):
200+
if benchmark == "dotty":
201+
# Dotty uses -H:+AllowJRTFileSystem which requires setting java.home at run time.
202+
dotty_extra_run_args = ['-Djava.home=' + mx.get_jdk().home]
203+
if self.version() not in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]:
204+
# Before Renaissance 0.14.0, mx was manually placing all dependencies on the same classpath at build time
205+
# and at run time. As of Renaissance 0.14.0, we use the standalone mode which uses the classpath defined
206+
# in the manifest file at build time only. Dotty is a special benchmark since it also needs to know
207+
# this classpath at runtime to be able to perform compilations. The location of the fatjar must then be
208+
# explicitly passed also to the final image.
209+
dotty_extra_run_args += ["-Djava.class.path={}".format(self.standalone_jar_path(self.benchmarkName()))]
210+
return dotty_extra_run_args
211+
return []
206212

207213
def renaissance_additional_lib(self, lib):
208214
return mx.library(lib).get_path(True)
@@ -219,16 +225,7 @@ def extra_profile_run_arg(self, benchmark, args, image_run_args, should_strip_ru
219225
extra_profile_run_args = mx_sdk_benchmark.adjust_arg_with_number('-r', 1, user_args)
220226
else:
221227
extra_profile_run_args = user_args
222-
223-
if benchmark == "dotty" and self.version() not in ["0.9.0", "0.10.0", "0.11.0", "0.12.0", "0.13.0"]:
224-
# Before Renaissance 0.14.0, mx was manually placing all dependencies on the same classpath at build time
225-
# and at run time. As of Renaissance 0.14.0, we use the standalone mode which uses the classpath defined
226-
# in the manifest file at build time only. Dotty is a special benchmark since it also needs to know
227-
# this classpath at runtime to be able to perform compilations. The location of the fatjar must then be
228-
# explicitly passed also to the final image.
229-
return ["-Djava.class.path={}".format(self.standalone_jar_path(self.benchmarkName()))] + extra_profile_run_args
230-
else:
231-
return extra_profile_run_args
228+
return self._extra_native_run_args(benchmark) + extra_profile_run_args
232229

233230
def skip_agent_assertions(self, benchmark, args):
234231
user_args = super(RenaissanceNativeImageBenchmarkSuite, self).skip_agent_assertions(benchmark, args)

0 commit comments

Comments
 (0)