示例#1
0
def mx_init(suite):
    mx.add_argument('--vmdir', dest='vmdir', help='directory for VM executable, shared libraries boot image and related files', metavar='<path>')

    commands = {
        'c1x': [c1x, '[options] patterns...'],
        'configs': [configs, ''],
        'copycheck': [copycheck, ''],
        'eclipse': [eclipse, '[VM options]'],
        'gate': [gate, '[options]'],
        'hcfdis': [hcfdis, '[options] files...'],
        'helloworld': [helloworld, '[VM options]'],
        'inspecthelloworld': [inspecthelloworld, '[VM options]'],
        'image': [image, '[options] classes|packages...'],
        'inspect': [inspect, '[options] [class | -jar jarfile]  [args...]'],
        'inspectoragent': [inspectoragent, '[-impl target] [-port port]'],
        'jnigen': [jnigen, ''],
        'jvmtigen': [jvmtigen, ''],
        'optionsgen': [optionsgen, ''],
        'jttgen': [jttgen, ''],
        'loggen': [loggen, ''],
        'makejdk': [makejdk, '[<destination directory>]'],
        'methodtree': [methodtree, '[options]'],
        'nm': [nm, '[options] [boot image file]', _vm_image],
        'objecttree': [objecttree, '[options]'],
        'olc': [olc, '[options] patterns...', _patternHelp],
        'site' : [site, '[options]'],
        't1x': [t1x, '[options] patterns...'],
        't1xgen': [t1xgen, ''],
        'test': [test, '[options]'],
        'verify': [verify, '[options] patterns...', _patternHelp],
        'view': [view, '[options]'],
        'vm': [vm, '[options] [class | -jar jarfile]  [args...]'],
        'wikidoc': [wikidoc, '[options]']
    }
    mx.update_commands(suite, commands)
示例#2
0
def mx_init(suite):
    commands = {
        # new commands
        'python' : [python, '[Python args|@VM options]'],
        # core overrides
        'bench' : [bench, ''],
    }
    mx.update_commands(suite, commands)
示例#3
0
# Short-hand commands used to quickly run common benchmarks.
mx.update_commands(
    mx.suite('graal-core'), {
        'dacapo': [
            lambda args: createBenchmarkShortcut("dacapo", args),
            '[<benchmarks>|*] [-- [VM options] [-- [DaCapo options]]]'
        ],
        'scaladacapo': [
            lambda args: createBenchmarkShortcut("scala-dacapo", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Scala DaCapo options]]]'
        ],
        'specjvm2008': [
            lambda args: createBenchmarkShortcut("specjvm2008", args),
            '[<benchmarks>|*] [-- [VM options] [-- [SPECjvm2008 options]]]'
        ],
        'specjbb2005': [
            lambda args: mx_benchmark.benchmark(["specjbb2005"] + args),
            '[-- [VM options] [-- [SPECjbb2005 options]]]'
        ],
        'specjbb2013': [
            lambda args: mx_benchmark.benchmark(["specjbb2013"] + args),
            '[-- [VM options] [-- [SPECjbb2013 options]]]'
        ],
        'specjbb2015': [
            lambda args: mx_benchmark.benchmark(["specjbb2015"] + args),
            '[-- [VM options] [-- [SPECjbb2015 options]]]'
        ],
    })

示例#4
0
        'nbody3': '100000',
        'spectralnorm3': '500',
        'richards3': '3',
        'bm-ai': '0',
        'pidigits': '0',
        'pypy-go': '1',
    }
    for name, iterations in sorted(pythonTestBenchmarks.iteritems()):
        with Task('PythonBenchmarksTest:' + name,
                  tasks,
                  tags=ZippyTags.benchmarktest) as t:
            if t:
                _gate_python_benchmarks_tests(
                    "zippy/benchmarks/src/benchmarks/" + name + ".py",
                    iterations, vmargs)


def _zippy_gate_runner(args, tasks):
    extra_args = None if not _mx_graal else args.extra_vm_argument
    zippy_gate_runner(['zippy'], tasks, extra_args)


mx_gate.add_gate_runner(_suite, _zippy_gate_runner)

mx.update_commands(
    _suite,
    {
        # new commands
        'python': [python, '[Python args|@VM options]'],
    })
示例#5
0
    if '-G:+PrintFlags' in args and '-Xcomp' not in args:
        mx.warn('Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy')
    positionalargs[0] = _buildGOptionsArgs(args)
    return _jvmci_run_vm(*positionalargs, **kwargs)

def _unittest_config_participant(config):
    vmArgs, mainClass, mainClassArgs = config
    if isJVMCIEnabled(get_vm()):
        return (_buildGOptionsArgs(vmArgs), mainClass, mainClassArgs)
    return config

mx_unittest.add_config_participant(_unittest_config_participant)

mx.update_commands(_suite, {
    'vm': [run_vm, '[-options] class [args...]'],
    'jdkartifactstats' : [jdkartifactstats, ''],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
    'microbench' : [microbench, '[VM options] [-- [JMH options]]'],
})

class GraalArchiveParticipant(JVMCIArchiveParticipant):
    def __init__(self, dist):
        JVMCIArchiveParticipant.__init__(self, dist)

    def __add__(self, arcname, contents):
        if arcname.startswith('META-INF/providers/'):
            # Handles files generated by ServiceProviderProcessor
            provider = arcname[len('META-INF/providers/'):]
            for service in contents.strip().split(os.linesep):
                assert service
                self.jvmciServices.setdefault(service, []).append(provider)
            return True
示例#6
0
class ArchiveProject(mx.ArchivableProject):
    def __init__(self, suite, name, deps, workingSets, theLicense, **args):
        mx.ArchivableProject.__init__(self, suite, name, deps, workingSets, theLicense)
        assert 'prefix' in args
        assert 'outputDir' in args

    def output_dir(self):
        return join(self.dir, self.outputDir)

    def archive_prefix(self):
        return self.prefix

    def getResults(self):
        return mx.ArchivableProject.walk(self.output_dir())

class SulongDocsProject(ArchiveProject):
    doc_files = (glob.glob(join(_suite.dir, 'LICENSE')) +
        glob.glob(join(_suite.dir, '*.md')))

    def getResults(self):
        return [join(_suite.dir, f) for f in self.doc_files]


mx_benchmark.add_bm_suite(mx_sulong_benchmarks.SulongBenchmarkSuite())


mx.update_commands(_suite, {
    'pulldragonegg' : [pullInstallDragonEgg, ''],
    'lli' : [runLLVM, ''],
})
示例#7
0
文件: mx_jvmci.py 项目: mearvk/JVM
        _jvmci_jdks[debugLevel] = jdk
    return jdk

class JVMCI9JDKFactory(mx.JDKFactory):
    def getJDKConfig(self):
        jdk = get_jvmci_jdk(_vm.debugLevel)
        return jdk

    def description(self):
        return "JVMCI JDK"

mx.update_commands(_suite, {
    'make': [_runmake, '[args...]', _makehelp],
    'multimake': [_runmultimake, '[options]'],
    'c1visualizer' : [c1visualizer, ''],
    'hsdis': [hsdis, '[att]'],
    'hcfdis': [hcfdis, ''],
    'igv' : [igv, ''],
    'jol' : [jol, ''],
    'vm': [run_vm, '[-options] class [args...]'],
})

mx.add_argument('-M', '--jvmci-mode', action='store', choices=sorted(_jvmciModes.viewkeys()), help='the JVM variant type to build/run (default: ' + _vm.jvmciMode + ')')
mx.add_argument('--jdk-jvm-variant', '--vm', action='store', choices=_jdkJvmVariants + sorted(_legacyVms.viewkeys()), help='the JVM variant type to build/run (default: ' + _vm.jvmVariant + ')')
mx.add_argument('--jdk-debug-level', '--vmbuild', action='store', choices=_jdkDebugLevels + sorted(_legacyVmbuilds.viewkeys()), help='the JDK debug level to build/run (default: ' + _vm.debugLevel + ')')
mx.add_argument('-I', '--use-jdk-image', action='store_true', help='build/run JDK image instead of exploded JDK')

mx.addJDKFactory(_JVMCI_JDK_TAG, mx.JavaCompliance('9'), JVMCI9JDKFactory())

def mx_post_parse_cmd_line(opts):
    mx.set_java_command_default_jdk_tag(_JVMCI_JDK_TAG)
示例#8
0
文件: mx_sulong.py 项目: jakre/sulong
 * with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to
 * endorse or promote products derived from this software without specific prior written
 * permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */
