Mercurial > hg > graal-compiler
changeset 22040:0751fdae4e7a
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 20 Jun 2015 09:00:58 +0200 |
parents | 3e7ab72bac96 (diff) 1f07c19e7d83 (current diff) |
children | 56c50504d60d |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java mx.graal/suite.py |
diffstat | 7 files changed, 123 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sat Jun 20 01:56:43 2015 +0200 +++ b/.hgignore Sat Jun 20 09:00:58 2015 +0200 @@ -3,7 +3,6 @@ ^build-nojvmci/ ^dist/ ^java/ -^lib/ ^jdk1.(7|8).0 ^java64/ ^work/ @@ -62,6 +61,7 @@ ^tags syntax: glob +lib currentAnnotationProcessors ecj.jar jmh
--- a/graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java Sat Jun 20 01:56:43 2015 +0200 +++ b/graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java Sat Jun 20 09:00:58 2015 +0200 @@ -48,9 +48,14 @@ NativeFunctionInterfaceAccess access = null; Class<?> servicesClass = null; try { - servicesClass = Class.forName("com.oracle.jvmci.service.Services"); + servicesClass = Class.forName("jdk.internal.jvmci.service.Services"); } catch (ClassNotFoundException e) { - // JVMCI is unavailable + try { + // Legacy support + servicesClass = Class.forName("com.oracle.jvmci.service.Services"); + } catch (ClassNotFoundException e2) { + // JVMCI is unavailable + } } if (servicesClass != null) { try {
--- a/mx.graal/mx_graal.py Sat Jun 20 01:56:43 2015 +0200 +++ b/mx.graal/mx_graal.py Sat Jun 20 09:00:58 2015 +0200 @@ -30,12 +30,14 @@ from os.path import join, exists, dirname, basename from argparse import ArgumentParser, REMAINDER from outputparser import OutputParser, ValuesMatcher -import mx -import mx_unittest import xml.dom.minidom import sanitycheck import itertools import json, textwrap + +import mx +import mx_unittest +import mx_findbugs import mx_graal_makefile _suite = mx.suite('graal') @@ -1523,7 +1525,7 @@ t.abort('Checkheaders warnings were found') with Task('FindBugs', tasks) as t: - if t and findbugs([]) != 0: + if t and mx_findbugs.findbugs([]) != 0: t.abort('FindBugs warnings were found') if exists('jacoco.exec'): @@ -2254,43 +2256,6 @@ valueMap = parser.parse(output.getvalue()) return valueMap -def findbugs(args): - '''run FindBugs against non-test Java projects''' - findBugsHome = mx.get_env('FINDBUGS_HOME', None) - if findBugsHome: - findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar') - else: - findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0') - if not exists(findbugsLib): - tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home) - try: - findbugsDist = mx.library('FINDBUGS_DIST').get_path(resolve=True) - with zipfile.ZipFile(findbugsDist) as zf: - candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')] - assert len(candidates) == 1, candidates - libDirInZip = os.path.dirname(candidates[0]) - zf.extractall(tmp) - shutil.copytree(join(tmp, libDirInZip), findbugsLib) - finally: - shutil.rmtree(tmp) - findbugsJar = join(findbugsLib, 'findbugs.jar') - assert exists(findbugsJar) - nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] - outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects]) - javaCompliance = max([p.javaCompliance for p in nonTestProjects]) - findbugsResults = join(_graal_home, 'findbugs.results') - - cmd = ['-jar', mx._cygpathU2W(findbugsJar), '-textui', '-low', '-maxRank', '15'] - if mx.is_interactive(): - cmd.append('-progress') - cmd = cmd + ['-auxclasspath', mx._separatedCygpathU2W(mx.classpath([d.name for d in _jdkDeployedDists] + [p.name for p in nonTestProjects])), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs - exitcode = mx.run_java(cmd, nonZeroIsFatal=False, javaConfig=mx.java(javaCompliance)) - if exitcode != 0: - with open(findbugsResults) as fp: - mx.log(fp.read()) - os.unlink(findbugsResults) - return exitcode - def checkheaders(args): """check Java source headers against any required pattern""" failures = {} @@ -2333,7 +2298,6 @@ 'clean': [clean, ''], 'ctw': [ctw, '[-vmoptions|noinline|nocomplex|full]'], 'export': [export, '[-options] [zipfile]'], - 'findbugs': [findbugs, ''], 'generateZshCompletion' : [generateZshCompletion, ''], 'hsdis': [hsdis, '[att]'], 'hcfdis': [hcfdis, ''],
--- a/mx.graal/suite.py Sat Jun 20 01:56:43 2015 +0200 +++ b/mx.graal/suite.py Sat Jun 20 09:00:58 2015 +0200 @@ -61,15 +61,6 @@ "sha1" : "bc8b2253436485e9dbaf81771c259ccfa1a24c80", }, - "FINDBUGS_DIST" : { - "path" : "lib/findbugs-dist-3.0.0.zip", - "urls" : [ - "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/findbugs-3.0.0.zip", - "http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.zip/download", - ], - "sha1" : "6e56d67f238dbcd60acb88a81655749aa6419c5b", - }, - "C1VISUALIZER_DIST" : { "path" : "lib/c1visualizer_2014-04-22.zip", "urls" : ["https://java.net/downloads/c1visualizer/c1visualizer_2014-04-22.zip"],
--- a/mxtool/mx.mx/suite.py Sat Jun 20 01:56:43 2015 +0200 +++ b/mxtool/mx.mx/suite.py Sat Jun 20 09:00:58 2015 +0200 @@ -5,6 +5,15 @@ # ------------- Libraries ------------- + "MX_FINDBUGS_DIST" : { + "path" : "lib/findbugs-dist-3.0.0.zip", + "urls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/findbugs-3.0.0.zip", + "http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.zip/download", + ], + "sha1" : "6e56d67f238dbcd60acb88a81655749aa6419c5b", + }, + "MX_JUNIT" : { "path" : "lib/junit-4.11.jar", "urls" : [
--- a/mxtool/mx.py Sat Jun 20 01:56:43 2015 +0200 +++ b/mxtool/mx.py Sat Jun 20 09:00:58 2015 +0200 @@ -47,12 +47,14 @@ import shutil, re, xml.dom.minidom import pipes import difflib -import mx_unittest from collections import Callable from threading import Thread from argparse import ArgumentParser, REMAINDER from os.path import join, basename, dirname, exists, getmtime, isabs, expandvars, isdir, isfile +import mx_unittest +import mx_findbugs + try: # needed to work around https://bugs.python.org/issue1927 import readline @@ -1844,7 +1846,7 @@ def _format_commands(): msg = '\navailable commands:\n\n' - for cmd in sorted(_commands.iterkeys()): + for cmd in sorted([k for k in _commands.iterkeys() if ':' not in k]) + sorted([k for k in _commands.iterkeys() if ':' in k]): c, _ = _commands[cmd][:2] doc = c.__doc__ if doc is None: @@ -5672,9 +5674,22 @@ def update_commands(suite, new_commands): for key, value in new_commands.iteritems(): - if _commands.has_key(key): - warn("redefining command '" + key + "' in suite " + suite.name) + assert ':' not in key + old = _commands.get(key) + if old is not None: + oldSuite = _commandsToSuite.get(key) + if not oldSuite: + # Core mx command is overridden by first suite + # defining command of same name. The core mx + # command has its name prefixed with ':'. + _commands[':' + key] = old + else: + # Previously specified command from another suite + # is not overridden. Instead, the new command + # has a name qualified by the suite name. + key = suite.name + ':' + key _commands[key] = value + _commandsToSuite[key] = suite def warn(msg): if _warn: @@ -5682,7 +5697,7 @@ # Table of commands in alphabetical order. # Keys are command names, value are lists: [<function>, <usage msg>, <format args to doc string of function>...] -# If any of the format args are instances of Callable, then they are called with an 'env' are before being +# If any of the format args are instances of Callable, then they are called before being # used in the call to str.format(). # Suite extensions should not update this table directly, but use update_commands _commands = { @@ -5695,6 +5710,7 @@ 'eclipseinit': [eclipseinit, ''], 'eclipseformat': [eclipseformat, ''], 'exportlibs': [exportlibs, ''], + 'findbugs': [mx_findbugs.findbugs, ''], 'findclass': [findclass, ''], 'fsckprojects': [fsckprojects, ''], 'help': [help_, '[command]'], @@ -5712,6 +5728,7 @@ 'projects': [show_projects, ''], 'unittest' : [mx_unittest.unittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], } +_commandsToSuite = {} _argParser = ArgParser()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/mx_findbugs.py Sat Jun 20 09:00:58 2015 +0200 @@ -0,0 +1,79 @@ +#!/usr/bin/env python2.7 +# +# ---------------------------------------------------------------------------------------------------- +# +# 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 +import os +import tempfile +import zipfile +import shutil +from os.path import join, exists + +def defaultFindbugsArgs(): + args = ['-textui', '-low', '-maxRank', '15'] + if mx.is_interactive(): + args.append('-progress') + return args + +def findbugs(args, fbArgs=None, suite=None, projects=None): + """run FindBugs against non-test Java projects""" + findBugsHome = mx.get_env('FINDBUGS_HOME', None) + if suite is None: + suite = mx._primary_suite + if findBugsHome: + findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar') + else: + findbugsLib = join(mx._mx_suite.dir, 'lib', 'findbugs-3.0.0') + if not exists(findbugsLib): + tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=mx._mx_suite.dir) + try: + findbugsDist = mx.library('MX_FINDBUGS_DIST').get_path(resolve=True) + with zipfile.ZipFile(findbugsDist) as zf: + candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')] + assert len(candidates) == 1, candidates + libDirInZip = os.path.dirname(candidates[0]) + zf.extractall(tmp) + shutil.copytree(join(tmp, libDirInZip), findbugsLib) + finally: + shutil.rmtree(tmp) + findbugsJar = join(findbugsLib, 'findbugs.jar') + assert exists(findbugsJar) + nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] + outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects]) + javaCompliance = max([p.javaCompliance for p in nonTestProjects]) + findbugsResults = join(suite.dir, 'findbugs.results') + + if fbArgs is None: + fbArgs = defaultFindbugsArgs() + cmd = ['-jar', mx._cygpathU2W(findbugsJar)] + fbArgs + cmd = cmd + ['-auxclasspath', mx._separatedCygpathU2W(mx.classpath([p.name for p in nonTestProjects])), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs + exitcode = mx.run_java(cmd, nonZeroIsFatal=False, javaConfig=mx.java(javaCompliance)) + if exitcode != 0: + with open(findbugsResults) as fp: + mx.log(fp.read()) + os.unlink(findbugsResults) + return exitcode