changeset 14149:cf6092d510c6

merge
author Josef Eisl <josef.eisl@jku.at>
date Wed, 12 Mar 2014 08:57:12 +0100
parents ff423834a2dc (current diff) f97c5ec83832 (diff)
children 38ca365c09ca
files
diffstat 9 files changed, 103 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Tue Mar 11 18:22:31 2014 +0100
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Wed Mar 12 08:57:12 2014 +0100
@@ -36,10 +36,10 @@
 
     @CallerSensitive
     public static GraalRuntime getRuntime() {
-        Class cc = Reflection.getCallerClass();
-        if (cc.getClassLoader() != null) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            Class cc = Reflection.getCallerClass();
+            if (cc.getClassLoader() != null) {
                 sm.checkPermission(ACCESS_PERMISSION);
             }
         }
@@ -52,14 +52,16 @@
         } catch (UnsatisfiedLinkError e) {
             runtime = new InvalidGraalRuntime();
         }
+
+        Reflection.registerFieldsToFilter(Graal.class, "runtime");
     }
 
     @CallerSensitive
     public static <T> T getRequiredCapability(Class<T> clazz) {
-        Class cc = Reflection.getCallerClass();
-        if (cc.getClassLoader() != null) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            Class cc = Reflection.getCallerClass();
+            if (cc.getClassLoader() != null) {
                 sm.checkPermission(ACCESS_PERMISSION);
             }
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Mar 11 18:22:31 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Wed Mar 12 08:57:12 2014 +0100
@@ -61,10 +61,10 @@
      */
     @CallerSensitive
     public static HotSpotGraalRuntime runtime() {
-        Class cc = Reflection.getCallerClass();
-        if (cc != null && cc.getClassLoader() != null) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            Class cc = Reflection.getCallerClass();
+            if (cc != null && cc.getClassLoader() != null) {
                 sm.checkPermission(Graal.ACCESS_PERMISSION);
             }
         }
@@ -73,7 +73,7 @@
     }
 
     static {
-        Reflection.registerFieldsToFilter(HotSpotGraalRuntime.class, new String[]{"instance"});
+        Reflection.registerFieldsToFilter(HotSpotGraalRuntime.class, "instance");
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Mar 11 18:22:31 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Wed Mar 12 08:57:12 2014 +0100
@@ -51,13 +51,8 @@
     private final String name;
     private JavaType type;
     private final int offset;
-    private Constant constant;
 
     /**
-     * The {@linkplain HotSpotResolvedObjectType#getReflectionFieldModifiers() reflection} modifiers
-     * for this field plus the {@link #FIELD_INTERNAL_FLAG} if it applies.
-     */
-    /**
      * This value contains all flags as stored in the VM including internal ones.
      */
     private final int modifiers;
@@ -189,14 +184,12 @@
 
         if (receiver == null) {
             assert isStatic(modifiers);
-            if (constant == null) {
+            if (Modifier.isFinal(getModifiers())) {
                 if (holder.isInitialized() && !holder.getName().equals(SystemClassName) && isEmbeddable()) {
-                    if (Modifier.isFinal(getModifiers())) {
-                        constant = readValue(receiver);
-                    }
+                    return readValue(receiver);
+
                 }
             }
-            return constant;
         } else {
             /*
              * for non-static final fields, we must assume that they are only initialized if they
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Tue Mar 11 18:22:31 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Wed Mar 12 08:57:12 2014 +0100
@@ -30,7 +30,6 @@
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
@@ -94,13 +93,15 @@
 
         for (int i = 0; i < osrState.localsSize(); i++) {
             ValueNode value = osrState.localAt(i);
-            if (value != null) {
+            if (value instanceof ProxyNode) {
                 ProxyNode proxy = (ProxyNode) value;
                 /*
-                 * we need to drop the stamp and go back to the kind since the types we see during
-                 * OSR may be too precise (if a branch was not parsed for example).
+                 * we need to drop the stamp since the types we see during OSR may be too precise
+                 * (if a branch was not parsed for example).
                  */
-                proxy.replaceAndDelete(graph.unique(new OSRLocalNode(i, StampFactory.forKind(proxy.kind()))));
+                proxy.replaceAndDelete(graph.unique(new OSRLocalNode(i, proxy.stamp().unrestricted())));
+            } else {
+                assert value instanceof OSRLocalNode;
             }
         }
 
--- a/make/bsd/makefiles/gcc.make	Tue Mar 11 18:22:31 2014 +0100
+++ b/make/bsd/makefiles/gcc.make	Wed Mar 12 08:57:12 2014 +0100
@@ -321,7 +321,7 @@
     OPT_CFLAGS/unsafe.o += -O1
   endif
   # Clang 5.0
-  ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1)
+  ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& \( $(CC_VER_MINOR) = 0 \| $(CC_VER_MINOR) = 1 \) ), 1)
     OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
     OPT_CFLAGS/unsafe.o += -O1
     OPT_CFLAGS/graalCompilerToVM.o += -O1