// Checkstyle: stop
//@formatter:off
{0}
"""

def create_asm_parser(args=None, out=None):
    """create the inline assembly parser using antlr"""
    mx.suite("truffle").extensions.create_parser("com.oracle.truffle.llvm.asm.amd64", "com.oracle.truffle.llvm.asm.amd64", "InlineAssembly", COPYRIGHT_HEADER_BSD, args, out)

mx.update_commands(_suite, {
    'lli' : [runLLVM, ''],
    'test-llvm-image' : [_test_llvm_image, 'test a pre-built LLVM image'],
    'create-asm-parser' : [create_asm_parser, 'create the inline assembly parser using antlr'],
})
示例#9
0
                build_args=[
                    '--language:llvm',
                    '--language:ruby',
                ],
                links=['bin/<exe:ruby>'],
            )
        ],
        post_install_msg="""
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
  https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        ${graalvm_home}/jre/languages/ruby/lib/truffle/post_install_hook.sh""",
    ))

mx.update_commands(
    _suite, {
        'ruby': [ruby_run_ruby, ''],
        'build_truffleruby': [build_truffleruby, ''],
        'deploy-binary-if-master-or-release':
        [deploy_binary_if_master_or_release, ''],
        'ruby_download_binary_suite':
        [download_binary_suite, 'name [revision]'],
        'ruby_testdownstream': [ruby_testdownstream, ''],
        'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
        'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
        'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
    })
示例#10
0
mx.update_commands(_suite, {
    'suoptbench' : [suOptBench, ''],
    'subench' : [suBench, ''],
    'clangbench' : [clangBench, ''],
    'gccbench' : [gccBench, ''],
    'su-options' : [printOptions, ''],
    'su-pullbenchmarkgame' : [pullBenchmarkGame, ''],
    'su-pulldeps' : [downloadDependencies, ''],
    'su-pullllvmbinaries' : [pullLLVMBinaries, ''],
    'su-pullnwccsuite' : [pullNWCCSuite, ''],
    'su-pullgccsuite' : [pullGCCSuite, ''],
    'su-pullllvmsuite' : [pullLLVMSuite, ''],
    'su-pulltools' : [pullTools, ''],
    'su-pulldragonegg' : [pullInstallDragonEgg, ''],
    'su-run' : [runLLVM, ''],
    'su-tests' : [runTests, ''],
    'su-tests-bench' : [runBenchmarkTestCases, ''],
    'su-tests-gcc' : [runGCCTestCases, ''],
    'su-tests-llvm' : [runLLVMTestCases, ''],
    'su-tests-sulong' : [runTruffleTestCases, ''],
    'su-tests-nwcc' : [runNWCCTestCases, ''],
    'su-tests-types' : [runTypeTestCases, ''],
    'su-tests-polyglot' : [runPolyglotTestCases, ''],
    'su-tests-interop' : [runInteropTestCases, ''],
    'su-tests-asm' : [runAsmTestCases, ''],
    'su-tests-compile' : [runCompileTestCases, ''],
    'su-tests-jruby' : [runTestJRuby, ''],
    'su-local-gate' : [localGate, ''],
    'su-clang' : [compileWithClang, ''],
    'su-clang++' : [compileWithClangPP, ''],
    'su-opt' : [opt, ''],
    'su-link' : [link, ''],
    'su-gcc' : [dragonEgg, ''],
    'su-gfortran' : [dragonEggGFortran, ''],
    'su-g++' : [dragonEggGPP, ''],
    'su-travis1' : [travis1, ''],
    'su-travis2' : [travis2, ''],
    'su-travis3' : [travis3, ''],
    'su-travis-jruby' : [travisJRuby, ''],
    'su-gitlogcheck' : [logCheck, ''],
    'su-mdlcheck' : [mdlCheck, ''],
    'su-clangformatcheck' : [clangformatcheck, '']
})
示例#11
0
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('File name length check', tasks) as t:
        if t: check_filename_length([])

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'javadoc' : [javadoc, '[SL args|@VM options]'],
    'sl' : [sl, '[SL args|@VM options]'],
})

def _is_graalvm(jdk):
    releaseFile = os.path.join(jdk.home, "release")
    if exists(releaseFile):
        with open(releaseFile) as f:
            pattern = re.compile('^GRAALVM_VERSION=*')
            for line in f.readlines():
                if pattern.match(line):
                    return True
    return False

def _unittest_config_participant_tck(config):

    def find_path_arg(vmArgs, prefix):
示例#12
0
                main_class='org.truffleruby.launcher.RubyLauncher',
                build_args=[
                    '--language:llvm',
                    '--language:ruby',
                ],
                links=['bin/<exe:ruby>'],
            )
        ],
        post_install_msg="""
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
  https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        ${graalvm_home}/jre/languages/ruby/lib/truffle/post_install_hook.sh""",
    ))

mx.update_commands(
    _suite, {
        'ruby': [ruby_run_ruby, ''],
        'build_truffleruby': [build_truffleruby, ''],
        'ruby_deploy_binaries': [ruby_deploy_binaries, ''],
        'ruby_download_binary_suite':
        [download_binary_suite, 'name [revision]'],
        'ruby_testdownstream': [ruby_testdownstream, ''],
        'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
        'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
        'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
    })
示例#13
0
    if len(args) == 0:
        command = 'help'
    elif args[0] in commands:
        command, args = args[0], args[1:]

    # classpath operations
    if command in ['estimates', 'externals', 'footprint', 'internals']:
        candidates = mx.findclass(
            args,
            logToConsole=False,
            matcher=lambda s, classname: s == classname or classname.endswith(
                '.' + s) or classname.endswith('$' + s))
        if len(candidates) > 0:
            args = mx.select_items(sorted(candidates))
        if len(args) > 0:
            args = ['-cp', mx.classpath(jdk=mx.get_jdk())] + args

    mx.run_java([
        '-javaagent:' + joljar, '-cp', joljar, 'org.openjdk.jol.Main', command
    ] + args)


mx.update_commands(
    _suite, {
        'c1visualizer': [c1visualizer, ''],
        'hsdis': [hsdis, '[att]'],
        'hcfdis': [hcfdis, ''],
        'igv': [igv, ''],
        'jol': [jol, ''],
    })
示例#14
0
文件: mx_sulong.py 项目: pekd/sulong
class ArchiveProject(mx.ArchivableProject):
    def __init__(self, suite, name, deps, workingSets, theLicense, **args):
        mx.ArchivableProject.__init__(self, suite, name, deps, workingSets, theLicense)
        assert 'prefix' in args
        assert 'outputDir' in args

    def output_dir(self):
        return join(self.dir, self.outputDir)

    def archive_prefix(self):
        return self.prefix

    def getResults(self):
        return mx.ArchivableProject.walk(self.output_dir())

class SulongDocsProject(ArchiveProject):
    doc_files = (glob.glob(join(_suite.dir, 'LICENSE')) +
        glob.glob(join(_suite.dir, '*.md')))

    def getResults(self):
        return [join(_suite.dir, f) for f in self.doc_files]


mx_benchmark.add_bm_suite(mx_sulong_benchmarks.SulongBenchmarkSuite())


mx.update_commands(_suite, {
    'lli' : [runLLVM, ''],
})
示例#15
0
        "substratevm:POLYGLOT_NATIVE_API_HEADERS"
    ],
    has_polyglot_lib_entrypoints=True,
))

if os.environ.has_key('NATIVE_IMAGE_TESTING'):
    mx_sdk.register_graalvm_component(mx_sdk.GraalVmTool(
        suite=suite,
        name='Native Image JUnit',
        short_name='nju',
        dir_name='junit',
        license_files=[],
        third_party_license_files=[],
        truffle_jars=[],
        builder_jar_distributions=['mx:JUNIT_TOOL', 'mx:JUNIT', 'mx:HAMCREST'],
        support_distributions=['substratevm:NATIVE_IMAGE_JUNIT_SUPPORT'],
        include_in_polyglot=False,
    ))

mx.update_commands(suite, {
    'gate': [gate, '[options]'],
    'build': [build, ''],
    'helloworld' : [lambda args: native_image_context_run(helloworld, args), ''],
    'cinterfacetutorial' : [lambda args: native_image_context_run(cinterfacetutorial, args), ''],
    'fetch-languages': [lambda args: fetch_languages(args, early_exit=False), ''],
    'benchmark': [benchmark, '--vmargs [vmargs] --runargs [runargs] suite:benchname'],
    'native-image': [native_image_on_jvm, ''],
    'maven-plugin-install': [maven_plugin_install, ''],
    'native-unittest' : [lambda args: native_image_context_run(native_unittest, args), ''],
})
示例#16
0
                dest='vm_prefix',
                help='prefix for running the VM (e.g. "gdb --args")',
                metavar='<prefix>')
mx.add_argument('--gdb',
                action='store_const',
                const='gdb --args',
                dest='vm_prefix',
                help='alias for --vmprefix "gdb --args"')
mx.add_argument('--lldb',
                action='store_const',
                const='lldb --',
                dest='vm_prefix',
                help='alias for --vmprefix "lldb --"')

mx.update_commands(
    _suite, {
        'vm': [run_vm, '[-options] class [args...]'],
        'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
        'verify_jvmci_ci_versions': [verify_jvmci_ci_versions, ''],
    })


def mx_post_parse_cmd_line(opts):
    mx.add_ide_envvar('JVMCI_VERSION_CHECK')
    for dist in _suite.dists:
        dist.set_archiveparticipant(
            GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
    add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
    global _vm_prefix
    _vm_prefix = opts.vm_prefix
示例#17
0
def _truffle_gate_runner(args, tasks):
    jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'javadoc' : [javadoc, '[SL args|@VM options]'],
    'sl' : [sl, '[SL args|@VM options]'],
    'repl' : [repl, '[REPL Debugger args|@VM options]'],
    'testdownstream' : [testdownstream, ''],
})

"""
Merges META-INF/truffle/language and META-INF/truffle/instrument files.
This code is tightly coupled with the file format generated by
LanguageRegistrationProcessor and InstrumentRegistrationProcessor.
"""
class TruffleArchiveParticipant:
    PROPERTY_RE = re.compile(r'(language\d+|instrument\d+)(\..+)')

    def _truffle_metainf_file(self, arcname):
        if arcname == 'META-INF/truffle/language':
            return 'language'
        if arcname == 'META-INF/truffle/instrument':
示例#18
0
mx.update_commands(
    mx.suite('zippy'), {
        'python': [
            lambda args: bench_shortcut("python", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'python-nopeeling': [
            lambda args: bench_shortcut("python-nopeeling", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'python-flex': [
            lambda args: bench_shortcut("python-flex", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'python-flex-evol': [
            lambda args: bench_shortcut("python-flex-evol", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'cpython2': [
            lambda args: bench_shortcut("cpython2", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'cpython': [
            lambda args: bench_shortcut("cpython", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'jython': [
            lambda args: bench_shortcut("jython", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'pypy': [
            lambda args: bench_shortcut("pypy", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'pypy3': [
            lambda args: bench_shortcut("pypy3", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'python-micro': [
            lambda args: bench_shortcut("python-micro", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'cpython-micro': [
            lambda args: bench_shortcut("cpython-micro", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'cpython2-micro': [
            lambda args: bench_shortcut("cpython2-micro", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'jython-micro': [
            lambda args: bench_shortcut("jython-micro", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'pypy-micro': [
            lambda args: bench_shortcut("pypy-micro", args),
            '[<benchmarks>|*] [-- [VM options] [-- [Python options]]]'
        ],
        'pypy3-micro': [
            lambda args: bench_shortcut("pypy3-micro", args),
            '[<benchmarks>|*] [-- [ options] [-- [Python options]]]'
        ],
    })
示例#19
0
import mx

print("****** In mx_sample.py")

def function(args=None):
   print "###### In function() for target 'fun'"

_suite = mx.suite('sample')
mx.update_commands(_suite,{
  'fun' : [function]}
)
示例#20
0
            name='Native Image JUnit',
            short_name='nju',
            dir_name='junit',
            license_files=[],
            third_party_license_files=[],
            truffle_jars=[],
            builder_jar_distributions=[
                'mx:JUNIT_TOOL', 'mx:JUNIT', 'mx:HAMCREST'
            ],
            support_distributions=['substratevm:NATIVE_IMAGE_JUNIT_SUPPORT'],
            include_in_polyglot=False,
        ))

mx.update_commands(
    suite, {
        'gate': [gate, '[options]'],
        'build': [build, ''],
        'helloworld':
        [lambda args: native_image_context_run(helloworld, args), ''],
        'cinterfacetutorial':
        [lambda args: native_image_context_run(cinterfacetutorial, args), ''],
        'fetch-languages':
        [lambda args: fetch_languages(args, early_exit=False), ''],
        'benchmark':
        [benchmark, '--vmargs [vmargs] --runargs [runargs] suite:benchname'],
        'native-image': [native_image_on_jvm, ''],
        'maven-plugin-install': [maven_plugin_install, ''],
        'native-unittest':
        [lambda args: native_image_context_run(native_unittest, args), ''],
    })
示例#21
0
文件: mx_jruby.py 项目: grddev/jruby
    return env

def ruby_command(args):
    """runs Ruby"""
    vmArgs, rubyArgs = extractArguments(args)
    classpath = mx.classpath(['TRUFFLE_API', 'RUBY']).split(':')
    truffle_api, classpath = classpath[0], classpath[1:]
    assert os.path.basename(truffle_api) == "truffle-api.jar"
    vmArgs += ['-Xbootclasspath/p:' + truffle_api]
    vmArgs += ['-cp', ':'.join(classpath)]
    vmArgs += ['org.jruby.Main', '-X+T']
    env = setup_jruby_home()
    mx.run_java(vmArgs + rubyArgs, env=env)

mx.update_commands(_suite, {
    'ruby' : [ruby_command, '[ruby args|@VM options]'],
})

# Utilities

def jt(args, suite=None, nonZeroIsFatal=True, out=None, err=None, timeout=None, env=None, cwd=None):
    rubyDir = _suite.dir
    jt = join(rubyDir, 'tool', 'jt.rb')
    return mx.run(['ruby', jt] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, timeout=timeout, env=env, cwd=cwd)

FNULL = open(os.devnull, 'w')

class BackgroundServerTask:
    def __init__(self, args):
        self.args = args
示例#22
0
def specjbb2015(args):
    """run the composite SPECjbb2015 benchmark"""

    def launcher(bm, harnessArgs, extraVmOpts):
        assert bm is None
        return sanitycheck.getSPECjbb2015(harnessArgs).bench(mx_graal_core.get_vm(), extraVmOpts=extraVmOpts)

    _run_benchmark(args, None, launcher)

def specjbb2005(args):
    """run the composite SPECjbb2005 benchmark"""

    def launcher(bm, harnessArgs, extraVmOpts):
        assert bm is None
        return sanitycheck.getSPECjbb2005(harnessArgs).bench(mx_graal_core.get_vm(), extraVmOpts=extraVmOpts)

    _run_benchmark(args, None, launcher)

mx.update_commands(mx.suite('graal-core'), {
    'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'],
    'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'],
    'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'],
    'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'],
    'specjbb2015': [specjbb2015, '[VM options] [-- [SPECjbb2015 options]]'],
    'specjbb2005': [specjbb2005, '[VM options] [-- [SPECjbb2005 options]]'],
    'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
    'deoptalot' : [deoptalot, '[n]'],
    'longtests' : [longtests, ''],
})
示例#23
0
    launcher_configs=[
        mx_sdk.LanguageLauncherConfig(
            destination='bin/<exe:graalpython>',
            jar_distributions=['dependency:graalpython:GRAALPYTHON-LAUNCHER'],
            main_class='com.oracle.graal.python.shell.GraalPythonMain',
            build_args=[
                '--language:python',
                '--language:llvm',
            ]
        )
    ],
), _suite)


# ----------------------------------------------------------------------------------------------------------------------
#
# register the suite commands (if any)
#
# ----------------------------------------------------------------------------------------------------------------------
mx.update_commands(_suite, {
    'python': [python, '[Python args|@VM options]'],
    'python3': [python, '[Python args|@VM options]'],
    'deploy-binary-if-master': [deploy_binary_if_master, ''],
    'python-gate': [python_gate, ''],
    'python-update-import': [update_import_cmd, 'import name'],
    'delete-graalpython-if-testdownstream': [delete_self_if_testdownstream, ''],
    'python-license-headers-update': [python_license_headers_update, 'Make sure code files have copyright notices'],
    'punittest': [punittest, ''],
    'nativebuild': [nativebuild, '']
})
示例#24
0
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'javadoc' : [javadoc, '[SL args|@VM options]'],
    'sl' : [sl, '[SL args|@VM options]'],
    'repl' : [repl, '[REPL Debugger args|@VM options]'],
    'testrubytruffle' : [testrubytruffle, ''],
    'testgraal' : [testgraal, ''],
})

"""
Merges META-INF/truffle/language and META-INF/truffle/instrument files.
This code is tightly coupled with the file format generated by
LanguageRegistrationProcessor and InstrumentRegistrationProcessor.
"""
class TruffleArchiveParticipant:
    PROPERTY_RE = re.compile(r'(language\d+|instrument\d+)(\..+)')

    def _truffle_metainf_file(self, arcname):
        if arcname == 'META-INF/truffle/language':
            return 'language'
示例#25
0
                mx.command_function("build")()
            elif args.graalvm:
                mx.log(python_gvm())
            else:
                nativebuild([])
            mx.log("Build done.")


# ----------------------------------------------------------------------------------------------------------------------
#
# register the suite commands (if any)
#
# ----------------------------------------------------------------------------------------------------------------------
mx.update_commands(SUITE, {
    'python-build-watch': [python_build_watch, ''],
    'python': [python, '[Python args|@VM options]'],
    'python3': [python, '[Python args|@VM options]'],
    'deploy-binary-if-master': [deploy_binary_if_master, ''],
    'python-gate': [python_gate, '--tags [gates]'],
    'python-update-import': [update_import_cmd, '[import-name, default: truffle]'],
    'python-style': [python_style_checks, '[--fix]'],
    'python-svm': [python_svm, ''],
    'python-gvm': [python_gvm, ''],
    'python-unittests': [python3_unittests, ''],
    'python-retag-unittests': [retag_unittests, ''],
    'nativebuild': [nativebuild, ''],
    'nativeclean': [nativeclean, ''],
    'python-src-import': [import_python_sources, ''],
    'python-coverage': [python_coverage, '[gate-tag]'],
})
示例#26
0
                # Need to create service files for the providers of the
                # jdk.vm.ci.options.Options service created by
                # jdk.vm.ci.options.processor.OptionProcessor.
                provider = arcname[:-len('.class'):].replace('/', '.')
                self.services.setdefault('com.oracle.graal.options.OptionDescriptors', []).append(provider)
        return False

    def __addsrc__(self, arcname, contents):
        return False

    def __closing__(self):
        pass

mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "gdb --args")', metavar='<prefix>')
mx.add_argument('--gdb', action='store_const', const='gdb --args', dest='vm_prefix', help='alias for --vmprefix "gdb --args"')
mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"')

mx.update_commands(_suite, {
    'vm': [run_vm, '[-options] class [args...]'],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
    'verify_jvmci_ci_versions': [verify_jvmci_ci_versions, ''],
})

def mx_post_parse_cmd_line(opts):
    mx.add_ide_envvar('JVMCI_VERSION_CHECK')
    for dist in _suite.dists:
        dist.set_archiveparticipant(GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
    add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
    global _vm_prefix
    _vm_prefix = opts.vm_prefix
示例#27
0
            mx_sdk_vm.LanguageLauncherConfig(
                destination='bin/<exe:espresso>',
                jar_distributions=['espresso:ESPRESSO_LAUNCHER'],
                main_class=
                'com.oracle.truffle.espresso.launcher.EspressoLauncher',
                build_args=[],
                language='java',
            )
        ],
    ))

# Register new commands which can be used from the commandline with mx
mx.update_commands(
    _suite, {
        'espresso': [_run_espresso_launcher, '[args]'],
        'espresso-standalone': [_run_espresso_standalone, '[args]'],
        'java-truffle': [_run_java_truffle, '[args]'],
        'espresso-meta': [_run_espresso_meta, '[args]'],
    })

# Build configs
# pylint: disable=bad-whitespace
tools = ['cov', 'dap', 'ins', 'insight', 'lsp', 'pro', 'vvm']
mx_sdk_vm.register_vm_config(
    'espresso-jvm',
    ['java', 'ejvm', 'libpoly', 'nfi', 'sdk', 'tfl', 'cmp', 'elau'] + tools,
    _suite,
    env_file='jvm')
mx_sdk_vm.register_vm_config(
    'espresso-jvm-ce',
    [
示例#28
0
def build(args, vm=None):
    """build the Java sources"""
    opts2 = mx.build(['--source', '1.7'] + args)
    assert len(opts2.remainder) == 0

def sl(args):
    """run an SL program"""
    vmArgs, slArgs = mx.extract_VM_args(args)
    mx.run_java(vmArgs + ['-cp', mx.classpath(["TRUFFLE_API", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLLanguage"] + slArgs)

def sldebug(args):
    """run a simple command line debugger for the Simple Language"""
    vmArgs, slArgs = mx.extract_VM_args(args, useDoubleDash=True)
    mx.run_java(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl.tools"), "com.oracle.truffle.sl.tools.debug.SLREPL"] + slArgs)

def _truffle_gate_runner(args, tasks):
    with Task('Truffle Javadoc', tasks) as t:
        if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'sl' : [sl, '[SL args|@VM options]'],
    'sldebug' : [sldebug, '[SL args|@VM options]'],
})
示例#29
0
            'graal-js:ASM-7.1',
            'graal-js:ASM_TREE-7.1',
            'graal-js:ASM_ANALYSIS-7.1',
            'graal-js:ASM_COMMONS-7.1',
            'graal-js:ASM_UTIL-7.1',
        ],
        support_distributions=[
            'graal-js:GRAALJS_GRAALVM_SUPPORT',
        ],
        launcher_configs=[
            mx_sdk.LanguageLauncherConfig(
                destination='bin/<exe:js>',
                jar_distributions=['graal-js:GRAALJS_LAUNCHER'],
                main_class='com.oracle.truffle.js.shell.JSLauncher',
                build_args=['-H:+TruffleCheckBlackListedMethods'],
                language='js',
            )
        ],
        boot_jars=['graal-js:GRAALJS_SCRIPTENGINE'],
    ))

mx.update_commands(
    _suite, {
        'deploy-binary-if-master': [deploy_binary_if_master, ''],
        'js': [js, '[JS args|VM options]'],
        'nashorn': [nashorn, '[JS args|VM options]'],
        'test262': [test262, ''],
        'testnashorn': [testnashorn, ''],
        'testv8': [testv8, ''],
    })
示例#30
0
    ruby_run_specs([aot_bin, '-Xhome=' + root], format, mspec_args)


def ruby_testdownstream_sulong(args):
    build_truffleruby()
    # Ensure Sulong is available
    mx.suite('sulong')

    jt('test', 'cexts')
    jt('test', 'specs', ':capi')
    jt('test', 'specs', ':openssl')
    jt('test', 'mri', '--openssl')
    jt('test', 'mri', '--syslog')
    jt('test', 'mri', '--cext')
    jt('test', 'bundle')


mx.update_commands(
    _suite, {
        'rubytck': [ruby_tck, ''],
        'deploy-binary-if-master-or-release':
        [deploy_binary_if_master_or_release, ''],
        'ruby_download_binary_suite':
        [download_binary_suite, 'name', 'revision'],
        'ruby_testdownstream': [ruby_testdownstream, ''],
        'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
        'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
        'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
    })
示例#31
0
class JVMCIJDKFactory(mx.JDKFactory):
    def getJDKConfig(self):
        jdk = get_jvmci_jdk(_vm.debugLevel)
        return jdk

    def description(self):
        return "JVMCI JDK"


mx.update_commands(
    _suite, {
        'make': [_runmake, '[args...]', _makehelp],
        'multimake': [_runmultimake, '[options]'],
        'c1visualizer': [c1visualizer, ''],
        'hsdis': [hsdis, '[att]'],
        'hcfdis': [hcfdis, ''],
        'igv': [igv, ''],
        'jol': [jol, ''],
        'vm': [run_vm, '[-options] class [args...]'],
    })

mx.add_argument('-M',
                '--jvmci-mode',
                action='store',
                choices=sorted(_jvmciModes.viewkeys()),
                help='the JVM variant type to build/run (default: ' +
                _vm.jvmciMode + ')')
mx.add_argument('--jdk-jvm-variant',
                '--vm',
                action='store',
示例#32
0
mx.update_commands(_suite, {
    'suoptbench' : [suOptBench, ''],
    'subench' : [suBench, ''],
    'clangbench' : [clangBench, ''],
    'gccbench' : [gccBench, ''],
    'su-options' : [printOptions, ''],
    'su-pullbenchmarkgame' : [pullBenchmarkGame, ''],
    'su-pulldeps' : [downloadDependencies, ''],
    'su-pullllvmbinaries' : [pullLLVMBinaries, ''],
    'su-pullnwccsuite' : [pullNWCCSuite, ''],
    'su-pullgccsuite' : [pullGCCSuite, ''],
    'su-pullllvmsuite' : [pullLLVMSuite, ''],
    'su-pulltools' : [pullTools, ''],
    'su-pulldragonegg' : [pullInstallDragonEgg, ''],
    'su-run' : [runLLVM, ''],
    'su-tests' : [runTests, ''],
    'su-tests-bench' : [runBenchmarkTestCases, ''],
    'su-tests-gcc' : [runGCCTestCases, ''],
    'su-tests-llvm' : [runLLVMTestCases, ''],
    'su-tests-sulong' : [runTruffleTestCases, ''],
    'su-tests-nwcc' : [runNWCCTestCases, ''],
    'su-tests-types' : [runTypeTestCases, ''],
    'su-tests-polyglot' : [runPolyglotTestCases, ''],
    'su-tests-interop' : [runInteropTestCases, ''],
    'su-tests-asm' : [runAsmTestCases, ''],
    'su-tests-compile' : [runCompileTestCases, ''],
    'su-tests-jruby' : [runTestJRuby, ''],
    'su-local-gate' : [localGate, ''],
    'su-clang' : [compileWithClang, ''],
    'su-clang++' : [compileWithClangPP, ''],
    'su-opt' : [opt, ''],
    'su-link' : [link, ''],
    'su-gcc' : [dragonEgg, ''],
    'su-gfortran' : [dragonEggGFortran, ''],
    'su-g++' : [dragonEggGPP, ''],
    'su-travis1' : [travis1, ''],
    'su-travis2' : [travis2, ''],
    'su-travis-jruby' : [travisJRuby, ''],
    'su-gitlogcheck' : [logCheck, ''],
    'su-mdlcheck' : [mdlCheck, ''],
    'su-clangformatcheck' : [clangformatcheck, '']
})
示例#33
0
        dir_name='profiler',
        license_files=[],
        third_party_license_files=[],
        dependencies=['Truffle'],
        truffle_jars=['tools:TRUFFLE_PROFILER'],
        support_distributions=['tools:TRUFFLE_PROFILER_GRAALVM_SUPPORT'],
        include_by_default=True,
    ))

mx_sdk_vm.register_graalvm_component(
    mx_sdk_vm.GraalVmTool(
        suite=_suite,
        name='GraalVM Coverage',
        short_name='cov',
        dir_name='coverage',
        license_files=[],
        third_party_license_files=[],
        dependencies=['Truffle'],
        truffle_jars=['tools:TRUFFLE_COVERAGE'],
        support_distributions=['tools:TRUFFLE_COVERAGE_GRAALVM_SUPPORT'],
        include_by_default=True,
    ))

mx.update_commands(
    _suite, {
        'javadoc': [javadoc, ''],
        'gate': [mx_gate.gate, ''],
        'lsp-types-gen': [lsp_types_gen, ''],
        'dap-types-gen': [dap_types_gen, ''],
    })
示例#34
0
文件: mx_sdk.py 项目: unokun/graal
        if _prev.priority == component.priority:
            mx.abort(
                'Suites \'{}\' and \'{}\' are registering a component with the same short name (\'{}\') and priority (\'{}\')'
                .format(_prev.suite.name, component.suite.name,
                        _prev.short_name, _prev.priority))
        elif _prev.priority < component.priority:
            _graalvm_components[component.short_name] = component
            _log_ignored_component(component, _prev)
        else:
            _log_ignored_component(_prev, component)
    else:
        _graalvm_components[component.short_name] = component


def graalvm_components(opt_limit_to_suite=False):
    """
    :rtype: list[GraalVmComponent]
    """
    if opt_limit_to_suite and mx.get_opts().specific_suites:
        return [
            c for c in _graalvm_components.values()
            if c.suite.name in mx.get_opts().specific_suites
        ]
    else:
        return list(_graalvm_components.values())


mx.update_commands(_suite, {
    'javadoc': [javadoc, '[SL args|@VM options]'],
})
示例#35
0
    launcher_configs=[
        mx_sdk.LanguageLauncherConfig(
            destination='bin/<exe:truffleruby>',
            jar_distributions=['truffleruby:TRUFFLERUBY-LAUNCHER'],
            main_class='org.truffleruby.launcher.RubyLauncher',
            build_args=[
                '--language:llvm',
            ],
            language='ruby',
            links=['bin/<exe:ruby>'],
        )
    ],
    post_install_msg="""
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
  https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        ${graalvm_languages_dir}/ruby/lib/truffle/post_install_hook.sh""",
))

mx.update_commands(_suite, {
    'ruby': [ruby_run_ruby, ''],
    'build_truffleruby': [build_truffleruby, ''],
    'miniruby_for_building_cexts': [miniruby_for_building_cexts, ''],
    'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
    'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
    'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
})
示例#36
0
    def __addsrc__(self, arcname, contents):
        return False

    def __closing__(self):
        pass

mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "gdb --args")', metavar='<prefix>')
mx.add_argument('--gdb', action='store_const', const='gdb --args', dest='vm_prefix', help='alias for --vmprefix "gdb --args"')
mx.add_argument('--lldb', action='store_const', const='lldb --', dest='vm_prefix', help='alias for --vmprefix "lldb --"')

def sl(args):
    """run an SL program"""
    mx.get_opts().jdk = 'jvmci'
    mx_truffle.sl(args)

mx.update_commands(_suite, {
    'sl' : [sl, '[SL args|@VM options]'],
    'vm': [run_vm, '[-options] class [args...]'],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
    'nodecostdump' : [_nodeCostDump, ''],
    'verify_jvmci_ci_versions': [verify_jvmci_ci_versions, ''],
})

def mx_post_parse_cmd_line(opts):
    mx.add_ide_envvar('JVMCI_VERSION_CHECK')
    for dist in _suite.dists:
        dist.set_archiveparticipant(GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
    add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
    global _vm_prefix
    _vm_prefix = opts.vm_prefix
示例#37
0
))

mx_sdk.register_graalvm_component(mx_sdk.GraalVmTool(
    suite=_suite,
    name='GraalVM Profiler',
    short_name='pro',
    dir_name='profiler',
    license_files=[],
    third_party_license_files=[],
    truffle_jars=['tools:TRUFFLE_PROFILER'],
    support_distributions=['tools:TRUFFLE_PROFILER_GRAALVM_SUPPORT'],
    include_by_default=True,
))

mx_sdk.register_graalvm_component(mx_sdk.GraalVmJdkComponent(
    suite=_suite,
    name='VisualVM',
    short_name='vvm',
    dir_name='visualvm',
    license_files=[],
    third_party_license_files=[],
    support_distributions=['tools:VISUALVM_GRAALVM_SUPPORT'],
    provided_executables=['bin/jvisualvm']
))

mx.update_commands(_suite, {
    'javadoc' : [javadoc, ''],
    'gate' : [mx_gate.gate, ''],
})

示例#38
0
        """
        mx.logv('Suites \'{}\' and \'{}\' are registering a component with the same short name (\'{}\'), with priority \'{}\' and \'{}\' respectively.'.format(kept.suite.name, ignored.suite.name, kept.short_name, kept.priority, ignored.priority))
        mx.logv('Ignoring the one from suite \'{}\'.'.format(ignored.suite.name))

    _prev = _graalvm_components.get(component.short_name, None)
    if _prev:
        if _prev.priority == component.priority:
            mx.abort('Suites \'{}\' and \'{}\' are registering a component with the same short name (\'{}\') and priority (\'{}\')'.format(_prev.suite.name, component.suite.name, _prev.short_name, _prev.priority))
        elif _prev.priority < component.priority:
            _graalvm_components[component.short_name] = component
            _log_ignored_component(component, _prev)
        else:
            _log_ignored_component(_prev, component)
    else:
        _graalvm_components[component.short_name] = component


