Skip to content

Commit b51a3bc

Browse files
committed
Benchmarking the future default behavior of Native Image
1 parent 1a3d42a commit b51a3bc

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

vm/mx.vm/mx_vm_benchmark.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ def __init__(self, vm: NativeImageVM, bm_suite: BenchmarkSuite | NativeImageBenc
242242
base_image_build_args += ['-H:Preserve=all']
243243
if vm.preserve_classpath:
244244
base_image_build_args += ['-H:Preserve=module=ALL-UNNAMED']
245+
if vm.future_defaults:
246+
base_image_build_args += ['--future-defaults=all']
245247
if vm.analysis_context_sensitivity:
246248
base_image_build_args += ['-H:AnalysisContextSensitivity=' + vm.analysis_context_sensitivity, '-H:-RemoveSaturatedTypeFlows', '-H:+AliasArrayTypeFlows']
247249
if vm.optimization_level:
@@ -534,6 +536,7 @@ def __init__(self, name, config_name, extra_java_args=None, extra_launcher_args=
534536
self.native_architecture = False
535537
self.preserve_all = False
536538
self.preserve_classpath = False
539+
self.future_defaults = False
537540
self.use_upx = False
538541
self.use_open_type_world = False
539542
self.use_compacting_gc = False
@@ -567,19 +570,22 @@ def canonical_config_name(config_name):
567570
def config_name(self):
568571
# Generates the unique vm config name based on how the VM is actually configured.
569572
# It concatenates the config options in the correct order to match the expected format.
573+
# Note: the order of entries here must match the order of entries in _configure_from_name
570574
config = []
571575
if self.native_architecture is True:
572576
config += ["native-architecture"]
573-
if self.preserve_all is True:
574-
config += ["preserve-all"]
575-
if self.preserve_classpath is True:
576-
config += ["preserve-classpath"]
577577
if self.use_string_inlining is True:
578578
config += ["string-inlining"]
579579
if self.use_open_type_world is True:
580580
config += ["otw"]
581581
if self.use_compacting_gc is True:
582582
config += ["compacting-gc"]
583+
if self.preserve_all is True:
584+
config += ["preserve-all"]
585+
if self.preserve_classpath is True:
586+
config += ["preserve-classpath"]
587+
if self.future_defaults is True:
588+
config += ["future-defaults"]
583589
if self.is_gate is True:
584590
config += ["gate"]
585591
if self.use_upx is True:
@@ -643,8 +649,9 @@ def _configure_from_name(self, config_name):
643649
mx.abort(f"config_name must be set. Use 'default' for the default {self.__class__.__name__} configuration.")
644650

645651
# This defines the allowed config names for NativeImageVM. The ones registered will be available via --jvm-config
652+
# Note: the order of entries here must match the order of statements in config_name
646653
rule = r'^(?P<native_architecture>native-architecture-)?(?P<string_inlining>string-inlining-)?(?P<otw>otw-)?(?P<compacting_gc>compacting-gc-)?(?P<preserve_all>preserve-all-)?(?P<preserve_classpath>preserve-classpath-)?' \
647-
r'(?P<gate>gate-)?(?P<upx>upx-)?(?P<quickbuild>quickbuild-)?(?P<gc>g1gc-)?' \
654+
r'(?P<future_defaults>future-defaults-)?(?P<gate>gate-)?(?P<upx>upx-)?(?P<quickbuild>quickbuild-)?(?P<gc>g1gc-)?' \
648655
r'(?P<llvm>llvm-)?(?P<pgo>pgo-|pgo-sampler-)?(?P<inliner>inline-)?' \
649656
r'(?P<analysis_context_sensitivity>insens-|allocsens-|1obj-|2obj1h-|3obj2h-|4obj3h-)?(?P<no_inlining_before_analysis>no-inline-)?(?P<jdk_profiles>jdk-profiles-collect-|adopted-jdk-pgo-)?' \
650657
r'(?P<profile_inference>profile-inference-feature-extraction-|profile-inference-pgo-|profile-inference-debug-)?(?P<sampler>safepoint-sampler-|async-sampler-)?(?P<optimization_level>O0-|O1-|O2-|O3-|Os-)?(default-)?(?P<edition>ce-|ee-)?$'
@@ -667,6 +674,10 @@ def _configure_from_name(self, config_name):
667674
mx.logv(f"'preserve-classpath' is enabled for {config_name}")
668675
self.preserve_classpath = True
669676

677+
if matching.group("future_defaults") is not None:
678+
mx.logv(f"'future-defaults' is enabled for {config_name}")
679+
self.future_defaults = True
680+
670681
if matching.group("string_inlining") is not None:
671682
mx.logv(f"'string-inlining' is enabled for {config_name}")
672683
self.use_string_inlining = True

0 commit comments

Comments
 (0)