--- a/mx/projects	Tue Mar 11 18:22:31 2014 +0100
+++ b/mx/projects	Wed Mar 12 08:57:12 2014 +0100
@@ -7,6 +7,7 @@
 
 library@JUNIT@path=lib/junit-4.8.jar
 library@JUNIT@urls=http://repo1.maven.org/maven2/junit/junit/4.8/junit-4.8.jar
+library@JUNIT@sha1=4150c00c5706306ef0f8f1410e70c8ff12757922
 library@JUNIT@eclipse.container=org.eclipse.jdt.junit.JUNIT_CONTAINER/4
 
 library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar
@@ -17,12 +18,15 @@
 
 library@JACOCOAGENT@path=lib/jacocoagent.jar
 library@JACOCOAGENT@urls=http://lafo.ssw.uni-linz.ac.at/jacoco/jacocoagent.jar
+library@JACOCOAGENT@sha1=9e2c835289356d86afbf31840f05a0f9007c4e44
 
 library@JACOCOREPORT@path=lib/jacocoreport.jar
 library@JACOCOREPORT@urls=http://lafo.ssw.uni-linz.ac.at/jacoco/jacocoreport.jar
+library@JACOCOREPORT@sha1=32fb5ba2f12d86c4feb74bcefc17a4e6fad8a323
 
 library@DACAPO_SCALA@path=lib/dacapo-scala-0.1.0-20120216.jar
 library@DACAPO_SCALA@urls=http://repo.scalabench.org/snapshots/org/scalabench/benchmarks/scala-benchmark-suite/0.1.0-SNAPSHOT/scala-benchmark-suite-0.1.0-20120216.103539-3.jar
+library@DACAPO_SCALA@sha1=59b64c974662b5cf9dbd3cf9045d293853dd7a51
 
 library@OKRA@path=lib/okra-1.8.jar
 library@OKRA@urls=http://cr.openjdk.java.net/~tdeneau/okra-1.8.jar
--- a/mxtool/mx.py	Tue Mar 11 18:22:31 2014 +0100
+++ b/mxtool/mx.py	Wed Mar 12 08:57:12 2014 +0100
@@ -36,6 +36,7 @@
 import sys, os, errno, time, subprocess, shlex, types, urllib2, contextlib, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch
 import textwrap
 import socket
+import hashlib
 import xml.parsers.expat
 import shutil, re, xml.dom.minidom
 import pipes
@@ -341,15 +342,49 @@
                     print >> fp, ap
         return outOfDate
 
+def _download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False):
+    def _download_lib():
+        print 'Downloading ' + ("Sources " if sources else "") + name + ' from ' + str(urls)
+        download(path, urls)
+
+    def _sha1Cached():
+        with open(sha1path, 'r') as f:
+            return f.readline()[0:40]
+
+    def _writesha1Cached():
+        with open(sha1path, 'w') as f:
+            f.write(_sha1OfFile())
+
+    def _sha1OfFile():
+        with open(path, 'r') as f:
+            return hashlib.sha1(f.read()).hexdigest()
+
+
+    if resolve and mustExist and not exists(path):
+        assert not len(urls) == 0, 'cannot find required library ' + name + ' ' + path
+        _download_lib()
+
+    if sha1 and not exists(sha1path):
+        _writesha1Cached()
+
+    if sha1 and sha1 != _sha1Cached():
+        _download_lib()
+        if sha1 != _sha1OfFile():
+            abort("SHA1 does not match for " + name + ". Broken download? SHA1 not updated in projects file?")
+        _writesha1Cached()
+
+    return path
 
 class Library(Dependency):
-    def __init__(self, suite, name, path, mustExist, urls, sourcePath, sourceUrls):
+    def __init__(self, suite, name, path, mustExist, urls, sha1, sourcePath, sourceUrls, sourceSha1):
         Dependency.__init__(self, suite, name)
         self.path = path.replace('/', os.sep)
         self.urls = urls
+        self.sha1 = sha1
         self.mustExist = mustExist
         self.sourcePath = sourcePath
         self.sourceUrls = sourceUrls
+        self.sourceSha1 = sourceSha1
         for url in urls:
             if url.endswith('/') != self.path.endswith(os.sep):
                 abort('Path for dependency directory must have a URL ending with "/": path=' + self.path + ' url=' + url)
@@ -375,14 +410,14 @@
         path = self.path
         if not isabs(path):
             path = join(self.suite.dir, path)
+        sha1path = path + '.sha1'
+
         includedInJDK = getattr(self, 'includedInJDK', None)
         if includedInJDK and java().javaCompliance >= JavaCompliance(includedInJDK):
             return None
-        if resolve and self.mustExist and not exists(path):
-            assert not len(self.urls) == 0, 'cannot find required library ' + self.name + ' ' + path
-            print 'Downloading ' + self.name + ' from ' + str(self.urls)
-            download(path, self.urls)
-        return path
+
+        return _download_file_with_sha1(self.name, path, self.urls, self.sha1, sha1path, resolve, self.mustExist)
+
 
     def get_source_path(self, resolve):
         path = self.sourcePath
