@@ -572,10 +572,19 @@ def _empty_file():
572
572
# 2. Native-image picks a different service provider than the JVM for javax.xml.transform.TransformerFactory.
573
573
# We can simply remove the jar containing that provider as it is not required for the benchmark to run.
574
574
'fop' : [f"-Djava.util.logging.config.file={ _empty_file ()} " ,
575
- '--initialize-at-run-time=org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList' ],
575
+ '--initialize-at-run-time=org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList' ,
576
+ '-H:+ForeignAPISupport' ],
576
577
'batik' : []
577
578
}
578
579
580
+ _DACAPO_EXTRA_IMAGE_RUN_ARGS = {
581
+ 'pmd' : ['--no-validation' ],
582
+ # JDK21 ForeignAPISupport is broken --- disable `enableMemorySegments` for now
583
+ 'lusearch' : ['-Dorg.apache.lucene.store.MMapDirectory.enableMemorySegments=false' , '--no-validation' ],
584
+ 'luindex' : ['-Dorg.apache.lucene.store.MMapDirectory.enableMemorySegments=false' , '--no-validation' ],
585
+ 'fop' : ['-Djava.home=' + os .environ ['JAVA_HOME' ]]
586
+ }
587
+
579
588
'''
580
589
Benchmarks from DaCapo suite may require one or more zip archives from `dat` directory on the classpath.
581
590
After the agent run we have all necessary resources (from `jar` and `dat` folders inside DaCapo fat jar).
@@ -642,15 +651,18 @@ def daCapoPath(self):
642
651
return None
643
652
644
653
def availableSuiteVersions (self ):
645
- # This version also ships a custom harness class to allow native image to find the entry point in the nested jar
646
- return ["9.12-MR1-git+2baec49" ]
654
+ # The version 9.12-MR1-git+2baec49 also ships a custom harness class to allow native image to find the entry point in the nested jar
655
+ return ["9.12-MR1-git+2baec49" , "23.11-MR2-chopin" ]
647
656
648
657
def daCapoIterations (self ):
649
658
compiler_iterations = super (DaCapoNativeImageBenchmarkSuite , self ).daCapoIterations ()
650
659
return {key : _daCapo_iterations [key ] for key in compiler_iterations .keys () if key in _daCapo_iterations .keys ()}
651
660
652
661
def benchmark_resources (self , benchmark ):
653
- return _dacapo_resources [benchmark ]
662
+ if self .version () == "23.11-MR2-chopin" :
663
+ return []
664
+ else :
665
+ return _dacapo_resources [benchmark ]
654
666
655
667
def run (self , benchmarks , bmSuiteArgs ) -> mx_benchmark .DataPoints :
656
668
return self .intercept_run (super (), benchmarks , bmSuiteArgs )
@@ -661,13 +673,43 @@ def extra_agent_run_arg(self, benchmark, args, image_run_args):
661
673
return ['-n' , '1' ] + mx_sdk_benchmark .strip_args_with_number ('-n' , user_args )
662
674
663
675
def extra_profile_run_arg (self , benchmark , args , image_run_args , should_strip_run_args ):
664
- user_args = super (DaCapoNativeImageBenchmarkSuite , self ).extra_profile_run_arg (benchmark , args , image_run_args , should_strip_run_args )
676
+ self .fixDataLocation ()
677
+ user_args = ["-Duser.home=" + str (Path .home ())]
678
+ user_args += super (DaCapoNativeImageBenchmarkSuite , self ).extra_profile_run_arg (benchmark , args , image_run_args , should_strip_run_args )
679
+
680
+ if benchmark in _DACAPO_EXTRA_IMAGE_RUN_ARGS :
681
+ user_args = user_args + _DACAPO_EXTRA_IMAGE_RUN_ARGS [benchmark ]
682
+
665
683
# remove -n X argument from image run args
666
684
if should_strip_run_args :
667
685
return ['-n' , '1' ] + mx_sdk_benchmark .strip_args_with_number ('-n' , user_args )
668
686
else :
669
687
return user_args
670
688
689
+ def fixDataLocation (self ):
690
+ if self .version () == "23.11-MR2-chopin" :
691
+ print ("Fixing data location..." )
692
+ # DaCapo can get data location either from the JAR path or "~/.dacapo-config.properties"
693
+ # See official dacapobench issue #341
694
+ dataLocation = self .dataLocation ()
695
+ configFilePath = os .path .join (Path .home (), ".dacapo-config.properties" )
696
+ with open (configFilePath , "w" ) as config :
697
+ config .write (f"Data-Location={ dataLocation } \n " )
698
+
699
+ with open (configFilePath ) as f :
700
+ print ("Reading " + configFilePath + ":" )
701
+ print ("------" )
702
+ print (f .read ())
703
+ print ("------" )
704
+
705
+ def extra_run_arg (self , benchmark , args , image_run_args ):
706
+ self .fixDataLocation ()
707
+ run_args = ["-Duser.home=" + str (Path .home ())]
708
+ run_args += super (DaCapoNativeImageBenchmarkSuite , self ).extra_run_arg (benchmark , args , image_run_args )
709
+ if benchmark in _DACAPO_EXTRA_IMAGE_RUN_ARGS :
710
+ run_args = run_args + _DACAPO_EXTRA_IMAGE_RUN_ARGS [benchmark ]
711
+ return run_args
712
+
671
713
def skip_agent_assertions (self , benchmark , args ):
672
714
default_args = _DACAPO_SKIP_AGENT_ASSERTIONS [benchmark ] if benchmark in _DACAPO_SKIP_AGENT_ASSERTIONS else []
673
715
user_args = super (DaCapoNativeImageBenchmarkSuite , self ).skip_agent_assertions (benchmark , args )
@@ -688,15 +730,20 @@ def createCommandLineArgs(self, benchmarks, bmSuiteArgs):
688
730
else :
689
731
self .benchmark_name = benchmarks [0 ]
690
732
691
- run_args = self .postprocessRunArgs (self .benchmarkName (), self .runArgs (bmSuiteArgs ))
733
+ benchmark = benchmarks [0 ]
734
+
735
+ run_args = self .postprocessRunArgs (benchmark , self .runArgs (bmSuiteArgs ))
692
736
vm_args = self .vmArgs (bmSuiteArgs )
693
- return [ '-cp' , self .create_classpath (self . benchmarkName ())] + vm_args + ['-jar' , self .daCapoPath ( )] + [self . benchmarkName () ] + run_args
737
+ return self .create_classpath (benchmark ) + vm_args + ['-jar' , self .jarPath ( benchmark )] + [benchmark ] + run_args
694
738
695
739
def create_classpath (self , benchmark ):
696
- dacapo_extracted , dacapo_dat_resources , dacapo_nested_resources = self .create_dacapo_classpath (self .daCapoPath (), benchmark )
697
- dacapo_jars = super (DaCapoNativeImageBenchmarkSuite , self ).collect_unique_dependencies (os .path .join (dacapo_extracted , 'jar' ), benchmark , _daCapo_exclude_lib )
698
- cp = ':' .join ([dacapo_extracted ] + dacapo_jars + dacapo_dat_resources + dacapo_nested_resources )
699
- return cp
740
+ if self .version () == "9.12-MR1-git+2baec49" :
741
+ dacapo_extracted , dacapo_dat_resources , dacapo_nested_resources = self .create_dacapo_classpath (self .daCapoPath (), benchmark )
742
+ dacapo_jars = super (DaCapoNativeImageBenchmarkSuite , self ).collect_unique_dependencies (os .path .join (dacapo_extracted , 'jar' ), benchmark , _daCapo_exclude_lib )
743
+ cp = ':' .join ([dacapo_extracted ] + dacapo_jars + dacapo_dat_resources + dacapo_nested_resources )
744
+ return ["-cp" , cp ]
745
+ else :
746
+ return []
700
747
701
748
def successPatterns (self ):
702
749
return super ().successPatterns () + SUCCESSFUL_STAGE_PATTERNS
0 commit comments