def graalvm_components(opt_limit_to_suite=False):
    """
    :rtype: list[GraalVmComponent]
    """
    if opt_limit_to_suite and mx.get_opts().specific_suites:
        return [c for c in _graalvm_components.values() if c.suite.name in mx.get_opts().specific_suites]
    else:
        return _graalvm_components.values()


mx.update_commands(_suite, {
    'javadoc': [javadoc, '[SL args|@VM options]'],
})
示例#39
0
                '--suite', 'truffle', '--enable-timing', '--verbose',
                '--fail-fast'
            ])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('File name length check', tasks) as t:
        if t: check_filename_length([])
    with Task('Check Copyrights', tasks) as t:
        if t: mx.checkcopyrights(['--primary'])


mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(
    _suite, {
        'javadoc': [javadoc, '[SL args|@VM options]'],
        'sl': [sl, '[SL args|@VM options]'],
    })


def _is_graalvm(jdk):
    releaseFile = os.path.join(jdk.home, "release")
    if exists(releaseFile):
        with open(releaseFile) as f:
            pattern = re.compile('^GRAALVM_VERSION=*')
            for line in f.readlines():
                if pattern.match(line):
                    return True
    return False

示例#40
0
from mx_unittest import unittest

_suite = mx.suite('truffle')

def truffle_extract_VM_args(args, useDoubleDash=False):
    vmArgs, remainder = [], []
    for (i, arg) in enumerate(args):
        if any(arg.startswith(prefix) for prefix in ['-X', '-G:', '-D', '-verbose', '-ea']) or arg in ['-esa']:
            vmArgs += [arg]
        elif useDoubleDash and arg == '--':
            remainder += args[i:]
            break
        else:
            remainder += [arg]
    return vmArgs, remainder

