def _prepare_svm_env(): import mx_vm if hasattr(mx_vm, 'graalvm_home'): graalvm_home = mx_vm.graalvm_home() else: import mx_sdk_vm_impl graalvm_home = mx_sdk_vm_impl.graalvm_home() libgraal_nodejs_filename = mx.add_lib_suffix( mx.add_lib_prefix('graal-nodejs')) candidates = [ join(graalvm_home, directory, libgraal_nodejs_filename) for directory in [ join('jre', 'languages', 'nodejs', 'lib'), join('languages', 'nodejs', 'lib') ] ] libgraal_nodejs = None for candidate in candidates: if exists(candidate): libgraal_nodejs = candidate if libgraal_nodejs is None: mx.abort( "Cannot find graal-nodejs library in '{}'.\nDid you forget to build it (e.g., using 'mx --env svm build')?" .format(candidates)) _setEnvVar('NODE_JVM_LIB', libgraal_nodejs) _setEnvVar('ICU4J_DATA_PATH', join(mx.suite('graal-js').dir, 'lib', 'icu4j', 'icudt'))
def run_launcher(self, cmd, args, cwd): """Run the 'cmd' command in the 'bin' directory.""" out = mx.TeeOutputCapture(mx.OutputCapture()) args = self.post_process_launcher_command_line_args(args) mx.log("Running '{}' on '{}' with args: '{}'".format(cmd, self.name(), args)) code = mx.run([os.path.join(mx_vm.graalvm_home(fatalIfMissing=True), 'bin', cmd)] + args, out=out, err=out, cwd=cwd, nonZeroIsFatal=False) out = out.underlying.data dims = self.dimensions(cwd, args, code, out) return code, out, dims
def _prepare_svm_env(): import mx_vm libpolyglot = join(mx_vm.graalvm_home(), 'jre', 'lib', 'polyglot', mx.add_lib_suffix(mx.add_lib_prefix('polyglot'))) if not exists(libpolyglot): mx.abort( "Cannot find polyglot library in '{}'.\nDid you forget to build it (e.g., using 'mx --env svm build')?" .format(libpolyglot)) _setEnvVar('NODE_JVM_LIB', libpolyglot) _setEnvVar('ICU4J_DATA_PATH', join(mx.suite('graal-js').dir, 'lib', 'icu4j', 'icudt'))
def run_java(self, args, out=None, err=None, cwd=None, nonZeroIsFatal=False): """Run 'java' workloads.""" return mx.run([ os.path.join(mx_vm.graalvm_home(fatalIfMissing=True), 'bin', 'java') ] + args, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal)
def config_name(self): suffix = '' output_capture = mx.LinesOutputCapture() image_path = os.path.join(mx_vm.graalvm_home(fatalIfMissing=False), 'bin', 'native-image') if os.path.exists(image_path): mx.run([image_path, '--version'], out=output_capture, err=output_capture, cwd=None, nonZeroIsFatal=True) assert len(output_capture.lines ) == 1, 'Should be one line in a version got: ' + str( output_capture.lines) suffix = 'ee' if mx_vm.has_component('svmee', stage1=True) else 'ce' return super(NativeImageVM, self).config_name() + '-' + suffix
def gate_body(args, tasks): with Task('Vm: Basic GraalVM Tests', tasks, tags=[VmGateTasks.compiler]) as t: if t and mx_vm.has_component('GraalVM compiler'): # 1. the build must be a GraalVM # 2. the build must be JVMCI-enabled since the 'GraalVM compiler' component is registered mx_vm.check_versions( mx_vm.graalvm_output(), graalvm_version_regex=mx_vm.graalvm_version_regex, expect_graalvm=True, check_jvmci=True) with Task('Vm: GraalVM dist names', tasks, tags=[VmGateTasks.integration]) as t: if t: for suite, env_file_name, graalvm_dist_name in env_tests: out = mx.LinesOutputCapture() mx.run_mx([ '--no-warning', '--env', env_file_name, 'graalvm-dist-name' ], suite, out=out, err=out, env={}) mx.log( "Checking that the env file '{}' in suite '{}' produces a GraalVM distribution named '{}'" .format(env_file_name, suite.name, graalvm_dist_name)) if len(out.lines) != 1 or out.lines[0] != graalvm_dist_name: mx.abort( "Unexpected GraalVM dist name for env file '{}' in suite '{}'.\nExpected: '{}', actual: '{}'.\nDid you forget to update the registration of the GraalVM config?" .format(env_file_name, suite.name, graalvm_dist_name, '\n'.join(out.lines))) if mx_vm.has_component('LibGraal'): libgraal_location = mx_vm.get_native_image_locations( 'LibGraal', 'jvmcicompiler') if libgraal_location is None: mx.warn( "Skipping libgraal tests: no library enabled in the LibGraal component" ) else: extra_vm_arguments = [ '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + dirname(libgraal_location) ] if args.extra_vm_argument: extra_vm_arguments += args.extra_vm_argument import mx_compiler # run avrora on the GraalVM binary itself with Task('LibGraal Compiler:GraalVM DaCapo-avrora', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx.run([ join(mx_vm.graalvm_home(), 'bin', 'java'), '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-jar', mx.library('DACAPO').get_path(True), 'avrora' ]) with Task('LibGraal Compiler:CTW', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx_compiler.ctw([ '-DCompileTheWorld.Config=Inline=false CompilationFailureAction=ExitVM', '-esa', '-XX:+EnableJVMCI', '-DCompileTheWorld.MultiThreaded=true', '-Dgraal.InlineDuringParsing=false', '-Dgraal.TrackNodeSourcePosition=true', '-DCompileTheWorld.Verbose=false', '-XX:ReservedCodeCacheSize=300m', ], extra_vm_arguments) mx_compiler.compiler_gate_benchmark_runner( tasks, extra_vm_arguments, prefix='LibGraal Compiler:') with Task('LibGraal Truffle:unittest', tasks, tags=[VmGateTasks.libgraal]) as t: if t: def _unittest_config_participant(config): vmArgs, mainClass, mainClassArgs = config def is_truffle_fallback(arg): fallback_args = [ "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime", "-Dgraalvm.ForcePolyglotInvalid=true" ] return arg in fallback_args newVmArgs = [ arg for arg in vmArgs if not is_truffle_fallback(arg) ] return (newVmArgs, mainClass, mainClassArgs) mx_unittest.add_config_participant( _unittest_config_participant) excluded_tests = environ.get("TEST_LIBGRAAL_EXCLUDE") if excluded_tests: with NamedTemporaryFile(prefix='blacklist.', mode='w', delete=False) as fp: fp.file.writelines( [l + '\n' for l in excluded_tests.split()]) unittest_args = ["--blacklist", fp.name] else: unittest_args = [] unittest_args = unittest_args + [ "--enable-timing", "--verbose" ] mx_unittest.unittest(unittest_args + extra_vm_arguments + [ "-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false", "truffle" ]) else: mx.warn("Skipping libgraal tests: component not enabled") gate_substratevm(tasks) gate_sulong(tasks) gate_ruby(tasks) gate_python(tasks) gate_svm_truffle_tck_js(tasks)
def run_java(self, args, out=None, err=None, cwd=None, nonZeroIsFatal=False): if '-version' in args: return super(NativeImageVM, self).run_java(args, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) else: config = NativeImageVM.BenchmarkConfig() original_java_run_args = config.parse(args) executable, classpath_arguments, system_properties, image_run_args = NativeImageVM.extract_benchmark_arguments(original_java_run_args) # Agent configuration and/or HotSpot profiling needs_config = (config.config_dir is None) and config.needs_config if needs_config or self.hotspot_pgo: config_vm_args = [] profiling_vm_args = [] config_run_args = [] profiling_run_args = [] if needs_config: config.config_dir = mx.mkdtemp(suffix='config', prefix='native-image') config_vm_args += ['-agentlib:native-image-agent=config-output-dir=' + str(config.config_dir)] config_run_args += config.extra_agent_run_args if self.hotspot_pgo: profiling_vm_args += ['-Dgraal.ProfilesCollectExperimental=true'] config_run_args = [] profiling_run_args = config.extra_profile_run_args agent_run_args = config_vm_args + profiling_vm_args + original_java_run_args + config.extra_run_args + config_run_args + profiling_run_args mx.log('Running with HotSpot to get the configuration files and profiles. This could take a while:') super(NativeImageVM, self).run_java(agent_run_args, out=None, err=None, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) base_image_build_args = [os.path.join(mx_vm.graalvm_home(fatalIfMissing=True), 'bin', 'native-image')] base_image_build_args += ['--no-fallback'] base_image_build_args += ['-J-ea', '-J-esa'] base_image_build_args += system_properties base_image_build_args += classpath_arguments executable_name = (executable[1] if executable[0] == '-jar' else executable[0]).lower() base_image_build_args += executable base_image_build_args += ['-H:Name=' + executable_name] if needs_config: base_image_build_args += ['-H:ConfigurationFileDirectories=' + config.config_dir] base_image_build_args += config.extra_image_build_arguments # PGO instrumentation i = 0 while i < self.pgo_instrumented_iterations: instrument_args = ['--pgo-instrument'] + ([] if i == 0 and not self.hotspot_pgo else ['--pgo']) instrument_image_build_args = base_image_build_args + instrument_args mx.log('Building the instrumentation image with: ') mx.log(' ' + ' '.join([pipes.quote(str(arg)) for arg in instrument_image_build_args])) mx.run(instrument_image_build_args, out=None, err=None, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) image_run_cmd = [os.path.abspath(executable_name)] + image_run_args + config.extra_run_args + config.extra_profile_run_args mx.log('Running the instrumented image with: ') mx.log(' ' + ' '.join([pipes.quote(str(arg)) for arg in image_run_cmd])) mx.run(image_run_cmd, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) i += 1 # Build the final image pgo_args = ['--pgo'] if self.pgo_instrumented_iterations > 0 or self.hotspot_pgo else [] final_image_args = base_image_build_args + pgo_args mx.log('Building the final image with: ') mx.log(' ' + ' '.join([pipes.quote(str(arg)) for arg in final_image_args])) mx.run(final_image_args, out=None, err=None, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) # Execute the benchmark image_run_cmd = [os.path.abspath(executable_name)] + image_run_args + config.extra_run_args mx.log('Running the produced native executable with: ') mx.log(' ' + ' '.join([pipes.quote(str(arg)) for arg in image_run_cmd])) mx.run(image_run_cmd, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal)
def gate_body(args, tasks): with Task('Vm: Basic GraalVM Tests', tasks, tags=[VmGateTasks.compiler]) as t: if t and mx_vm.has_component('Graal compiler'): # 1. a full open-source build should be built with an open-source JDK but we allow Oracle JDK in non-strict mode as it is common on developer machines # 2. the build must be a GraalVM # 3. the build must be JVMCI-enabled since the 'Graal compiler' component is registered version_regex = mx_vm.openjdk_version_regex if args.strict_mode else mx_vm.anyjdk_version_regex mx_vm.check_versions( mx_vm.graalvm_output(), version_regex, graalvm_version_regex=mx_vm.graalvm_version_regex, expect_graalvm=True, check_jvmci=True) with Task('Vm: Sulong tests', tasks, tags=[VmGateTasks.sulong]) as t: if t and mx_vm.has_component('Sulong', fatalIfMissing=True): pass with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t: if t and mx_vm.has_component('Graal.js', fatalIfMissing=True): pass with Task('Vm: Graal.nodejs tests', tasks, tags=[VmGateTasks.graal_nodejs]) as t: if t and mx_vm.has_component('Graal.nodejs', fatalIfMissing=True): pass with Task('Vm: TruffleRuby tests', tasks, tags=[VmGateTasks.truffleruby]) as t: if t and mx_vm.has_component('TruffleRuby', fatalIfMissing=True): pass with Task('Vm: FastR tests', tasks, tags=[VmGateTasks.fastr]) as t: if t and mx_vm.has_component('FastR', fatalIfMissing=True): pass with Task('Vm: Graal.Python tests', tasks, tags=[VmGateTasks.graalpython]) as t: if t and mx_vm.has_component('Graal.Python', fatalIfMissing=True): pass if mx_vm.has_component('LibGraal'): libgraal_location = mx_vm.get_native_image_locations( 'LibGraal', 'jvmcicompiler') if libgraal_location is None: mx.warn( "Skipping libgraal tests: no library enabled in the LibGraal component" ) else: extra_vm_argument = [ '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + dirname(libgraal_location) ] if args.extra_vm_argument: extra_vm_argument += args.extra_vm_argument import mx_compiler mx_compiler.compiler_gate_benchmark_runner(tasks, extra_vm_argument, prefix='LibGraal: ') with Task('Test LibGraal', tasks, tags=[VmGateTasks.libgraal]) as t: if t: def _unittest_config_participant(config): vmArgs, mainClass, mainClassArgs = config newVmArgs = [ arg for arg in vmArgs if arg != "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime" ] return (newVmArgs, mainClass, mainClassArgs) mx_unittest.add_config_participant( _unittest_config_participant) excluded_tests = environ.get("TEST_LIBGRAAL_EXCLUDE") if excluded_tests: with NamedTemporaryFile(prefix='blacklist.', mode='w', delete=False) as fp: fp.file.writelines( [l + '\n' for l in excluded_tests.split()]) unittest_args = ["--blacklist", fp.name] else: unittest_args = [] unittest_args = unittest_args + [ "--enable-timing", "--verbose" ] mx_unittest.unittest(unittest_args + extra_vm_argument + [ "-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false", "truffle" ]) with Task('LibGraal GraalVM smoke test', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx.run([ join(mx_vm.graalvm_home(), 'bin', 'java'), '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-jar', mx.library('DACAPO').get_path(True), 'avrora' ]) else: mx.warn("Skipping libgraal tests: component not enabled") gate_substratevm(tasks) gate_sulong(tasks) gate_ruby(tasks) gate_python(tasks)
def gate_body(args, tasks): with Task('Vm: Basic GraalVM Tests', tasks, tags=[VmGateTasks.compiler]) as t: if t and mx_vm.has_component('Graal compiler'): # 1. a full open-source build should be built with an open-source JDK but we allow Oracle JDK in non-strict mode as it is common on developer machines # 2. the build must be a GraalVM # 3. the build must be JVMCI-enabled since the 'Graal compiler' component is registered version_regex = mx_vm.openjdk_version_regex if args.strict_mode else mx_vm.anyjdk_version_regex mx_vm.check_versions(mx_vm.graalvm_output(), version_regex, graalvm_version_regex=mx_vm.graalvm_version_regex, expect_graalvm=True, check_jvmci=True) if mx_vm.has_component('LibGraal'): libgraal_location = mx_vm.get_native_image_locations('LibGraal', 'jvmcicompiler') if libgraal_location is None: mx.warn("Skipping libgraal tests: no library enabled in the LibGraal component") else: extra_vm_arguments = ['-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + dirname(libgraal_location)] if args.extra_vm_argument: extra_vm_arguments += args.extra_vm_argument import mx_compiler # run avrora on the GraalVM binary itself with Task('LibGraal Compiler:GraalVM DaCapo-avrora', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx.run([join(mx_vm.graalvm_home(), 'bin', 'java'), '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-jar', mx.library('DACAPO').get_path(True), 'avrora']) with Task('LibGraal Compiler:CTW', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx_compiler.ctw([ '-DCompileTheWorld.Config=Inline=false CompilationFailureAction=ExitVM', '-esa', '-XX:+EnableJVMCI', '-DCompileTheWorld.MultiThreaded=true', '-Dgraal.InlineDuringParsing=false', '-Dgraal.TrackNodeSourcePosition=true', '-DCompileTheWorld.Verbose=false', '-XX:ReservedCodeCacheSize=300m', ], extra_vm_arguments) mx_compiler.compiler_gate_benchmark_runner(tasks, extra_vm_arguments, prefix='LibGraal Compiler:') with Task('LibGraal Truffle:unittest', tasks, tags=[VmGateTasks.libgraal]) as t: if t: def _unittest_config_participant(config): vmArgs, mainClass, mainClassArgs = config def is_truffle_fallback(arg): fallback_args = [ "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime", "-Dgraalvm.ForcePolyglotInvalid=true" ] return arg in fallback_args newVmArgs = [arg for arg in vmArgs if not is_truffle_fallback(arg)] return (newVmArgs, mainClass, mainClassArgs) mx_unittest.add_config_participant(_unittest_config_participant) excluded_tests = environ.get("TEST_LIBGRAAL_EXCLUDE") if excluded_tests: with NamedTemporaryFile(prefix='blacklist.', mode='w', delete=False) as fp: fp.file.writelines([l + '\n' for l in excluded_tests.split()]) unittest_args = ["--blacklist", fp.name] else: unittest_args = [] unittest_args = unittest_args + ["--enable-timing", "--verbose"] mx_unittest.unittest(unittest_args + extra_vm_arguments + ["-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false", "truffle"]) else: mx.warn("Skipping libgraal tests: component not enabled") gate_substratevm(tasks) gate_sulong(tasks) gate_ruby(tasks) gate_python(tasks)
def run_java(self, args, out=None, err=None, cwd=None, nonZeroIsFatal=False): if '-version' in args: return super(NativeImageVM, self).run_java(args, out=out, err=err, cwd=cwd, nonZeroIsFatal=nonZeroIsFatal) else: image_cwd = os.path.abspath(cwd if cwd else os.getcwd()) non_zero_is_fatal = self.is_gate or nonZeroIsFatal config = NativeImageVM.BenchmarkConfig() original_java_run_args = config.parse(args) executable, classpath_arguments, system_properties, image_run_args = NativeImageVM.extract_benchmark_arguments( original_java_run_args) executable_name = (os.path.splitext(os.path.basename( executable[1]))[0] if executable[0] == '-jar' else executable[0]).lower() image_path = os.path.join(image_cwd, executable_name) config.profile_dir = mx.mkdtemp(suffix='profile', prefix='native-image') profile_path = os.path.join(config.profile_dir, executable_name + '.iprof') # Agent configuration and/or HotSpot profiling needs_config = (config.config_dir is None) and config.needs_config if needs_config or self.hotspot_pgo: hotspot_vm_args = ['-ea', '-esa'] if self.is_gate else [] hotspot_run_args = [] if needs_config: config.config_dir = mx.mkdtemp(suffix='config', prefix='native-image') hotspot_vm_args += [ '-agentlib:native-image-agent=config-output-dir=' + str(config.config_dir), '-XX:-UseJVMCINativeLibrary' ] if self.hotspot_pgo: hotspot_vm_args += [ '-Dgraal.PGOInstrument=' + profile_path ] if config.extra_agent_run_args: hotspot_run_args += config.extra_profile_run_args if self.hotspot_pgo and not self.is_gate else config.extra_agent_run_args else: hotspot_run_args += image_run_args hotspot_args = hotspot_vm_args + classpath_arguments + executable + system_properties + hotspot_run_args mx.log( 'Running with HotSpot to get the configuration files and profiles. This could take a while:' ) super(NativeImageVM, self).run_java(hotspot_args, out=None, err=None, cwd=image_cwd, nonZeroIsFatal=non_zero_is_fatal) base_image_build_args = [ os.path.join(mx_vm.graalvm_home(fatalIfMissing=True), 'bin', 'native-image') ] base_image_build_args += ['--no-fallback'] base_image_build_args += [ '-J-ea', '-J-esa', '-H:+VerifyGraalGraphs', '-H:+VerifyPhases', '-H:+TraceClassInitialization' ] if self.is_gate else [] base_image_build_args += system_properties base_image_build_args += classpath_arguments base_image_build_args += executable base_image_build_args += [ '-H:Name=' + executable_name, '-H:Path=' + image_cwd ] if needs_config: base_image_build_args += [ '-H:ConfigurationFileDirectories=' + config.config_dir ] if self.is_llvm: base_image_build_args += [ '-H:CompilerBackend=llvm', '-H:-SpawnIsolates' ] base_image_build_args += config.extra_image_build_arguments # PGO instrumentation i = 0 while i < self.pgo_instrumented_iterations: instrument_args = ['--pgo-instrument'] + ( [] if i == 0 and not self.hotspot_pgo else ['--pgo']) instrument_image_build_args = base_image_build_args + instrument_args mx.log('Building the instrumentation image with: ') mx.log(' ' + ' '.join([ pipes.quote(str(arg)) for arg in instrument_image_build_args ])) mx.run(instrument_image_build_args, out=None, err=None, cwd=image_cwd, nonZeroIsFatal=non_zero_is_fatal) image_run_cmd = [image_path] image_run_cmd += ['-XX:ProfilesDumpFile=' + profile_path] if config.extra_profile_run_args: image_run_cmd += config.extra_profile_run_args else: image_run_cmd += image_run_args + config.extra_run_args mx.log('Running the instrumented image with: ') mx.log( ' ' + ' '.join([pipes.quote(str(arg)) for arg in image_run_cmd])) mx.run(image_run_cmd, out=out, err=err, cwd=image_cwd, nonZeroIsFatal=non_zero_is_fatal) i += 1 # Build the final image pgo_args = ['--pgo=' + profile_path] if self.pgo_instrumented_iterations > 0 or self.hotspot_pgo else [] final_image_args = base_image_build_args + pgo_args mx.log('Building the final image with: ') mx.log( ' ' + ' '.join([pipes.quote(str(arg)) for arg in final_image_args])) mx.run(final_image_args, out=None, err=None, cwd=image_cwd, nonZeroIsFatal=non_zero_is_fatal) # Execute the benchmark image_run_cmd = [image_path ] + image_run_args + config.extra_run_args mx.log('Running the produced native executable with: ') mx.log(' ' + ' '.join([pipes.quote(str(arg)) for arg in image_run_cmd])) mx.run(image_run_cmd, out=out, err=err, cwd=image_cwd, nonZeroIsFatal=non_zero_is_fatal)
def gate_body(args, tasks): with Task('Vm: Basic GraalVM Tests', tasks, tags=[VmGateTasks.compiler]) as t: if t and mx_vm.has_component('Graal compiler'): # 1. a full open-source build should be built with an open-source JDK but we allow Oracle JDK in non-strict mode as it is common on developer machines # 2. the build must be a GraalVM # 3. the build must be JVMCI-enabled since the 'Graal compiler' component is registered version_regex = mx_vm.openjdk_version_regex if args.strict_mode else mx_vm.anyjdk_version_regex mx_vm.check_versions( mx_vm.graalvm_output(), version_regex, graalvm_version_regex=mx_vm.graalvm_version_regex, expect_graalvm=True, check_jvmci=True) with Task('Vm: Sulong tests', tasks, tags=[VmGateTasks.sulong]) as t: if t and mx_vm.has_component('Sulong', fatalIfMissing=True): pass with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t: if t and mx_vm.has_component('Graal.js', fatalIfMissing=True): pass with Task('Vm: Graal.nodejs tests', tasks, tags=[VmGateTasks.graal_nodejs]) as t: if t and mx_vm.has_component('Graal.nodejs', fatalIfMissing=True): pass with Task('Vm: TruffleRuby tests', tasks, tags=[VmGateTasks.truffleruby]) as t: if t and mx_vm.has_component('TruffleRuby', fatalIfMissing=True): pass with Task('Vm: FastR tests', tasks, tags=[VmGateTasks.fastr]) as t: if t and mx_vm.has_component('FastR', fatalIfMissing=True): pass with Task('Vm: Graal.Python tests', tasks, tags=[VmGateTasks.graalpython]) as t: if t and mx_vm.has_component('Graal.Python', fatalIfMissing=True): pass if mx_vm.has_component('LibGraal'): libgraal_location = mx_vm.get_native_image_locations( 'LibGraal', 'jvmcicompiler') if libgraal_location is None: mx.warn( "Skipping libgraal tests: no library enabled in the LibGraal component" ) else: extra_vm_argument = [ '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + dirname(libgraal_location) ] if args.extra_vm_argument: extra_vm_argument += args.extra_vm_argument import mx_compiler mx_compiler.compiler_gate_benchmark_runner(tasks, extra_vm_argument, prefix='LibGraal: ') with Task('Test LibGraal', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx_unittest.unittest( ["--suite", "truffle", "--"] + extra_vm_argument + [ "-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false" ]) with Task('LibGraal GraalVM smoke test', tasks, tags=[VmGateTasks.libgraal]) as t: if t: mx.run([ join(mx_vm.graalvm_home(), 'bin', 'java'), '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-jar', mx.library('DACAPO').get_path(True), 'avrora' ]) else: mx.warn("Skipping libgraal tests: component not enabled") gate_substratevm(tasks) gate_sulong(tasks) gate_ruby(tasks) gate_python(tasks)