def _parseArgs(args): arguments = list(args) debugArg = '--debug' if debugArg in arguments: mx.log( 'Running in debug mode. The --debug argument is handled by mx and not passed as program argument' ) arguments.remove(debugArg) mode = 'Debug' else: mode = 'Release' vmArgs, progArgs = parse_js_args(arguments) if mx.suite('compiler', fatalIfMissing=False): import mx_compiler vmArgs = mx_compiler._parseVmArgs(vmArgs) else: vmArgs += mx.java_debug_args() for arg in ['-d64', '-server']: if arg in vmArgs: mx.logv('[_parseArgs] removing {} from vmArgs'.format(arg)) vmArgs.remove(arg) mx.logv('[_parseArgs] mode: %s' % mode) mx.logv('[_parseArgs] vmArgs: %s' % vmArgs) mx.logv('[_parseArgs] progArgs: %s' % progArgs) return mode, vmArgs, progArgs
def lli(args=None, out=None): """run lli via the current GraalVM""" debug_args = mx.java_debug_args() if debug_args and not mx.is_debug_disabled(): args = [_java_to_graalvm_arg(d) for d in debug_args] + args # on Windows <GRAALVM_HOME>/bin/lli is always a .cmd file because it is a "fake symlink" mx.run([os.path.join(mx_sdk_vm_impl.graalvm_home(fatalIfMissing=True), 'bin', mx_subst.path_substitutions.substitute('<cmd:lli>'))] + args, out=out)
def contents(self, result): classpath_deps = [ dep for dep in self.subject.buildDependencies if isinstance(dep, mx.ClasspathDependency) ] jvm_args = [ pipes.quote(arg) for arg in mx.get_runtime_jvm_args(classpath_deps) ] debug_args = mx.java_debug_args() jvm_args.extend(debug_args) if debug_args: jvm_args.extend(['-ea', '-esa']) jvm_args.append('-Dorg.graalvm.language.ruby.home=' + root) main_class = 'org.truffleruby.launcher.RubyLauncher' ruby_options = [ '--experimental-options', '--building-core-cexts', '--platform-native-interrupt=false', # no librubysignal in the ruby home yet '--launcher=' + result, '--disable-gems', '--disable-rubyopt', ] command = [jdk.java] + jvm_args + [main_class ] + ruby_options + ['"$@"'] return "#!/usr/bin/env bash\n" + "exec " + " ".join(command) + "\n"
def lli(args=None, out=None): """run lli via the current GraalVM""" debug_args = mx.java_debug_args() if debug_args and not mx.is_debug_disabled(): args = [_java_to_graalvm_arg(d) for d in debug_args] + args mx.run([ os.path.join(mx_sdk_vm_impl.graalvm_home(fatalIfMissing=True), 'bin', 'lli') ] + args, out=out)
def setupNodeEnvironment(args, add_graal_vm_args=True): args = args if args else [] mode, vmArgs, progArgs = _parseArgs(args) vmArgs += mx.java_debug_args() setLibraryPath() if mx.suite('vm', fatalIfMissing=False) is not None and mx.suite( 'substratevm', fatalIfMissing=False) is not None: _prepare_svm_env() return mode, vmArgs, progArgs if mx.suite('vm', fatalIfMissing=False) is not None or mx.suite( 'substratevm', fatalIfMissing=False) is not None: mx.warn( "Running on the JVM.\nIf you want to run on SubstrateVM, you need to dynamically import both '/substratevm' and '/vm'.\nExample: 'mx --env svm node'" ) javaHome = _getJdkHome() _setEnvVar('JAVA_HOME', javaHome) if mx.suite('compiler', fatalIfMissing=False) is None: _setEnvVar('GRAAL_SDK_JAR_PATH', mx.distribution('sdk:GRAAL_SDK').path) _setEnvVar('TRUFFLE_JAR_PATH', mx.distribution('truffle:TRUFFLE_API').path) _setEnvVar('LAUNCHER_COMMON_JAR_PATH', mx.distribution('sdk:LAUNCHER_COMMON').path) _setEnvVar('TRUFFLENODE_JAR_PATH', mx.distribution('TRUFFLENODE').path) node_jvm_cp = (os.environ['NODE_JVM_CLASSPATH'] + os.pathsep) if 'NODE_JVM_CLASSPATH' in os.environ else '' node_cp = node_jvm_cp + mx.classpath(['TRUFFLENODE'] + ( ['tools:CHROMEINSPECTOR', 'tools:TRUFFLE_PROFILER'] if mx. suite('tools', fatalIfMissing=False) is not None else [])) _setEnvVar('NODE_JVM_CLASSPATH', node_cp) prevPATH = os.environ['PATH'] _setEnvVar('PATH', "%s:%s" % (join(_suite.mxDir, 'fake_launchers'), prevPATH)) if add_graal_vm_args: if mx.suite('graal-enterprise', fatalIfMissing=False): # explicitly require the enterprise compiler configuration vmArgs += ['-Dgraal.CompilerConfiguration=enterprise'] if mx.suite('compiler', fatalIfMissing=False): vmArgs += [ '-Djvmci.Compiler=graal', '-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI' ] if isinstance(_suite, BinarySuite): mx.logv('%s is a binary suite' % _suite.name) tarfilepath = mx.distribution('TRUFFLENODE_GRAALVM_SUPPORT').path with tarfile.open(tarfilepath, 'r:') as tar: mx.logv('Extracting {} to {}'.format(tarfilepath, _suite.dir)) tar.extractall(_suite.dir) return mode, vmArgs, progArgs
def __init__(self, name, config_name, extra_java_args, extra_launcher_args): """ :type name: str :type config_name: str :type extra_java_args: list[str] | None :type extra_launcher_args: list[str] | None """ super(GraalVm, self).__init__() self._name = name self._config_name = config_name self.extra_java_args = extra_java_args or [] self.extra_launcher_args = extra_launcher_args or [] self.debug_args = mx.java_debug_args() if config_name == "jvm" else []