def build(args, vm=None):
    """build the Java sources"""
    opts2 = mx.build(['--source', '1.7'] + args)
    assert len(opts2.remainder) == 0

def erl(args):
    """run an Erlang program"""
    vmArgs, erlArgs = truffle_extract_VM_args(args)
    mx.run_java(vmArgs + ['-cp', mx.classpath(["TRUFFLE_API", "com.oracle.truffle.erl"]), "com.oracle.truffle.erl.ErlangLanguage"] + erlArgs)

mx.update_commands(_suite, {
    'erl' : [erl, '[Erlang args|@VM options]'],
})
示例#41
0
    'unittest': [ut, ['options']],
    'rutnoapps': [ut_noapps, ['options']],
    'rbcheck': [rbcheck, '--filter [gnur-only,fastr-only,both,both-diff]'],
    'rbdiag': [
        rbdiag,
        '(builtin)* [-v] [-n] [-m] [--sweep | --sweep=lite | --sweep=total] [--mnonly] [--noSelfTest] [--matchLevel=same | --matchLevel=error] [--maxSweeps=N] [--outMaxLev=N]'
    ],
    'rrepl': [rrepl, '[options]'],
    'rembed': [rembed, '[options]'],
    'rembedtest': [rembedtest, '[options]'],
    'r-cp': [r_classpath, '[options]'],
    'pkgtest': [pkgtest, ['options']],
    'r-pkgtest-analyze': [r_pkgtest_analyze, ['options']],
    'r-findtop100': [find_top100, ['options']],
    'r-findtop': [find_top, ['options']],
    'r-pkgcache': [pkgcache, ['options']],
    'installpkgs': [installpkgs, '[options]'],
    'edinclude': [mx_fastr_edinclude.edinclude, '[]'],
    'gnu-r': [gnu_r, '[]'],
    'gnu-rscript': [gnu_rscript, '[]'],
    'gnu-rtests': [gnu_rtests, '[]'],
    'nativebuild': [nativebuild, '[]'],
    'testrfficodegen': [run_testrfficodegen, '[]'],
    'rfficodegen': [run_rfficodegen, '[]'],
    'gnur-packages-test': [gnur_packages_test, '[]'],
    'build-binary-pkgs': [build_binary_pkgs, '[]'],
    'generate-r-parser': [generate_parser],
}

