@@ -247,41 +247,46 @@ def __init__(self, config_name, options=None, env=None, virtualenv=None, iterati
247247 @functools .lru_cache
248248 def launcher_type (self ):
249249 if mx .dependency ("GRAALPY_NATIVE_STANDALONE" , fatalIfMissing = False ):
250- mx .log ("GraalPy native standalone is enabled, using it" )
251250 return "native"
252251 else :
253- mx .log ("GraalPy native standalone is not enabled, using JVM standalone" )
254252 return "jvm"
255253
256254 @property
255+ @functools .lru_cache
257256 def interpreter (self ):
258257 from mx_graalpython import graalpy_standalone
259- return graalpy_standalone (self .launcher_type , build = False )
258+ launcher = graalpy_standalone (self .launcher_type , build = False )
259+ mx .log (f"Using { launcher } based on enabled/excluded GraalPy standalone build targets." )
260+ return launcher
260261
261- def run_vm (self , args , * splat , ** kwargs ):
262+ def post_process_command_line_args (self , args ):
262263 if os .environ .get ('BYTECODE_DSL_INTERPRETER' , '' ).lower () == 'true' and not self .is_bytecode_dsl_config ():
263264 print ("Found environment variable BYTECODE_DSL_INTERPRETER, but the guest vm config is not Bytecode DSL config." )
264265 print ("Did you want to use, e.g., `mx benchmark ... -- --host-vm-config=default-bc-dsl`?" )
265266 sys .exit (1 )
266- extra_polyglot_args = self .get_extra_polyglot_args ()
267- return super ().run_vm (extra_polyglot_args + args , * splat , ** kwargs )
267+ return self .get_extra_polyglot_args () + args
268268
269269 def is_bytecode_dsl_config (self ):
270270 return '--vm.Dpython.EnableBytecodeDSLInterpreter=true' in self .get_extra_polyglot_args ()
271271
272- def run (self , * args , ** kwargs ):
273- code , out , dims = super ().run (* args , ** kwargs )
274-
272+ def extract_vm_info (self , args ):
273+ out_version = subprocess .check_output ([self .interpreter , '--version' ], universal_newlines = True )
275274 # The benchmark data goes back a ways, we modify the reported dims for
276275 # continuity with the historical queries
277- _ , out_version , _ = super ().run (os .getcwd (), ["--version" ])
278- dims ['guest-vm' ] = self .name ()
279- dims ['guest-vm-config' ] = self .config_name ()
280- dims ['host-vm' ] = 'graalvm-' + ('ee' if 'Oracle GraalVM' in out_version else 'ce' )
281- dims ['host-vm-config' ] = self .launcher_type
276+ dims = {
277+ 'guest-vm' : self .name (),
278+ 'guest-vm-config' : self .config_name (),
279+ 'host-vm' : 'graalvm-' + ('ee' if 'Oracle GraalVM' in out_version else 'ce' ),
280+ 'host-vm-config' : self .launcher_type ,
281+ }
282282 if dims ['guest-vm-config' ].endswith ('-3-compiler-threads' ):
283283 dims ['guest-vm-config' ] = dims ['guest-vm-config' ].replace ('-3-compiler-threads' , '' )
284284 dims ['host-vm-config' ] += '-3-compiler-threads'
285+ self ._dims = dims
286+
287+ def run (self , * args , ** kwargs ):
288+ code , out , dims = super ().run (* args , ** kwargs )
289+ dims .update (self ._dims )
285290
286291 is_bytecode_dsl_config = self .is_bytecode_dsl_config ()
287292 if "using bytecode DSL interpreter:" not in out :
@@ -292,7 +297,7 @@ def run(self, *args, **kwargs):
292297 f"Expected Bytecode DSL interpreter = { is_bytecode_dsl_config } . Harness output:\n { out } " , file = sys .stderr )
293298 return 1 , out , dims
294299 return code , out , dims
295-
300+
296301 def get_extra_polyglot_args (self ):
297302 return ["--experimental-options" , "-snapshot-startup" , "--python.MaxNativeMemory=%s" % (2 ** 34 ), * self ._extra_polyglot_args ]
298303
@@ -318,12 +323,6 @@ def config_name(self):
318323 def hosting_registry (self ):
319324 return java_vm_registry
320325
321- def launcher_class (self ):
322- raise NotImplementedError ()
323-
324- def get_extra_polyglot_args (self ):
325- raise NotImplementedError ()
326-
327326 def get_classpath (self ):
328327 cp = []
329328 if self ._cp_prefix :
@@ -361,7 +360,7 @@ def run(self, cwd, args):
361360 return code , out , dims
362361
363362 def get_extra_polyglot_args (self ):
364- return ["--experimental-options" , "--python.MaxNativeMemory=%s" % (2 ** 34 )] + self ._extra_polyglot_args
363+ return ["--experimental-options" , "--python.MaxNativeMemory=%s" % (2 ** 34 ), * self ._extra_polyglot_args ]
365364
366365
367366# ----------------------------------------------------------------------------------------------------------------------
@@ -575,10 +574,11 @@ def runAndReturnStdOut(self, benchmarks, bmSuiteArgs):
575574 ret_code , out , dims = super (PythonBaseBenchmarkSuite , self ).runAndReturnStdOut (benchmarks , bmSuiteArgs )
576575
577576 # host-vm rewrite rules
578- if mx .suite ('graal-enterprise' , fatalIfMissing = False ):
579- dims ['host-vm' ] = 'graalvm-ee'
580- else :
581- dims ['host-vm' ] = 'graalvm-ce'
577+ if dims ['host-vm' ] not in ('graalvm-ce' , 'graalvm-ee' ):
578+ if mx .suite ('graal-enterprise' , fatalIfMissing = False ):
579+ dims ['host-vm' ] = 'graalvm-ee'
580+ else :
581+ dims ['host-vm' ] = 'graalvm-ce'
582582
583583 self .post_run_graph (benchmarks [0 ], dims ['host-vm-config' ], dims ['guest-vm-config' ])
584584
0 commit comments