@@ -390,10 +425,9 @@
             return None
         if not isabs(path):
             path = join(self.suite.dir, path)
-        if resolve and len(self.sourceUrls) != 0 and not exists(path):
-            print 'Downloading sources for ' + self.name + ' from ' + str(self.sourceUrls)
-            download(path, self.sourceUrls)
-        return path
+        sha1path = path + '.sha1'
+
+        return _download_file_with_sha1(self.name, path, self.sourceUrls, self.sha1, sha1path, resolve, len(self.sourceUrls) != 0, sources=True)
 
     def append_to_classpath(self, cp, resolve):
         path = self.get_path(resolve)
@@ -556,9 +590,11 @@
             path = attrs.pop('path')
             mustExist = attrs.pop('optional', 'false') != 'true'
             urls = pop_list(attrs, 'urls')
+            sha1 = attrs.pop('sha1', None)
             sourcePath = attrs.pop('sourcePath', None)
             sourceUrls = pop_list(attrs, 'sourceUrls')
-            l = Library(self, name, path, mustExist, urls, sourcePath, sourceUrls)
+            sourceSha1 = attrs.pop('sourceSha1', None)
+            l = Library(self, name, path, mustExist, urls, sha1, sourcePath, sourceUrls, sourceSha1)
             l.__dict__.update(attrs)
             self.libs.append(l)
 
@@ -996,6 +1032,7 @@
         self.add_argument('--user-home', help='users home directory', metavar='<path>', default=os.path.expanduser('~'))
         self.add_argument('--java-home', help='bootstrap JDK installation directory (must be JDK 6 or later)', metavar='<path>')
         self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='<name>', default=[])
+        self.add_argument('--kill-with-sigquit', action='store_true', dest='killwithsigquit', help='send sigquit first before killing child processes')
         if get_os() != 'windows':
             # Time outs are (currently) implemented with Unix specific functionality
             self.add_argument('--timeout', help='timeout (in seconds) for command', type=int, default=0, metavar='<secs>')
@@ -1056,10 +1093,10 @@
 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True):
     return run(java().format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd)
 
-def _kill_process_group(pid):
+def _kill_process_group(pid, sig=signal.SIGKILL):
     pgid = os.getpgid(pid)
     try:
-        os.killpg(pgid, signal.SIGKILL)
+        os.killpg(pgid, sig)
         return True
     except:
         log('Error killing subprocess ' + str(pgid) + ': ' + str(sys.exc_info()[1]))
@@ -1427,6 +1464,21 @@
         abort('Property contains an undefined environment variable: ' + value)
     return result
 
+def _send_sigquit():
+    p, args = _currentSubprocess
+
+    def _isJava():
+        if args:
+            name = args[0].split("/")[-1]
+            return name == "java"
+        return False
+
+    if p is not None and _isJava():
+        if get_os() == 'windows':
+            log("mx: implement me! want to send SIGQUIT to my child process")
+        else:
+            _kill_process_group(p.pid, sig=signal.SIGQUIT)
+        time.sleep(0.1)
 
 def abort(codeOrMessage):
     """
@@ -1436,6 +1488,9 @@
     the object's value is printed and the exit status is one.
     """
 
+    if _opts.killwithsigquit:
+        _send_sigquit()
+
     # import traceback
     # traceback.print_stack()
     p, _ = _currentSubprocess
@@ -4030,6 +4085,11 @@
     def term_handler(signum, frame):
         abort(1)
     signal.signal(signal.SIGTERM, term_handler)
+
+    def quit_handler(signum, frame):
+        _send_sigquit()
+    signal.signal(signal.SIGQUIT, quit_handler)
+
     try:
         if opts.timeout != 0:
             def alarm_handler(signum, frame):
--- a/src/share/vm/code/relocInfo.hpp	Tue Mar 11 18:22:31 2014 +0100
+++ b/src/share/vm/code/relocInfo.hpp	Wed Mar 12 08:57:12 2014 +0100
@@ -369,7 +369,7 @@
   // "immediate" in the prefix header word itself.  This optimization
   // is invisible outside this module.)
 
-  inline friend relocInfo prefix_relocInfo(int datalen = 0);
+  inline friend relocInfo prefix_relocInfo(int datalen);
 
  protected:
   // an immediate relocInfo optimizes a prefix with one 10-bit unsigned value
--- a/src/share/vm/compiler/compileBroker.cpp	Tue Mar 11 18:22:31 2014 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Wed Mar 12 08:57:12 2014 +0100
@@ -795,11 +795,6 @@
 #ifdef GRAAL
   GraalCompiler* graal = new GraalCompiler();
 #endif
-#if defined(COMPILERGRAAL) && !defined(TIERED)
-  _compilers[0] = graal;
-  c1_count = 0;
-  c2_count = 0;
-#endif // COMPILERGRAAL && !TIERED
 
 #ifdef COMPILER1
   if (c1_count > 0) {