mx.update_commands(_fastr_suite, _commands)
示例#42
0
            # jdk.vm.ci.options.processor.OptionProcessor.
            provider = arcname[: -len(".class") :].replace("/", ".")
            self.services.setdefault("com.oracle.graal.options.OptionDescriptors", []).append(provider)
        return False

    def __addsrc__(self, arcname, contents):
        return False

    def __closing__(self):
        pass


mx.update_commands(
    _suite,
    {
        "vm": [run_vm, "[-options] class [args...]"],
        "ctw": [ctw, "[-vmoptions|noinline|nocomplex|full]"],
        "microbench": [microbench, "[VM options] [-- [JMH options]]"],
    },
)

mx.add_argument(
    "-M",
    "--jvmci-mode",
    action="store",
    choices=sorted(_jvmciModes.viewkeys()),
    help="the JVM variant type to build/run (default: " + _vm.jvmciMode + ")",
)


def mx_post_parse_cmd_line(opts):
    if opts.jvmci_mode is not None:
示例#43
0

def benchmark(args):
    if '--jsvm=substratevm' in args:
        ensure_trufflelanguage('graal-js', None)
    orig_command_benchmark(args)


def mx_post_parse_cmd_line(opts):
    for dist in suite.dists:
        if not dist.isTARDistribution():
            dist.set_archiveparticipant(
                GraalArchiveParticipant(dist,
                                        isTest=dist.name.endswith('_TEST')))


