8235995: Remove src/jdk.internal.vm.compiler/.mx.graal directory
Removed src/jdk.internal.vm.compiler/.mx.graal directory and files Reviewed-by: dlong
This commit is contained in:
parent
67ba91ba52
commit
c8ed0128c2
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>mx.graal</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>mx</project>
|
||||
<project>mx.jvmci</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/.mx.graal</path>
|
||||
<path>/.mx.graal</path>
|
||||
<path>/.mx.graal</path>
|
||||
</pydev_pathproperty>
|
||||
|
||||
</pydev_project>
|
@ -1 +0,0 @@
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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
|
||||
if mx.get_jdk(tag='default').javaCompliance < "1.9":
|
||||
mx.abort('JAVA_HOME is not a JDK9: ' + mx.get_jdk(tag='default').home)
|
||||
|
||||
from mx_graal_9 import mx_post_parse_cmd_line, run_vm, get_vm, isJVMCIEnabled # pylint: disable=unused-import
|
||||
|
||||
import mx_graal_bench # pylint: disable=unused-import
|
@ -1,436 +0,0 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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 os
|
||||
from os.path import join, dirname, basename, exists, abspath
|
||||
from argparse import ArgumentParser
|
||||
import sanitycheck
|
||||
import re
|
||||
|
||||
import mx
|
||||
from mx_gate import Task
|
||||
from sanitycheck import _noneAsEmptyList
|
||||
|
||||
from mx_unittest import unittest
|
||||
from mx_graal_bench import dacapo
|
||||
import mx_gate
|
||||
import mx_unittest
|
||||
|
||||
_suite = mx.suite('graal')
|
||||
|
||||
_jdk = mx.get_jdk(tag='default')
|
||||
assert _jdk.javaCompliance >= "1.9"
|
||||
|
||||
def isJVMCIEnabled(vm):
|
||||
return True
|
||||
|
||||
_jvmciModes = {
|
||||
'hosted' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI'],
|
||||
'jit' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:+UseJVMCICompiler'],
|
||||
'disabled' : []
|
||||
}
|
||||
|
||||
def get_vm():
|
||||
"""
|
||||
Gets the name of the currently selected JVM variant.
|
||||
"""
|
||||
return 'server'
|
||||
|
||||
class JVMCIMode:
|
||||
"""
|
||||
A context manager for setting the current JVMCI mode.
|
||||
"""
|
||||
def __init__(self, jvmciMode=None):
|
||||
self.update(jvmciMode)
|
||||
|
||||
def update(self, jvmciMode=None):
|
||||
assert jvmciMode is None or jvmciMode in _jvmciModes, jvmciMode
|
||||
self.jvmciMode = jvmciMode or _vm.jvmciMode
|
||||
|
||||
def __enter__(self):
|
||||
global _vm
|
||||
self.previousVm = _vm
|
||||
_vm = self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
global _vm
|
||||
_vm = self.previousVm
|
||||
|
||||
_vm = JVMCIMode(jvmciMode='jit')
|
||||
|
||||
class BootClasspathDist(object):
|
||||
"""
|
||||
Extra info for a Distribution that must be put onto the boot class path.
|
||||
"""
|
||||
def __init__(self, name):
|
||||
self._name = name
|
||||
|
||||
def dist(self):
|
||||
return mx.distribution(self._name)
|
||||
|
||||
def get_classpath_repr(self):
|
||||
return self.dist().classpath_repr()
|
||||
|
||||
_compilers = ['graal-economy', 'graal']
|
||||
_bootClasspathDists = [
|
||||
BootClasspathDist('GRAAL'),
|
||||
]
|
||||
|
||||
def add_compiler(compilerName):
|
||||
_compilers.append(compilerName)
|
||||
|
||||
def add_boot_classpath_dist(dist):
|
||||
_bootClasspathDists.append(dist)
|
||||
|
||||
mx_gate.add_jacoco_includes(['org.graalvm.compiler.*'])
|
||||
mx_gate.add_jacoco_excluded_annotations(['@Snippet', '@ClassSubstitution'])
|
||||
|
||||
# This is different than the 'jmh' commmand in that it
|
||||
# looks for internal JMH benchmarks (i.e. those that
|
||||
# depend on the JMH library).
|
||||
def microbench(args):
|
||||
"""run JMH microbenchmark projects"""
|
||||
parser = ArgumentParser(prog='mx microbench', description=microbench.__doc__,
|
||||
usage="%(prog)s [command options|VM options] [-- [JMH options]]")
|
||||
parser.add_argument('--jar', help='Explicitly specify micro-benchmark location')
|
||||
known_args, args = parser.parse_known_args(args)
|
||||
|
||||
vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True)
|
||||
|
||||
# look for -f in JMH arguments
|
||||
forking = True
|
||||
for i in range(len(jmhArgs)):
|
||||
arg = jmhArgs[i]
|
||||
if arg.startswith('-f'):
|
||||
if arg == '-f' and (i+1) < len(jmhArgs):
|
||||
arg += jmhArgs[i+1]
|
||||
try:
|
||||
if int(arg[2:]) == 0:
|
||||
forking = False
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if known_args.jar:
|
||||
# use the specified jar
|
||||
args = ['-jar', known_args.jar]
|
||||
if not forking:
|
||||
args += vmArgs
|
||||
else:
|
||||
# find all projects with a direct JMH dependency
|
||||
jmhProjects = []
|
||||
for p in mx.projects_opt_limit_to_suites():
|
||||
if 'JMH' in [x.name for x in p.deps]:
|
||||
jmhProjects.append(p.name)
|
||||
cp = mx.classpath(jmhProjects)
|
||||
|
||||
# execute JMH runner
|
||||
args = ['-cp', cp]
|
||||
if not forking:
|
||||
args += vmArgs
|
||||
args += ['org.openjdk.jmh.Main']
|
||||
|
||||
if forking:
|
||||
jvm = get_vm()
|
||||
def quoteSpace(s):
|
||||
if " " in s:
|
||||
return '"' + s + '"'
|
||||
return s
|
||||
|
||||
forkedVmArgs = map(quoteSpace, _parseVmArgs(_jdk, vmArgs))
|
||||
args += ['--jvmArgsPrepend', ' '.join(['-' + jvm] + forkedVmArgs)]
|
||||
run_vm(args + jmhArgs)
|
||||
|
||||
def ctw(args, extraVMarguments=None):
|
||||
"""run CompileTheWorld"""
|
||||
|
||||
defaultCtwopts = '-Inline'
|
||||
|
||||
parser = ArgumentParser(prog='mx ctw')
|
||||
parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>')
|
||||
parser.add_argument('--cp', '--jar', action='store', help='jar or class path denoting classes to compile', metavar='<path>')
|
||||
|
||||
args, vmargs = parser.parse_known_args(args)
|
||||
|
||||
if args.ctwopts:
|
||||
# Replace spaces with '#' since -G: options cannot contain spaces
|
||||
vmargs.append('-G:CompileTheWorldConfig=' + re.sub(r'\s+', '#', args.ctwopts))
|
||||
|
||||
if args.cp:
|
||||
cp = os.path.abspath(args.cp)
|
||||
else:
|
||||
cp = join(_jdk.home, 'lib', 'modules', 'bootmodules.jimage')
|
||||
vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*')
|
||||
|
||||
# suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris)
|
||||
vmargs = ['-Djava.awt.headless=true'] + vmargs
|
||||
|
||||
if _vm.jvmciMode == 'disabled':
|
||||
vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + cp]
|
||||
else:
|
||||
if _vm.jvmciMode == 'jit':
|
||||
vmargs += ['-XX:+BootstrapJVMCI']
|
||||
vmargs += ['-G:CompileTheWorldClasspath=' + cp, 'org.graalvm.compiler.hotspot.CompileTheWorld']
|
||||
|
||||
run_vm(vmargs + _noneAsEmptyList(extraVMarguments))
|
||||
|
||||
class UnitTestRun:
|
||||
def __init__(self, name, args):
|
||||
self.name = name
|
||||
self.args = args
|
||||
|
||||
def run(self, suites, tasks, extraVMarguments=None):
|
||||
for suite in suites:
|
||||
with Task(self.name + ': hosted-release ' + suite, tasks) as t:
|
||||
if t: unittest(['--suite', suite, '--enable-timing', '--verbose', '--fail-fast'] + self.args + _noneAsEmptyList(extraVMarguments))
|
||||
|
||||
class BootstrapTest:
|
||||
def __init__(self, name, args, suppress=None):
|
||||
self.name = name
|
||||
self.args = args
|
||||
self.suppress = suppress
|
||||
|
||||
def run(self, tasks, extraVMarguments=None):
|
||||
with JVMCIMode('jit'):
|
||||
with Task(self.name, tasks) as t:
|
||||
if t:
|
||||
if self.suppress:
|
||||
out = mx.DuplicateSuppressingStream(self.suppress).write
|
||||
else:
|
||||
out = None
|
||||
run_vm(self.args + _noneAsEmptyList(extraVMarguments) + ['-XX:-TieredCompilation', '-XX:+BootstrapJVMCI', '-version'], out=out)
|
||||
|
||||
class MicrobenchRun:
|
||||
def __init__(self, name, args):
|
||||
self.name = name
|
||||
self.args = args
|
||||
|
||||
def run(self, tasks, extraVMarguments=None):
|
||||
with Task(self.name + ': hosted-product ', tasks) as t:
|
||||
if t: microbench(_noneAsEmptyList(extraVMarguments) + ['--'] + self.args)
|
||||
|
||||
def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVMarguments=None):
|
||||
|
||||
# Run unit tests in hosted mode
|
||||
with JVMCIMode('hosted'):
|
||||
for r in unit_test_runs:
|
||||
r.run(suites, tasks, extraVMarguments)
|
||||
|
||||
# Run microbench in hosted mode (only for testing the JMH setup)
|
||||
with JVMCIMode('hosted'):
|
||||
for r in [MicrobenchRun('Microbench', ['TestJMH'])]:
|
||||
r.run(tasks, extraVMarguments)
|
||||
|
||||
# Run ctw against rt.jar on server-hosted-jvmci
|
||||
with JVMCIMode('hosted'):
|
||||
with Task('CTW:hosted', tasks) as t:
|
||||
if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-InlineDuringParsing', '-G:-CompileTheWorldVerbose', '-XX:ReservedCodeCacheSize=300m'], _noneAsEmptyList(extraVMarguments))
|
||||
|
||||
# bootstrap tests
|
||||
for b in bootstrap_tests:
|
||||
b.run(tasks, extraVMarguments)
|
||||
|
||||
# run dacapo sanitychecks
|
||||
for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel='release', extraVmArguments=extraVMarguments) \
|
||||
+ sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel='release', extraVmArguments=extraVMarguments):
|
||||
with Task(str(test) + ':' + 'release', tasks) as t:
|
||||
if t and not test.test('jvmci'):
|
||||
t.abort(test.name + ' Failed')
|
||||
|
||||
# ensure -Xbatch still works
|
||||
with JVMCIMode('jit'):
|
||||
with Task('DaCapo_pmd:BatchMode', tasks) as t:
|
||||
if t: dacapo(_noneAsEmptyList(extraVMarguments) + ['-Xbatch', 'pmd'])
|
||||
|
||||
# ensure benchmark counters still work
|
||||
with JVMCIMode('jit'):
|
||||
with Task('DaCapo_pmd:BenchmarkCounters:product', tasks) as t:
|
||||
if t: dacapo(_noneAsEmptyList(extraVMarguments) + ['-G:+LIRProfileMoves', '-G:+GenericDynamicCounters', '-XX:JVMCICounterSize=10', 'pmd'])
|
||||
|
||||
# ensure -Xcomp still works
|
||||
with JVMCIMode('jit'):
|
||||
with Task('XCompMode:product', tasks) as t:
|
||||
if t: run_vm(_noneAsEmptyList(extraVMarguments) + ['-Xcomp', '-version'])
|
||||
|
||||
|
||||
graal_unit_test_runs = [
|
||||
UnitTestRun('UnitTests', []),
|
||||
]
|
||||
|
||||
_registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if mx.get_arch() == 'sparcv9' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'
|
||||
|
||||
graal_bootstrap_tests = [
|
||||
BootstrapTest('BootstrapWithSystemAssertions', ['-esa']),
|
||||
BootstrapTest('BootstrapWithSystemAssertionsNoCoop', ['-esa', '-XX:-UseCompressedOops', '-G:+ExitVMOnException']),
|
||||
BootstrapTest('BootstrapWithGCVerification', ['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']),
|
||||
BootstrapTest('BootstrapWithG1GCVerification', ['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']),
|
||||
BootstrapTest('BootstrapEconomyWithSystemAssertions', ['-esa', '-Djvmci.compiler=graal-economy', '-G:+ExitVMOnException']),
|
||||
BootstrapTest('BootstrapWithExceptionEdges', ['-esa', '-G:+StressInvokeWithExceptionNode', '-G:+ExitVMOnException']),
|
||||
BootstrapTest('BootstrapWithRegisterPressure', ['-esa', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart']),
|
||||
BootstrapTest('BootstrapTraceRAWithRegisterPressure', ['-esa', '-G:+TraceRA', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart']),
|
||||
BootstrapTest('BootstrapWithImmutableCode', ['-esa', '-G:+ImmutableCode', '-G:+VerifyPhases', '-G:+ExitVMOnException']),
|
||||
]
|
||||
|
||||
def _graal_gate_runner(args, tasks):
|
||||
compiler_gate_runner(['graal'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
|
||||
|
||||
mx_gate.add_gate_runner(_suite, _graal_gate_runner)
|
||||
mx_gate.add_gate_argument('--extra-vm-argument', action='append', help='add extra vm argument to gate tasks if applicable (multiple occurrences allowed)')
|
||||
|
||||
def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
|
||||
run_vm(vmArgs + [mainClass] + mainClassArgs)
|
||||
|
||||
mx_unittest.set_vm_launcher('JDK9 VM launcher', _unittest_vm_launcher)
|
||||
|
||||
def _parseVmArgs(jdk, args, addDefaultArgs=True):
|
||||
args = mx.expand_project_in_args(args, insitu=False)
|
||||
jacocoArgs = mx_gate.get_jacoco_agent_args()
|
||||
if jacocoArgs:
|
||||
args = jacocoArgs + args
|
||||
|
||||
# Support for -G: options
|
||||
def translateGOption(arg):
|
||||
if arg.startswith('-G:+'):
|
||||
if '=' in arg:
|
||||
mx.abort('Mixing + and = in -G: option specification: ' + arg)
|
||||
arg = '-Dgraal.' + arg[len('-G:+'):] + '=true'
|
||||
elif arg.startswith('-G:-'):
|
||||
if '=' in arg:
|
||||
mx.abort('Mixing - and = in -G: option specification: ' + arg)
|
||||
arg = '-Dgraal.' + arg[len('-G:+'):] + '=false'
|
||||
elif arg.startswith('-G:'):
|
||||
if '=' not in arg:
|
||||
mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
|
||||
arg = '-Dgraal.' + arg[len('-G:'):]
|
||||
return arg
|
||||
args = map(translateGOption, args)
|
||||
|
||||
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')
|
||||
|
||||
bcp = []
|
||||
if _jvmciModes[_vm.jvmciMode]:
|
||||
if _add_jvmci_to_bootclasspath:
|
||||
bcp.append(mx.library('JVMCI').classpath_repr())
|
||||
bcp.extend([d.get_classpath_repr() for d in _bootClasspathDists])
|
||||
if bcp:
|
||||
args = ['-Xbootclasspath/p:' + os.pathsep.join(bcp)] + args
|
||||
|
||||
# Remove JVMCI from class path. It's only there to support compilation.
|
||||
cpIndex, cp = mx.find_classpath_arg(args)
|
||||
if cp:
|
||||
jvmciLib = mx.library('JVMCI').path
|
||||
cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e != jvmciLib])
|
||||
args[cpIndex] = cp
|
||||
|
||||
# Set the default JVMCI compiler
|
||||
jvmciCompiler = _compilers[-1]
|
||||
args = ['-Djvmci.compiler=' + jvmciCompiler] + args
|
||||
|
||||
if '-version' in args:
|
||||
ignoredArgs = args[args.index('-version') + 1:]
|
||||
if len(ignoredArgs) > 0:
|
||||
mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
|
||||
return jdk.processArgs(args, addDefaultArgs=addDefaultArgs)
|
||||
|
||||
def run_java(jdk, args, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None, addDefaultArgs=True):
|
||||
|
||||
args = _parseVmArgs(jdk, args, addDefaultArgs=addDefaultArgs)
|
||||
|
||||
jvmciModeArgs = _jvmciModes[_vm.jvmciMode]
|
||||
cmd = [jdk.java] + ['-' + get_vm()] + jvmciModeArgs + args
|
||||
return mx.run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd)
|
||||
|
||||
_JVMCI_JDK_TAG = 'jvmci'
|
||||
|
||||
class GraalJVMCI9JDKConfig(mx.JDKConfig):
|
||||
def __init__(self, original):
|
||||
self._original = original
|
||||
mx.JDKConfig.__init__(self, original.home, tag=_JVMCI_JDK_TAG)
|
||||
|
||||
def run_java(self, args, **kwArgs):
|
||||
run_java(self._original, args, **kwArgs)
|
||||
|
||||
class GraalJDKFactory(mx.JDKFactory):
|
||||
def getJDKConfig(self):
|
||||
return GraalJVMCI9JDKConfig(_jdk)
|
||||
|
||||
def description(self):
|
||||
return "JVMCI JDK with Graal"
|
||||
|
||||
# This will override the 'generic' JVMCI JDK with a Graal JVMCI JDK that has
|
||||
# support for -G style Graal options.
|
||||
mx.addJDKFactory(_JVMCI_JDK_TAG, mx.JavaCompliance('9'), GraalJDKFactory())
|
||||
|
||||
def run_vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, debugLevel=None, vmbuild=None):
|
||||
"""run a Java program by executing the java executable in a JVMCI JDK"""
|
||||
|
||||
return run_java(_jdk, args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
|
||||
|
||||
class GraalArchiveParticipant:
|
||||
def __init__(self, dist):
|
||||
self.dist = dist
|
||||
|
||||
def __opened__(self, arc, srcArc, services):
|
||||
self.services = services
|
||||
self.arc = arc
|
||||
|
||||
def __add__(self, arcname, contents):
|
||||
if arcname.startswith('META-INF/providers/'):
|
||||
provider = arcname[len('META-INF/providers/'):]
|
||||
for service in contents.strip().split(os.linesep):
|
||||
assert service
|
||||
self.services.setdefault(service, []).append(provider)
|
||||
return True
|
||||
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('org.graalvm.compiler.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:
|
||||
_vm.update(opts.jvmci_mode)
|
||||
for dist in [d.dist() for d in _bootClasspathDists]:
|
||||
dist.set_archiveparticipant(GraalArchiveParticipant(dist))
|
||||
|
||||
_add_jvmci_to_bootclasspath = False
|
||||
|
@ -1,256 +0,0 @@
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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 sanitycheck
|
||||
import itertools
|
||||
import json
|
||||
|
||||
import mx
|
||||
import mx_graal
|
||||
|
||||
def _run_benchmark(args, availableBenchmarks, runBenchmark):
|
||||
|
||||
vmOpts, benchmarksAndOptions = mx.extract_VM_args(args, useDoubleDash=availableBenchmarks is None)
|
||||
|
||||
if availableBenchmarks is None:
|
||||
harnessArgs = benchmarksAndOptions
|
||||
return runBenchmark(None, harnessArgs, vmOpts)
|
||||
|
||||
if len(benchmarksAndOptions) == 0:
|
||||
mx.abort('at least one benchmark name or "all" must be specified')
|
||||
benchmarks = list(itertools.takewhile(lambda x: not x.startswith('-'), benchmarksAndOptions))
|
||||
harnessArgs = benchmarksAndOptions[len(benchmarks):]
|
||||
|
||||
if 'all' in benchmarks:
|
||||
benchmarks = availableBenchmarks
|
||||
else:
|
||||
for bm in benchmarks:
|
||||
if bm not in availableBenchmarks:
|
||||
mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(availableBenchmarks))
|
||||
|
||||
failed = []
|
||||
for bm in benchmarks:
|
||||
if not runBenchmark(bm, harnessArgs, vmOpts):
|
||||
failed.append(bm)
|
||||
|
||||
if len(failed) != 0:
|
||||
mx.abort('Benchmark failures: ' + str(failed))
|
||||
|
||||
def deoptalot(args):
|
||||
"""bootstrap a VM with DeoptimizeALot and VerifyOops on
|
||||
|
||||
If the first argument is a number, the process will be repeated
|
||||
this number of times. All other arguments are passed to the VM."""
|
||||
count = 1
|
||||
if len(args) > 0 and args[0].isdigit():
|
||||
count = int(args[0])
|
||||
del args[0]
|
||||
|
||||
for _ in range(count):
|
||||
if not mx_graal.run_vm(['-XX:-TieredCompilation', '-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version']) == 0:
|
||||
mx.abort("Failed")
|
||||
|
||||
def longtests(args):
|
||||
|
||||
deoptalot(['15', '-Xmx48m'])
|
||||
|
||||
dacapo(['100', 'eclipse', '-esa'])
|
||||
|
||||
def dacapo(args):
|
||||
"""run one or more DaCapo benchmarks"""
|
||||
|
||||
def launcher(bm, harnessArgs, extraVmOpts):
|
||||
return sanitycheck.getDacapo(bm, harnessArgs).test(mx_graal.get_vm(), extraVmOpts=extraVmOpts)
|
||||
|
||||
_run_benchmark(args, sanitycheck.dacapoSanityWarmup.keys(), launcher)
|
||||
|
||||
def scaladacapo(args):
|
||||
"""run one or more Scala DaCapo benchmarks"""
|
||||
|
||||
def launcher(bm, harnessArgs, extraVmOpts):
|
||||
return sanitycheck.getScalaDacapo(bm, harnessArgs).test(mx_graal.get_vm(), extraVmOpts=extraVmOpts)
|
||||
|
||||
_run_benchmark(args, sanitycheck.dacapoScalaSanityWarmup.keys(), launcher)
|
||||
|
||||
|
||||
"""
|
||||
Extra benchmarks to run from 'bench()'.
|
||||
"""
|
||||
extraBenchmarks = []
|
||||
|
||||
def bench(args):
|
||||
"""run benchmarks and parse their output for results
|
||||
|
||||
Results are JSON formated : {group : {benchmark : score}}."""
|
||||
resultFile = None
|
||||
if '-resultfile' in args:
|
||||
index = args.index('-resultfile')
|
||||
if index + 1 < len(args):
|
||||
resultFile = args[index + 1]
|
||||
del args[index]
|
||||
del args[index]
|
||||
else:
|
||||
mx.abort('-resultfile must be followed by a file name')
|
||||
resultFileCSV = None
|
||||
if '-resultfilecsv' in args:
|
||||
index = args.index('-resultfilecsv')
|
||||
if index + 1 < len(args):
|
||||
resultFileCSV = args[index + 1]
|
||||
del args[index]
|
||||
del args[index]
|
||||
else:
|
||||
mx.abort('-resultfilecsv must be followed by a file name')
|
||||
vm = mx_graal.get_vm()
|
||||
if len(args) is 0:
|
||||
args = ['all']
|
||||
|
||||
vmArgs = [arg for arg in args if arg.startswith('-')]
|
||||
|
||||
def benchmarks_in_group(group):
|
||||
prefix = group + ':'
|
||||
return [a[len(prefix):] for a in args if a.startswith(prefix)]
|
||||
|
||||
results = {}
|
||||
benchmarks = []
|
||||
# DaCapo
|
||||
if 'dacapo' in args or 'all' in args:
|
||||
benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
|
||||
else:
|
||||
dacapos = benchmarks_in_group('dacapo')
|
||||
for dacapo in dacapos:
|
||||
if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
|
||||
mx.abort('Unknown DaCapo : ' + dacapo)
|
||||
iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark]
|
||||
if iterations > 0:
|
||||
benchmarks += [sanitycheck.getDacapo(dacapo, ['-n', str(iterations)])]
|
||||
|
||||
if 'scaladacapo' in args or 'all' in args:
|
||||
benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
|
||||
else:
|
||||
scaladacapos = benchmarks_in_group('scaladacapo')
|
||||
for scaladacapo in scaladacapos:
|
||||
if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
|
||||
mx.abort('Unknown Scala DaCapo : ' + scaladacapo)
|
||||
iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark]
|
||||
if iterations > 0:
|
||||
benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, ['-n', str(iterations)])]
|
||||
|
||||
# Bootstrap
|
||||
if 'bootstrap' in args or 'all' in args:
|
||||
benchmarks += sanitycheck.getBootstraps()
|
||||
# SPECjvm2008
|
||||
if 'specjvm2008' in args or 'all' in args:
|
||||
benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120'])]
|
||||
else:
|
||||
specjvms = benchmarks_in_group('specjvm2008')
|
||||
for specjvm in specjvms:
|
||||
benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120', specjvm])]
|
||||
|
||||
if 'specjbb2005' in args or 'all' in args:
|
||||
benchmarks += [sanitycheck.getSPECjbb2005()]
|
||||
|
||||
if 'specjbb2013' in args: # or 'all' in args //currently not in default set
|
||||
benchmarks += [sanitycheck.getSPECjbb2013()]
|
||||
|
||||
if 'ctw-full' in args:
|
||||
benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full))
|
||||
if 'ctw-noinline' in args:
|
||||
benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline))
|
||||
|
||||
for f in extraBenchmarks:
|
||||
f(args, vm, benchmarks)
|
||||
|
||||
for test in benchmarks:
|
||||
for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items():
|
||||
group = results.setdefault(groupName, {})
|
||||
group.update(res)
|
||||
mx.log(json.dumps(results))
|
||||
if resultFile:
|
||||
with open(resultFile, 'w') as f:
|
||||
f.write(json.dumps(results))
|
||||
if resultFileCSV:
|
||||
with open(resultFileCSV, 'w') as f:
|
||||
for key1, value1 in results.iteritems():
|
||||
f.write('%s;\n' % (str(key1)))
|
||||
for key2, value2 in sorted(value1.iteritems()):
|
||||
f.write('%s; %s;\n' % (str(key2), str(value2)))
|
||||
|
||||
def specjvm2008(args):
|
||||
"""run one or more SPECjvm2008 benchmarks"""
|
||||
|
||||
def launcher(bm, harnessArgs, extraVmOpts):
|
||||
return sanitycheck.getSPECjvm2008(harnessArgs + [bm]).bench(mx_graal.get_vm(), extraVmOpts=extraVmOpts)
|
||||
|
||||
availableBenchmarks = set(sanitycheck.specjvm2008Names)
|
||||
if "all" not in args:
|
||||
# only add benchmark groups if we are not running "all"
|
||||
for name in sanitycheck.specjvm2008Names:
|
||||
parts = name.rsplit('.', 1)
|
||||
if len(parts) > 1:
|
||||
assert len(parts) == 2
|
||||
group = parts[0]
|
||||
availableBenchmarks.add(group)
|
||||
|
||||
_run_benchmark(args, sorted(availableBenchmarks), launcher)
|
||||
|
||||
def specjbb2013(args):
|
||||
"""run the composite SPECjbb2013 benchmark"""
|
||||
|
||||
def launcher(bm, harnessArgs, extraVmOpts):
|
||||
assert bm is None
|
||||
return sanitycheck.getSPECjbb2013(harnessArgs).bench(mx_graal.get_vm(), extraVmOpts=extraVmOpts)
|
||||
|
||||
_run_benchmark(args, None, launcher)
|
||||
|
||||
def specjbb2015(args):
|
||||
"""run the composite SPECjbb2015 benchmark"""
|
||||
|
||||
def launcher(bm, harnessArgs, extraVmOpts):
|
||||
assert bm is None
|
||||
return sanitycheck.getSPECjbb2015(harnessArgs).bench(mx_graal.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.get_vm(), extraVmOpts=extraVmOpts)
|
||||
|
||||
_run_benchmark(args, None, launcher)
|
||||
|
||||
mx.update_commands(mx.suite('graal'), {
|
||||
'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, ''],
|
||||
})
|
@ -1,71 +0,0 @@
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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 re
|
||||
|
||||
class OutputParser:
|
||||
|
||||
def __init__(self):
|
||||
self.matchers = []
|
||||
|
||||
def addMatcher(self, matcher):
|
||||
self.matchers.append(matcher)
|
||||
|
||||
def parse(self, output):
|
||||
valueMaps = []
|
||||
for matcher in self.matchers:
|
||||
matcher.parse(output, valueMaps)
|
||||
return valueMaps
|
||||
|
||||
"""
|
||||
Produces a value map for each match of a given regular expression
|
||||
in some text. The value map is specified by a template map
|
||||
where each key and value in the template map is either a constant
|
||||
value or a named group in the regular expression. The latter is
|
||||
given as the group name enclosed in '<' and '>'.
|
||||
"""
|
||||
class ValuesMatcher:
|
||||
|
||||
def __init__(self, regex, valuesTemplate):
|
||||
assert isinstance(valuesTemplate, dict)
|
||||
self.regex = regex
|
||||
self.valuesTemplate = valuesTemplate
|
||||
|
||||
def parse(self, text, valueMaps):
|
||||
for match in self.regex.finditer(text):
|
||||
valueMap = {}
|
||||
for keyTemplate, valueTemplate in self.valuesTemplate.items():
|
||||
key = self.get_template_value(match, keyTemplate)
|
||||
value = self.get_template_value(match, valueTemplate)
|
||||
assert not valueMap.has_key(key), key
|
||||
valueMap[key] = value
|
||||
valueMaps.append(valueMap)
|
||||
|
||||
def get_template_value(self, match, template):
|
||||
def replace_var(m):
|
||||
groupName = m.group(1)
|
||||
return match.group(groupName)
|
||||
|
||||
return re.sub(r'<([\w]+)>', replace_var, template)
|
@ -1,453 +0,0 @@
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
from outputparser import OutputParser, ValuesMatcher
|
||||
import re, mx, mx_graal, os, sys, StringIO, subprocess
|
||||
from os.path import isfile, join, exists
|
||||
|
||||
gc = 'UseSerialGC'
|
||||
|
||||
dacapoSanityWarmup = {
|
||||
'avrora': [0, 0, 3, 6, 13],
|
||||
'batik': [0, 0, 5, 5, 20],
|
||||
'eclipse': [0, 0, 0, 0, 0],
|
||||
'fop': [4, 8, 10, 20, 30],
|
||||
'h2': [0, 0, 5, 5, 8],
|
||||
'jython': [0, 0, 5, 10, 13],
|
||||
'luindex': [0, 0, 5, 10, 10],
|
||||
'lusearch': [0, 4, 5, 5, 8],
|
||||
'pmd': [0, 0, 5, 10, 13],
|
||||
'sunflow': [0, 2, 5, 10, 15],
|
||||
'tomcat': [0, 0, 5, 10, 15],
|
||||
'tradebeans': [0, 0, 5, 10, 13],
|
||||
'tradesoap': [0, 0, 5, 10, 15],
|
||||
'xalan': [0, 0, 5, 10, 18],
|
||||
}
|
||||
|
||||
dacapoScalaSanityWarmup = {
|
||||
'actors': [0, 0, 2, 5, 5],
|
||||
'apparat': [0, 0, 2, 5, 5],
|
||||
'factorie': [0, 0, 2, 5, 5],
|
||||
'kiama': [0, 4, 3, 13, 15],
|
||||
'scalac': [0, 0, 5, 15, 20],
|
||||
'scaladoc': [0, 0, 5, 15, 15],
|
||||
'scalap': [0, 0, 5, 15, 20],
|
||||
'scalariform':[0, 0, 6, 15, 20],
|
||||
'scalatest': [0, 0, 2, 10, 12],
|
||||
'scalaxb': [0, 0, 5, 15, 25],
|
||||
# (gdub) specs sometimes returns a non-zero value event though there is no apparent failure
|
||||
'specs': [0, 0, 0, 0, 0],
|
||||
'tmt': [0, 0, 3, 10, 12]
|
||||
}
|
||||
|
||||
dacapoGateBuildLevels = {
|
||||
'avrora': ['product', 'fastdebug', 'debug'],
|
||||
'batik': ['product', 'fastdebug', 'debug'],
|
||||
# (lewurm): does not work with JDK8
|
||||
'eclipse': [],
|
||||
'fop': ['fastdebug', 'debug'],
|
||||
'h2': ['product', 'fastdebug', 'debug'],
|
||||
'jython': ['product', 'fastdebug', 'debug'],
|
||||
'luindex': ['product', 'fastdebug', 'debug'],
|
||||
'lusearch': ['product'],
|
||||
'pmd': ['product', 'fastdebug', 'debug'],
|
||||
'sunflow': ['fastdebug', 'debug'],
|
||||
'tomcat': ['product', 'fastdebug', 'debug'],
|
||||
'tradebeans': ['product', 'fastdebug', 'debug'],
|
||||
# tradesoap is too unreliable for the gate, often crashing with concurrency problems:
|
||||
# http://sourceforge.net/p/dacapobench/bugs/99/
|
||||
'tradesoap': [],
|
||||
'xalan': ['product', 'fastdebug', 'debug'],
|
||||
}
|
||||
|
||||
dacapoScalaGateBuildLevels = {
|
||||
'actors': ['product', 'fastdebug', 'debug'],
|
||||
'apparat': ['product', 'fastdebug', 'debug'],
|
||||
'factorie': ['product', 'fastdebug', 'debug'],
|
||||
'kiama': ['fastdebug', 'debug'],
|
||||
'scalac': ['product', 'fastdebug', 'debug'],
|
||||
'scaladoc': ['product', 'fastdebug', 'debug'],
|
||||
'scalap': ['product', 'fastdebug', 'debug'],
|
||||
'scalariform':['product', 'fastdebug', 'debug'],
|
||||
'scalatest': ['product', 'fastdebug', 'debug'],
|
||||
'scalaxb': ['product', 'fastdebug', 'debug'],
|
||||
'specs': ['product', 'fastdebug', 'debug'],
|
||||
'tmt': ['product', 'fastdebug', 'debug'],
|
||||
}
|
||||
|
||||
specjvm2008Names = [
|
||||
'startup.helloworld',
|
||||
'startup.compiler.compiler',
|
||||
'startup.compiler.sunflow',
|
||||
'startup.compress',
|
||||
'startup.crypto.aes',
|
||||
'startup.crypto.rsa',
|
||||
'startup.crypto.signverify',
|
||||
'startup.mpegaudio',
|
||||
'startup.scimark.fft',
|
||||
'startup.scimark.lu',
|
||||
'startup.scimark.monte_carlo',
|
||||
'startup.scimark.sor',
|
||||
'startup.scimark.sparse',
|
||||
'startup.serial',
|
||||
'startup.sunflow',
|
||||
'startup.xml.transform',
|
||||
'startup.xml.validation',
|
||||
'compiler.compiler',
|
||||
'compiler.sunflow',
|
||||
'compress',
|
||||
'crypto.aes',
|
||||
'crypto.rsa',
|
||||
'crypto.signverify',
|
||||
'derby',
|
||||
'mpegaudio',
|
||||
'scimark.fft.large',
|
||||
'scimark.lu.large',
|
||||
'scimark.sor.large',
|
||||
'scimark.sparse.large',
|
||||
'scimark.fft.small',
|
||||
'scimark.lu.small',
|
||||
'scimark.sor.small',
|
||||
'scimark.sparse.small',
|
||||
'scimark.monte_carlo',
|
||||
'serial',
|
||||
'sunflow',
|
||||
'xml.transform',
|
||||
'xml.validation'
|
||||
]
|
||||
|
||||
def _noneAsEmptyList(a):
|
||||
if a is None:
|
||||
return []
|
||||
return a
|
||||
|
||||
class SanityCheckLevel:
|
||||
Fast, Gate, Normal, Extensive, Benchmark = range(5)
|
||||
|
||||
def getSPECjbb2005(benchArgs=None):
|
||||
benchArgs = [] if benchArgs is None else benchArgs
|
||||
|
||||
specjbb2005 = mx.get_env('SPECJBB2005')
|
||||
if specjbb2005 is None or not exists(join(specjbb2005, 'jbb.jar')):
|
||||
mx.abort('Please set the SPECJBB2005 environment variable to a SPECjbb2005 directory')
|
||||
|
||||
score = re.compile(r"^Valid run, Score is (?P<score>[0-9]+)$", re.MULTILINE)
|
||||
error = re.compile(r"VALIDATION ERROR")
|
||||
success = re.compile(r"^Valid run, Score is [0-9]+$", re.MULTILINE)
|
||||
matcher = ValuesMatcher(score, {'group' : 'SPECjbb2005', 'name' : 'score', 'score' : '<score>'})
|
||||
classpath = ['jbb.jar', 'check.jar']
|
||||
return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+' + gc, '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005)
|
||||
|
||||
def getSPECjbb2013(benchArgs=None):
|
||||
|
||||
specjbb2013 = mx.get_env('SPECJBB2013')
|
||||
if specjbb2013 is None or not exists(join(specjbb2013, 'specjbb2013.jar')):
|
||||
mx.abort('Please set the SPECJBB2013 environment variable to a SPECjbb2013 directory')
|
||||
|
||||
jops = re.compile(r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$", re.MULTILINE)
|
||||
# error?
|
||||
success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
|
||||
matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : '<max>'})
|
||||
matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : '<critical>'})
|
||||
return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] +
|
||||
_noneAsEmptyList(benchArgs), [success], [], [matcherCritical, matcherMax],
|
||||
vmOpts=['-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC', '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013)
|
||||
|
||||
def getSPECjbb2015(benchArgs=None):
|
||||
|
||||
specjbb2015 = mx.get_env('SPECJBB2015')
|
||||
if specjbb2015 is None or not exists(join(specjbb2015, 'specjbb2015.jar')):
|
||||
mx.abort('Please set the SPECJBB2015 environment variable to a SPECjbb2015 directory')
|
||||
|
||||
jops = re.compile(r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$", re.MULTILINE)
|
||||
# error?
|
||||
success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
|
||||
matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2015', 'name' : 'max', 'score' : '<max>'})
|
||||
matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2015', 'name' : 'critical', 'score' : '<critical>'})
|
||||
return Test("SPECjbb2015", ['-jar', 'specjbb2015.jar', '-m', 'composite'] +
|
||||
_noneAsEmptyList(benchArgs), [success], [], [matcherCritical, matcherMax],
|
||||
vmOpts=['-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC', '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking', '-XX:-UseCompressedOops'], defaultCwd=specjbb2015)
|
||||
|
||||
def getSPECjvm2008(benchArgs=None):
|
||||
|
||||
specjvm2008 = mx.get_env('SPECJVM2008')
|
||||
if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
|
||||
mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
|
||||
|
||||
score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$", re.MULTILINE)
|
||||
error = re.compile(r"^Errors in benchmark: ", re.MULTILINE)
|
||||
# The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
|
||||
success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$", re.MULTILINE)
|
||||
matcher = ValuesMatcher(score, {'group' : 'SPECjvm2008', 'name' : '<benchmark>', 'score' : '<score>'})
|
||||
|
||||
return Test("SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + _noneAsEmptyList(benchArgs), [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+' + gc, '-XX:-UseCompressedOops'], defaultCwd=specjvm2008)
|
||||
|
||||
def getDacapos(level=SanityCheckLevel.Normal, gateBuildLevel=None, dacapoArgs=None, extraVmArguments=None):
|
||||
checks = []
|
||||
|
||||
for (bench, ns) in dacapoSanityWarmup.items():
|
||||
if ns[level] > 0:
|
||||
if gateBuildLevel is None or gateBuildLevel in dacapoGateBuildLevels[bench]:
|
||||
checks.append(getDacapo(bench, ['-n', str(ns[level])] + _noneAsEmptyList(dacapoArgs), extraVmArguments=extraVmArguments))
|
||||
|
||||
return checks
|
||||
|
||||
def getDacapo(name, dacapoArgs=None, extraVmArguments=None):
|
||||
dacapo = mx.get_env('DACAPO_CP')
|
||||
if dacapo is None:
|
||||
l = mx.library('DACAPO', False)
|
||||
if l is not None:
|
||||
dacapo = l.get_path(True)
|
||||
else:
|
||||
mx.abort('DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library')
|
||||
|
||||
if not isfile(dacapo) or not dacapo.endswith('.jar'):
|
||||
mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
|
||||
|
||||
dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====", re.MULTILINE)
|
||||
dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====", re.MULTILINE)
|
||||
dacapoTime = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
|
||||
dacapoTime1 = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec =====")
|
||||
|
||||
dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '<benchmark>', 'score' : '<time>'})
|
||||
dacapoMatcher1 = ValuesMatcher(dacapoTime1, {'group' : 'DaCapo-1stRun', 'name' : '<benchmark>', 'score' : '<time>'})
|
||||
|
||||
# Use ipv4 stack for dacapos; tomcat+solaris+ipv6_interface fails (see also: JDK-8072384)
|
||||
return Test("DaCapo-" + name, ['-jar', mx._cygpathU2W(dacapo), name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail],
|
||||
[dacapoMatcher, dacapoMatcher1],
|
||||
['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops', "-Djava.net.preferIPv4Stack=true", '-G:+ExitVMOnException'] +
|
||||
_noneAsEmptyList(extraVmArguments))
|
||||
|
||||
def getScalaDacapos(level=SanityCheckLevel.Normal, gateBuildLevel=None, dacapoArgs=None, extraVmArguments=None):
|
||||
checks = []
|
||||
|
||||
for (bench, ns) in dacapoScalaSanityWarmup.items():
|
||||
if ns[level] > 0:
|
||||
if gateBuildLevel is None or gateBuildLevel in dacapoScalaGateBuildLevels[bench]:
|
||||
checks.append(getScalaDacapo(bench, ['-n', str(ns[level])] + _noneAsEmptyList(dacapoArgs), extraVmArguments=extraVmArguments))
|
||||
|
||||
return checks
|
||||
|
||||
def getScalaDacapo(name, dacapoArgs=None, extraVmArguments=None):
|
||||
dacapo = mx.get_env('DACAPO_SCALA_CP')
|
||||
if dacapo is None:
|
||||
l = mx.library('DACAPO_SCALA', False)
|
||||
if l is not None:
|
||||
dacapo = l.get_path(True)
|
||||
else:
|
||||
mx.abort('Scala DaCapo 0.1.0 jar file must be specified with DACAPO_SCALA_CP environment variable or as DACAPO_SCALA library')
|
||||
|
||||
if not isfile(dacapo) or not dacapo.endswith('.jar'):
|
||||
mx.abort('Specified Scala DaCapo jar file does not exist or is not a jar file: ' + dacapo)
|
||||
|
||||
dacapoSuccess = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====", re.MULTILINE)
|
||||
dacapoFail = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) FAILED (warmup|) =====", re.MULTILINE)
|
||||
dacapoTime = re.compile(r"===== DaCapo 0\.1\.0(-SNAPSHOT)? (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
|
||||
|
||||
dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : "Scala-DaCapo", 'name' : '<benchmark>', 'score' : '<time>'})
|
||||
|
||||
return Test("Scala-DaCapo-" + name, ['-jar', mx._cygpathU2W(dacapo), name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops'] + _noneAsEmptyList(extraVmArguments))
|
||||
|
||||
def getBootstraps():
|
||||
time = re.compile(r"Bootstrapping Graal\.+ in (?P<time>[0-9]+) ms( \(compiled (?P<methods>[0-9]+) methods\))?")
|
||||
scoreMatcher = ValuesMatcher(time, {'group' : 'Bootstrap', 'name' : 'BootstrapTime', 'score' : '<time>'})
|
||||
methodMatcher = ValuesMatcher(time, {'group' : 'Bootstrap', 'name' : 'BootstrapMethods', 'score' : '<methods>'})
|
||||
scoreMatcherBig = ValuesMatcher(time, {'group' : 'Bootstrap-bigHeap', 'name' : 'BootstrapTime', 'score' : '<time>'})
|
||||
methodMatcherBig = ValuesMatcher(time, {'group' : 'Bootstrap-bigHeap', 'name' : 'BootstrapMethods', 'score' : '<methods>'})
|
||||
|
||||
tests = []
|
||||
tests.append(Test("Bootstrap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcher, methodMatcher], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False))
|
||||
tests.append(Test("Bootstrap-bigHeap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcherBig, methodMatcherBig], vmOpts=['-Xms2g'], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False))
|
||||
return tests
|
||||
|
||||
class CTWMode:
|
||||
Full, NoInline = range(2)
|
||||
|
||||
def getCTW(vm, mode):
|
||||
time = re.compile(r"CompileTheWorld : Done \([0-9]+ classes, [0-9]+ methods, (?P<time>[0-9]+) ms\)")
|
||||
scoreMatcher = ValuesMatcher(time, {'group' : 'CompileTheWorld', 'name' : 'CompileTime', 'score' : '<time>'})
|
||||
|
||||
jre = os.environ.get('JAVA_HOME')
|
||||
if exists(join(jre, 'jre')):
|
||||
jre = join(jre, 'jre')
|
||||
rtjar = join(jre, 'lib', 'rt.jar')
|
||||
|
||||
|
||||
args = ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + rtjar]
|
||||
if vm == 'jvmci':
|
||||
args += ['-XX:+BootstrapGraal']
|
||||
if mode >= CTWMode.NoInline:
|
||||
if not mx_graal.isJVMCIEnabled(vm):
|
||||
args.append('-XX:-Inline')
|
||||
else:
|
||||
args.append('-G:CompileTheWordConfig=-Inline')
|
||||
|
||||
return Test("CompileTheWorld", args, successREs=[time], scoreMatchers=[scoreMatcher], benchmarkCompilationRate=False)
|
||||
|
||||
|
||||
class Tee:
|
||||
def __init__(self):
|
||||
self.output = StringIO.StringIO()
|
||||
def eat(self, line):
|
||||
self.output.write(line)
|
||||
sys.stdout.write(line)
|
||||
|
||||
"""
|
||||
Encapsulates a single program that is a sanity test and/or a benchmark.
|
||||
"""
|
||||
class Test:
|
||||
def __init__(self, name, cmd, successREs=None, failureREs=None, scoreMatchers=None, vmOpts=None, defaultCwd=None, ignoredVMs=None, benchmarkCompilationRate=False):
|
||||
|
||||
self.name = name
|
||||
self.successREs = _noneAsEmptyList(successREs)
|
||||
self.failureREs = _noneAsEmptyList(failureREs) + [re.compile(r"Exception occurred in scope: ")]
|
||||
self.scoreMatchers = _noneAsEmptyList(scoreMatchers)
|
||||
self.vmOpts = _noneAsEmptyList(vmOpts)
|
||||
self.cmd = cmd
|
||||
self.defaultCwd = defaultCwd
|
||||
self.ignoredVMs = _noneAsEmptyList(ignoredVMs)
|
||||
self.benchmarkCompilationRate = benchmarkCompilationRate
|
||||
if benchmarkCompilationRate:
|
||||
self.vmOpts = self.vmOpts + ['-XX:+CITime']
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def test(self, vm, cwd=None, extraVmOpts=None, vmbuild=None):
|
||||
"""
|
||||
Run this program as a sanity test.
|
||||
"""
|
||||
if vm in self.ignoredVMs:
|
||||
return True
|
||||
if cwd is None:
|
||||
cwd = self.defaultCwd
|
||||
parser = OutputParser()
|
||||
jvmError = re.compile(r"(?P<jvmerror>([A-Z]:|/).*[/\\]hs_err_pid[0-9]+\.log)")
|
||||
parser.addMatcher(ValuesMatcher(jvmError, {'jvmError' : '<jvmerror>'}))
|
||||
|
||||
for successRE in self.successREs:
|
||||
parser.addMatcher(ValuesMatcher(successRE, {'passed' : '1'}))
|
||||
for failureRE in self.failureREs:
|
||||
parser.addMatcher(ValuesMatcher(failureRE, {'failed' : '1'}))
|
||||
|
||||
tee = Tee()
|
||||
retcode = mx_graal.run_vm(self.vmOpts + _noneAsEmptyList(extraVmOpts) + self.cmd, vm, nonZeroIsFatal=False, out=tee.eat, err=subprocess.STDOUT, cwd=cwd, debugLevel=vmbuild)
|
||||
output = tee.output.getvalue()
|
||||
valueMaps = parser.parse(output)
|
||||
|
||||
if len(valueMaps) == 0:
|
||||
return False
|
||||
|
||||
record = {}
|
||||
for valueMap in valueMaps:
|
||||
for key, value in valueMap.items():
|
||||
if record.has_key(key) and record[key] != value:
|
||||
mx.abort('Inconsistant values returned by test machers : ' + str(valueMaps))
|
||||
record[key] = value
|
||||
|
||||
jvmErrorFile = record.get('jvmError')
|
||||
if jvmErrorFile:
|
||||
mx.log('/!\\JVM Error : dumping error log...')
|
||||
with open(jvmErrorFile, 'rb') as fp:
|
||||
mx.log(fp.read())
|
||||
os.unlink(jvmErrorFile)
|
||||
return False
|
||||
|
||||
if record.get('failed') == '1':
|
||||
return False
|
||||
|
||||
return retcode == 0 and record.get('passed') == '1'
|
||||
|
||||
def bench(self, vm, cwd=None, extraVmOpts=None, vmbuild=None):
|
||||
"""
|
||||
Run this program as a benchmark.
|
||||
"""
|
||||
if vm in self.ignoredVMs:
|
||||
return {}
|
||||
if cwd is None:
|
||||
cwd = self.defaultCwd
|
||||
parser = OutputParser()
|
||||
|
||||
for successRE in self.successREs:
|
||||
parser.addMatcher(ValuesMatcher(successRE, {'passed' : '1'}))
|
||||
for failureRE in self.failureREs:
|
||||
parser.addMatcher(ValuesMatcher(failureRE, {'failed' : '1'}))
|
||||
for scoreMatcher in self.scoreMatchers:
|
||||
parser.addMatcher(scoreMatcher)
|
||||
|
||||
if self.benchmarkCompilationRate:
|
||||
if vm == 'jvmci':
|
||||
bps = re.compile(r"ParsedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
|
||||
ibps = re.compile(r"InlinedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
|
||||
parser.addMatcher(ValuesMatcher(bps, {'group' : 'ParsedBytecodesPerSecond', 'name' : self.name, 'score' : '<rate>'}))
|
||||
parser.addMatcher(ValuesMatcher(ibps, {'group' : 'InlinedBytecodesPerSecond', 'name' : self.name, 'score' : '<rate>'}))
|
||||
else:
|
||||
ibps = re.compile(r"(?P<compiler>[\w]+) compilation speed: +(?P<rate>[0-9]+) bytes/s {standard")
|
||||
parser.addMatcher(ValuesMatcher(ibps, {'group' : 'InlinedBytecodesPerSecond', 'name' : '<compiler>:' + self.name, 'score' : '<rate>'}))
|
||||
|
||||
startDelim = 'START: ' + self.name
|
||||
endDelim = 'END: ' + self.name
|
||||
|
||||
outputfile = os.environ.get('BENCH_OUTPUT', None)
|
||||
if outputfile:
|
||||
# Used only to debug output parsing
|
||||
with open(outputfile) as fp:
|
||||
output = fp.read()
|
||||
start = output.find(startDelim)
|
||||
end = output.find(endDelim, start)
|
||||
if start == -1 and end == -1:
|
||||
return {}
|
||||
output = output[start + len(startDelim + os.linesep): end]
|
||||
mx.log(startDelim)
|
||||
mx.log(output)
|
||||
mx.log(endDelim)
|
||||
else:
|
||||
tee = Tee()
|
||||
mx.log(startDelim)
|
||||
if mx_graal.run_vm(self.vmOpts + _noneAsEmptyList(extraVmOpts) + self.cmd, vm, nonZeroIsFatal=False, out=tee.eat, err=subprocess.STDOUT, cwd=cwd, debugLevel=vmbuild) != 0:
|
||||
mx.abort("Benchmark failed (non-zero retcode)")
|
||||
mx.log(endDelim)
|
||||
output = tee.output.getvalue()
|
||||
|
||||
groups = {}
|
||||
passed = False
|
||||
for valueMap in parser.parse(output):
|
||||
assert (valueMap.has_key('name') and valueMap.has_key('score') and valueMap.has_key('group')) or valueMap.has_key('passed') or valueMap.has_key('failed'), valueMap
|
||||
if valueMap.get('failed') == '1':
|
||||
mx.abort("Benchmark failed")
|
||||
if valueMap.get('passed') == '1':
|
||||
passed = True
|
||||
groupName = valueMap.get('group')
|
||||
if groupName:
|
||||
group = groups.setdefault(groupName, {})
|
||||
name = valueMap.get('name')
|
||||
score = valueMap.get('score')
|
||||
if name and score:
|
||||
group[name] = score
|
||||
|
||||
if not passed:
|
||||
mx.abort("Benchmark failed (not passed)")
|
||||
|
||||
return groups
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user