Skip to content

Commit 45744cb

Browse files
committed
Benchmarking the future default behavior of Native Image
1 parent 8861665 commit 45744cb

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

sdk/mx.sdk/mx_sdk_benchmark.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ def __init__(self, vm: NativeImageVM, bm_suite: BenchmarkSuite | NativeImageBenc
408408
base_image_build_args += ['-H:Preserve=all']
409409
if vm.preserve_classpath:
410410
base_image_build_args += ['-H:Preserve=module=ALL-UNNAMED']
411+
if vm.future_defaults_all:
412+
base_image_build_args += ['--future-defaults=all']
411413
if vm.analysis_context_sensitivity:
412414
base_image_build_args += ['-H:AnalysisContextSensitivity=' + vm.analysis_context_sensitivity,
413415
'-H:-RemoveSaturatedTypeFlows', '-H:+AliasArrayTypeFlows']
@@ -719,6 +721,7 @@ def __init__(self, name, config_name, extra_java_args=None, extra_launcher_args=
719721
self.native_architecture = False
720722
self.preserve_all = False
721723
self.preserve_classpath = False
724+
self.future_defaults_all = False
722725
self.use_upx = False
723726
self.use_open_type_world = False
724727
self.use_compacting_gc = False
@@ -752,19 +755,22 @@ def canonical_config_name(config_name):
752755
def config_name(self):
753756
# Generates the unique vm config name based on how the VM is actually configured.
754757
# It concatenates the config options in the correct order to match the expected format.
758+
# Note: the order of entries here must match the order of entries in _configure_from_name
755759
config = []
756760
if self.native_architecture is True:
757761
config += ["native-architecture"]
758-
if self.preserve_all is True:
759-
config += ["preserve-all"]
760-
if self.preserve_classpath is True:
761-
config += ["preserve-classpath"]
762762
if self.use_string_inlining is True:
763763
config += ["string-inlining"]
764764
if self.use_open_type_world is True:
765765
config += ["otw"]
766766
if self.use_compacting_gc is True:
767767
config += ["compacting-gc"]
768+
if self.preserve_all is True:
769+
config += ["preserve-all"]
770+
if self.preserve_classpath is True:
771+
config += ["preserve-classpath"]
772+
if self.future_defaults_all is True:
773+
config += ["future-defaults-all"]
768774
if self.is_gate is True:
769775
config += ["gate"]
770776
if self.use_upx is True:
@@ -828,8 +834,9 @@ def _configure_from_name(self, config_name):
828834
mx.abort(f"config_name must be set. Use 'default' for the default {self.__class__.__name__} configuration.")
829835

830836
# This defines the allowed config names for NativeImageVM. The ones registered will be available via --jvm-config
837+
# Note: the order of entries here must match the order of statements in NativeImageVM.config_name()
831838
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-)?' \
832-
r'(?P<gate>gate-)?(?P<upx>upx-)?(?P<quickbuild>quickbuild-)?(?P<gc>g1gc-)?' \
839+
r'(?P<future_defaults_all>future-defaults-all-)?(?P<gate>gate-)?(?P<upx>upx-)?(?P<quickbuild>quickbuild-)?(?P<gc>g1gc-)?' \
833840
r'(?P<llvm>llvm-)?(?P<pgo>pgo-|pgo-sampler-)?(?P<inliner>inline-)?' \
834841
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-)?' \
835842
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-)?$'
@@ -852,6 +859,10 @@ def _configure_from_name(self, config_name):
852859
mx.logv(f"'preserve-classpath' is enabled for {config_name}")
853860
self.preserve_classpath = True
854861

862+
if matching.group("future_defaults_all") is not None:
863+
mx.logv(f"'future-defaults-all' is enabled for {config_name}")
864+
self.future_defaults_all = True
865+
855866
if matching.group("string_inlining") is not None:
856867
mx.logv(f"'string-inlining' is enabled for {config_name}")
857868
self.use_string_inlining = True

vm/mx.vm/mx_vm_benchmark.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"peak-time": "time"
5252
} # Maps some polybench metrics to standardized metric names
5353

54+
BUNDLE_EXTENSION = ".nib"
5455

5556
class AgentScriptJsBenchmarkSuite(mx_benchmark.VmBenchmarkSuite, mx_benchmark.AveragingBenchmarkMixin):
5657
def __init__(self):
@@ -518,7 +519,7 @@ def register_graalvm_vms():
518519

519520
for short_name, config_suffix in [('niee', 'ee'), ('ni', 'ce')]:
520521
if any(component.short_name == short_name for component in mx_sdk_vm_impl.registered_graalvm_components(stage1=False)):
521-
for main_config in ['default', 'gate', 'llvm', 'native-architecture', 'preserve-all', 'preserve-classpath'] + analysis_context_sensitivity:
522+
for main_config in ['default', 'gate', 'llvm', 'native-architecture', 'future-defaults-all', 'preserve-all', 'preserve-classpath'] + analysis_context_sensitivity:
522523
final_config_name = f'{main_config}-{config_suffix}'
523524
mx_benchmark.add_java_vm(NativeImageVM('native-image', final_config_name, ['--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED']), _suite, 10)
524525
# ' ' force the empty O<> configs as well

0 commit comments

Comments
 (0)