orig_command_build = mx.command_function('build')
mx.update_commands(
    suite, {
        'image_server_start': [image_server_start, ''],
        'image_server_stop': [_image_server_stop, ''],
        'image': [image, ''],
        'cinterfacetutorial': [cinterfacetutorial, ''],
        'build':
        [lambda args, vm=None: build(orig_command_build, args, vm), ''],
        'benchmark':
        [benchmark, '--vmargs [vmargs] --runargs [runargs] suite:benchname'],
        'helloworld': [helloworld, ''],
        'build_native_image': [build_native_image, ''],
    })
示例#44
0
                    if sym:
                        l = l.replace(sval, sym)
                        updated = True
                        lines[i] = l
            if updated:
                mx.log('updating ' + f)
                with open('new_' + f, "w") as fp:
                    for l in lines:
                        print >> fp, l

def jol(args):
    """Java Object Layout"""
    joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
    candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))

    if len(candidates) > 0:
        candidates = mx.select_items(sorted(candidates))
    else:
        # mx.findclass can be mistaken, don't give up yet
        candidates = args

    mx.run_java(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(jdk=mx.get_jdk()), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates)

mx.update_commands(_suite, {
    'c1visualizer' : [c1visualizer, ''],
    'hsdis': [hsdis, '[att]'],
    'hcfdis': [hcfdis, ''],
    'igv' : [igv, ''],
    'jol' : [jol, ''],
})
示例#45
0
                destination='bin/<exe:truffleruby>',
                jar_distributions=['truffleruby:TRUFFLERUBY-LAUNCHER'],
                main_class='org.truffleruby.launcher.RubyLauncher',
                build_args=[
                    '-H:+DetectUserDirectoriesInImageHeap',
                    '-H:+TruffleCheckBlackListedMethods',
                ],
                language='ruby',
                links=['bin/<exe:ruby>'],
            )
        ],
        post_install_msg="""
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
  https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        ${graalvm_languages_dir}/ruby/lib/truffle/post_install_hook.sh""",
    ))

mx.update_commands(
    _suite, {
        'ruby': [ruby_run_ruby, ''],
        'build_truffleruby': [build_truffleruby, ''],
        'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
        'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
        'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
        'verify-ci': [verify_ci, '[options]'],
    })
示例#46
0
文件: mx_sulong.py 项目: lxp/sulong
mx.update_commands(_suite, {
    'suoptbench' : [suOptBench, ''],
    'subench' : [suBench, ''],
    'clangbench' : [clangBench, ''],
    'gccbench' : [gccBench, ''],
    'build' : [sulongBuild, ''],
    'su-options' : [printOptions, ''],
    'su-pullbenchmarkgame' : [pullBenchmarkGame, ''],
    'su-pulldeps' : [downloadDependencies, ''],
    'su-pullllvmbinaries' : [pullLLVMBinaries, ''],
    'su-pullnwccsuite' : [pullNWCCSuite, ''],
    'su-pullgccsuite' : [pullGCCSuite, ''],
    'su-pullllvmsuite' : [pullLLVMSuite, ''],
    'su-pulltools' : [pullTools, ''],
    'su-pulldragonegg' : [pullInstallDragonEgg, ''],
    'su-run' : [runLLVM, ''],
    'su-tests' : [runTests, ''],
    'su-local-gate' : [localGate, ''],
    'su-clang' : [compileWithClang, ''],
    'su-clang++' : [compileWithClangPP, ''],
    'su-opt' : [opt, ''],
    'su-optimize' : [suOptimalOpt, ''],
    'su-compile-optimize' : [suOptCompile, ''],
    'su-link' : [link, ''],
    'su-gcc' : [dragonEgg, ''],
    'su-gfortran' : [dragonEggGFortran, ''],
    'su-g++' : [dragonEggGPP, ''],
    'su-travis1' : [travis1, ''],
    'su-travis2' : [travis2, ''],
    'su-travis3' : [travis3, ''],
    'su-travis4' : [travis4, ''],
    'su-travis-sulong' : [travisTestSulong, ''],
    'su-travis-argon2' : [travisArgon2, ''],
    'su-travis-tests' : [testsuites.travisRunSuite, ''],
    'su-ecj-strict' : [compileWithEcjStrict, ''],
    'su-basic-checkcode' : [runChecks, ''],
    'su-gitlogcheck' : [logCheck, ''],
    'su-mdlcheck' : [mdlCheck, ''],
    'su-clangformatcheck' : [clangformatcheck, ''],
    'su-httpcheck' : [checkNoHttp, ''],
    'su-get-llvm-program' : [getLLVMProgramPath, ''],
    'su-get-gcc-program' : [getGCCProgramPath, ''],
    'su-compile-tests' : [testsuites.compileSuite, ''],
})
示例#47
0
    # Give precedence to graal classpath and VM options
    classpath = user_classpath + classpath
    vmArgs = vmArgs + [
        # '-Xss2048k',
        '-Xbootclasspath/a:' + truffle_api,
        '-cp', ':'.join(classpath),
        'org.jruby.truffle.Main'
    ]
    allArgs = vmArgs + ['-X+T'] + rubyArgs

    env = setup_jruby_home()

    if print_command:
        if mx.get_opts().verbose:
            log('Environment variables:')
            for key in sorted(env.keys()):
                log(key + '=' + env[key])
        log(java + ' ' + ' '.join(map(pipes.quote, allArgs)))
    return os.execve(java, [argv0] + allArgs, env)

def ruby_tck(args):
    env = setup_jruby_home()
    os.environ["JRUBY_HOME"] = env["JRUBY_HOME"]
    mx_unittest.unittest(['--verbose', '--suite', 'jruby'])

mx.update_commands(_suite, {
    'ruby' : [ruby_command, '[ruby args|@VM options]'],
    'rubytck': [ruby_tck, ''],
    'deploy-binary-if-truffle-head': [deploy_binary_if_truffle_head, ''],
})
示例#48
0
            mx.javadoc(["--unified"])
    with Task("Truffle UnitTests", tasks) as t:
        if t:
            unittest(["--suite", "truffle", "--enable-timing", "--verbose", "--fail-fast"])
    with Task("Truffle Signature Tests", tasks) as t:
        if t:
            sigtest(["--check", "binary"])


mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(
    _suite,
    {
        "javadoc": [javadoc, "[SL args|@VM options]"],
        "sl": [sl, "[SL args|@VM options]"],
        "sldebug": [sldebug, "[SL args|@VM options]"],
        "testdownstream": [testdownstream, ""],
    },
)

"""
Merges META-INF/truffle/language and META-INF/truffle/instrumentation files.
This code is tightly coupled with the file format generated by
LanguageRegistrationProcessor and InstrumentRegistrationProcessor.
"""


class TruffleArchiveParticipant:
    PROPERTY_RE = re.compile(r"(language\d+|instrumentation\d+)(\..+)")
示例#49
0
                    '-H:+DumpThreadStacksOnSignal',
                    '-H:+DetectUserDirectoriesInImageHeap',
                    '-H:+TruffleCheckBlockListMethods'
                ],
                language='ruby',
                option_vars=['RUBYOPT', 'TRUFFLERUBYOPT'])
        ],
        stability="experimental",
        post_install_msg="""
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
  https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        ${graalvm_languages_dir}/ruby/lib/truffle/post_install_hook.sh""",
    ))

mx.update_commands(
    _suite, {
        'ruby': [ruby_run_ruby, ''],
        'build_truffleruby': [build_truffleruby, ''],
        'ruby_check_heap_dump': [ruby_check_heap_dump, ''],
        'ruby_testdownstream_aot': [ruby_testdownstream_aot, 'aot_bin'],
        'ruby_testdownstream_hello': [ruby_testdownstream_hello, ''],
        'ruby_testdownstream_sulong': [ruby_testdownstream_sulong, ''],
        'ruby_spotbugs': [ruby_spotbugs, ''],
        'verify-ci': [verify_ci, '[options]'],
        'ruby_jacoco_args': [ruby_jacoco_args, ''],
    })
示例#50
0
    _bm_suite = load_optional_suite('r_benchmarks', _r_benchmarks_rev)

_commands = {
    # new commands
    'r' : [rshell, '[options]'],
    'R' : [rshell, '[options]'],
    'rscript' : [rscript, '[options]'],
    'Rscript' : [rscript, '[options]'],
    'rtestgen' : [testgen, ''],
    # core overrides
    'bench' : [bench, ''],
    'rbench' : [rbench, ''],
    'build' : [build, ''],
    'gate' : [gate, ''],
    'junit' : [junit, ['options']],
    'junitsimple' : [junit_simple, ['options']],
    'junitdefault' : [junit_default, ['options']],
    'junitgate' : [junit_gate, ['options']],
    'junitnoapps' : [junit_noapps, ['options']],
    'unittest' : [unittest, ['options']],
    'rbcheck' : [rbcheck, ['options']],
    'rcmplib' : [rcmplib, ['options']],
    'test' : [test, ['options']],
    'rrepl' : [rrepl, '[options]'],
    'installcran' : [installcran, '[options]'],
    }

_commands.update(mx_fastr_pkgtest._commands)

mx.update_commands(_fastr_suite, _commands)
示例#51
0
        third_party_license_files=[],
        support_distributions=['substratevm:POLYGLOT_NATIVE_API_SUPPORT'
                               ],  # TODO only support? or could be jars?
        polyglot_lib_build_args=[
            "-H:Features=org.graalvm.polyglot.nativeapi.PolyglotNativeAPIFeature",
            "-Dorg.graalvm.polyglot.nativeapi.libraryPath=<path:POLYGLOT_NATIVE_API_HEADERS>",
            "-Dorg.graalvm.polyglot.nativeapi.nativeLibraryPath=<path:POLYGLOT_NATIVE_API_SUPPORT>",
            "-H:CStandard=C11",
        ],
        polyglot_lib_jar_dependencies=[
            "substratevm:POLYGLOT_NATIVE_API",
        ],
        polyglot_lib_build_dependencies=[
            "substratevm:POLYGLOT_NATIVE_API_SUPPORT",
        ],
        has_polyglot_lib_entrypoints=True,
    ))

mx.update_commands(
    suite, {
        'build': [build, ''],
        'helloworld':
        [lambda args: native_image_context_run(helloworld, args), ''],
        'cinterfacetutorial':
        [lambda args: native_image_context_run(cinterfacetutorial, args), ''],
        'fetch-languages':
        [lambda args: fetch_languages(args, early_exit=False), ''],
        'benchmark':
        [benchmark, '--vmargs [vmargs] --runargs [runargs] suite:benchname'],
    })
示例#52
0
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# ----------------------------------------------------------------------------------------------------

import mx
import mx_unittest
import mx_gate

_suite = mx.suite('sdk')


mx.update_commands(_suite, {
    'unittest': [mx_unittest.unittest, ''],
    'gate' : [mx_gate.gate, ''],
})
示例#53
0
文件: mx_sulong.py 项目: sekmet/graal
    create_debugexpr_parser(args, out)


def llirtestgen(args=None, out=None):
    return mx.run_java(
        mx.get_runtime_jvm_args(["LLIR_TEST_GEN"]) +
        ["com.oracle.truffle.llvm.tests.llirtestgen.LLIRTestGen"] + args,
        out=out)


mx.update_commands(
    _suite, {
        'lli': [runLLVM, ''],
        'test-llvm-image': [_test_llvm_image, 'test a pre-built LLVM image'],
        'create-asm-parser':
        [create_asm_parser, 'create the inline assembly parser using antlr'],
        'create-debugexpr-parser': [
            create_debugexpr_parser,
            'create the debug expression parser using antlr'
        ],
        'create-parsers': [
            create_parsers,
            'create the debug expression and the inline assembly parser using antlr'
        ],
        'extract-bitcode':
        [extract_bitcode, 'Extract embedded LLVM bitcode from object files'],
        'llvm-tool': [llvm_tool, 'Run a tool from the LLVM.ORG distribution'],
        'llvm-dis':
        [llvm_dis, 'Disassemble (embedded) LLVM bitcode to LLVM assembly'],
    })
示例#54
0
mx.update_commands(_suite, {
    'suoptbench' : [suOptBench, ''],
    'subench' : [suBench, ''],
    'clangbench' : [clangBench, ''],
    'gccbench' : [gccBench, ''],
    'su-options' : [printOptions, ''],
    'su-pullbenchmarkgame' : [pullBenchmarkGame, ''],
    'su-pulldeps' : [downloadDependencies, ''],
    'su-pullllvmbinaries' : [pullLLVMBinaries, ''],
    'su-pullnwccsuite' : [pullNWCCSuite, ''],
    'su-pullgccsuite' : [pullGCCSuite, ''],
    'su-pullllvmsuite' : [pullLLVMSuite, ''],
    'su-pulltools' : [pullTools, ''],
    'su-pulldragonegg' : [pullInstallDragonEgg, ''],
    'su-run' : [runLLVM, ''],
    'su-debug' : [runDebugLLVM, ''],
    'su-tests' : [runTests, ''],
    'su-tests-bench' : [runBenchmarkTestCases, ''],
    'su-tests-gcc' : [runGCCTestCases, ''],
    'su-tests-llvm' : [runLLVMTestCases, ''],
    'su-tests-sulong' : [runTruffleTestCases, ''],
    'su-tests-nwcc' : [runNWCCTestCases, ''],
    'su-tests-types' : [runTypeTestCases, ''],
    'su-local-gate' : [localGate, ''],
    'su-clang' : [compileWithClang, ''],
    'su-clang++' : [compileWithClangPP, ''],
    'su-opt' : [opt, ''],
    'su-gcc' : [dragonEgg, ''],
    'su-g++' : [dragonEggGPP, ''],
    'su-travis1' : [travis1, ''],
    'su-travis2' : [travis2, '']
})
示例#55
0
for mode in ['jvm', 'native']:
    mx_sdk_vm.add_graalvm_hostvm_config(
        mode + '-cpusampler-exclude-inlined-roots',
        launcher_args=[
            '--' + mode, '--cpusampler',
            '--cpusampler.Mode=exclude_inlined_roots'
        ])
    mx_sdk_vm.add_graalvm_hostvm_config(
        mode + '-cpusampler-roots',
        launcher_args=['--' + mode, '--cpusampler', '--cpusampler.Mode=roots'])
    mx_sdk_vm.add_graalvm_hostvm_config(mode + '-cpusampler-statements',
                                        launcher_args=[
                                            '--' + mode, '--cpusampler',
                                            '--cpusampler.Mode=statements'
                                        ])
    mx_sdk_vm.add_graalvm_hostvm_config(mode + '-cputracer-roots',
                                        launcher_args=[
                                            '--' + mode, '--cputracer',
                                            '--cputracer.TraceRoots=true'
                                        ])
    mx_sdk_vm.add_graalvm_hostvm_config(mode + '-cputracer-statements',
                                        launcher_args=[
                                            '--' + mode, '--cputracer',
                                            '--cputracer.TraceStatements=true'
                                        ])

mx.update_commands(_suite, {
    'javadoc': [javadoc, ''],
    'gate': [mx_gate.gate, ''],
})
示例#56
0
        elif arcname.endswith('_OptionDescriptors.class'):
            # Need to create service files for the providers of the
            # jdk.vm.ci.options.Options service created by
            # jdk.vm.ci.options.processor.OptionProcessor.
            provider = arcname[:-len('.class'):].replace('/', '.')
            self.services.setdefault('com.oracle.graal.options.OptionDescriptors', []).append(provider)
        return False

    def __addsrc__(self, arcname, contents):
        return False

    def __closing__(self):
        pass

mx.update_commands(_suite, {
    'vm': [run_vm, '[-options] class [args...]'],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
})

mx.add_argument('-M', '--jvmci-mode', action='store', choices=sorted(_jvmciModes.viewkeys()), help='the JVM variant type to build/run (default: ' + _vm.jvmciMode + ')')

def mx_post_parse_cmd_line(opts):
    if opts.jvmci_mode is not None:
        _vm.update(opts.jvmci_mode)
    for dist in [d.dist() for d in _bootClasspathDists]:
        dist.set_archiveparticipant(GraalArchiveParticipant(dist))

def _update_JVMCI_library():
    """
    Updates the "path" and "sha1" attributes of the "JVMCI" library to
    refer to a jvmci.jar created from the JVMCI classes in JDK9.
    """
示例#57
0
        exe = join(dstJdk, 'bin', mx.exe_suffix('java'))
        with StdoutUnstripping(args=[], out=None, err=None, mapFiles=mapFiles) as u:
            mx.run([exe, '-XX:+BootstrapJVMCI', '-version'], out=u.out, err=u.err)
        if args.archive:
            mx.log('Archiving {}'.format(args.archive))
            create_archive(dstJdk, args.archive, basename(args.dest) + '/')
    else:
        mx.abort('Can only make GraalJDK for JDK 8 currently')

mx.update_commands(_suite, {
    'sl' : [sl, '[SL args|@VM options]'],
    'vm': [run_vm, '[-options] class [args...]'],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
    'nodecostdump' : [_nodeCostDump, ''],
    'verify_jvmci_ci_versions': [verify_jvmci_ci_versions, ''],
    'java_base_unittest' : [java_base_unittest, 'Runs unittest on JDK9 java.base "only" module(s)'],
    'microbench': [microbench, ''],
    'javadoc': [javadoc, ''],
    'makegraaljdk': [makegraaljdk, '[options]'],
})

def mx_post_parse_cmd_line(opts):
    mx.add_ide_envvar('JVMCI_VERSION_CHECK')
    for dist in _suite.dists:
        dist.set_archiveparticipant(GraalArchiveParticipant(dist, isTest=dist.name.endswith('_TEST')))
    add_bootclasspath_append(mx.distribution('sdk:GRAAL_SDK'))
    add_bootclasspath_append(mx.distribution('truffle:TRUFFLE_API'))
    global _vm_prefix
    _vm_prefix = opts.vm_prefix
import mx_graal_core

# Short-hand commands used to quickly run common benchmarks.
mx.update_commands(mx.suite('graal-core'), {
    'dacapo': [
      lambda args: createBenchmarkShortcut("dacapo", args),
      '[<benchmarks>|*] [-- [VM options] [-- [DaCapo options]]]'
    ],
    'scaladacapo': [
      lambda args: createBenchmarkShortcut("scala-dacapo", args),
      '[<benchmarks>|*] [-- [VM options] [-- [Scala DaCapo options]]]'
    ],
    'specjvm2008': [
      lambda args: createBenchmarkShortcut("specjvm2008", args),
      '[<benchmarks>|*] [-- [VM options] [-- [SPECjvm2008 options]]]'
    ],
    'specjbb2005': [
      lambda args: mx_benchmark.benchmark(["specjbb2005"] + args),
      '[-- [VM options] [-- [SPECjbb2005 options]]]'
    ],
    'specjbb2013': [
      lambda args: mx_benchmark.benchmark(["specjbb2013"] + args),
      '[-- [VM options] [-- [SPECjbb2013 options]]]'
    ],
    'specjbb2015': [
      lambda args: mx_benchmark.benchmark(["specjbb2015"] + args),
      '[-- [VM options] [-- [SPECjbb2015 options]]]'
    ],
})


def createBenchmarkShortcut(benchSuite, args):
示例#59
0
    if '-G:+PrintFlags' in args and '-Xcomp' not in args:
        mx.warn('Using -G:+PrintFlags may have no effect without -Xcomp as Graal initialization is lazy')
    positionalargs[0] = _buildGOptionsArgs(args)
    return _jvmci_run_vm(*positionalargs, **kwargs)

def _unittest_config_participant(config):
    vmArgs, mainClass, mainClassArgs = config
    if isJVMCIEnabled(get_vm()):
        return (_buildGOptionsArgs(vmArgs), mainClass, mainClassArgs)
    return config

mx_unittest.add_config_participant(_unittest_config_participant)

mx.update_commands(_suite, {
    'vm': [run_vm, '[-options] class [args...]'],
    'jdkartifactstats' : [jdkartifactstats, ''],
    'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'],
})

class GraalArchiveParticipant(JVMCIArchiveParticipant):
    def __init__(self, dist):
        JVMCIArchiveParticipant.__init__(self, dist)

    def __add__(self, arcname, contents):
        if arcname.startswith('META-INF/providers/'):
            # Handles files generated by ServiceProviderProcessor
            provider = arcname[len('META-INF/providers/'):]
            for service in contents.strip().split(os.linesep):
                assert service
                self.jvmciServices.setdefault(service, []).append(provider)
            return True