changeset 17397:0c8442b0d4c4

Merge.
author Doug Simon <doug.simon@oracle.com>
date Thu, 09 Oct 2014 16:30:49 +0200
parents 83bbc0e5891a (diff) e890b86b397d (current diff)
children 9e1ec84d2899
files
diffstat 7 files changed, 72 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Thu Oct 09 14:44:19 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Thu Oct 09 16:30:49 2014 +0200
@@ -283,7 +283,7 @@
                             }
                         } catch (Throwable t) {
                             // If something went wrong during pre-loading we just ignore it.
-                            println("Preloading failed for (%d) %s", classFileCounter, className);
+                            println("Preloading failed for (%d) %s: %s", classFileCounter, className, t);
                         }
 
                         // Are we compiling this class?
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu Oct 09 14:44:19 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu Oct 09 16:30:49 2014 +0200
@@ -1149,6 +1149,10 @@
     @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
     @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
 
+    @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
+
     @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
 
     @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Thu Oct 09 14:44:19 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Thu Oct 09 16:30:49 2014 +0200
@@ -65,23 +65,53 @@
         InvokeDynamic(config().jvmConstantInvokeDynamic);
         // @formatter:on
 
-        private final int value;
+        private final int tag;
 
-        private JVM_CONSTANT(int value) {
-            this.value = value;
+        private static final int ExternalMax = config().jvmConstantExternalMax;
+        private static final int InternalMin = config().jvmConstantInternalMin;
+        private static final int InternalMax = config().jvmConstantInternalMax;
+
+        private JVM_CONSTANT(int tag) {
+            this.tag = tag;
         }
 
         private static HotSpotVMConfig config() {
             return runtime().getConfig();
         }
 
-        public static JVM_CONSTANT getEnum(int value) {
-            for (JVM_CONSTANT e : values()) {
-                if (e.value == value) {
-                    return e;
+        /**
+         * Maps JVM_CONSTANT tags to {@link JVM_CONSTANT} values. Using a separate class for lazy
+         * initialization.
+         */
+        static class TagValueMap {
+            private static final JVM_CONSTANT[] table = new JVM_CONSTANT[ExternalMax + 1 + (InternalMax - InternalMin) + 1];
+            static {
+                assert InternalMin > ExternalMax;
+                for (JVM_CONSTANT e : values()) {
+                    table[indexOf(e.tag)] = e;
                 }
             }
-            throw GraalInternalError.shouldNotReachHere("unknown enum value " + value);
+
+            private static int indexOf(int tag) {
+                if (tag >= InternalMin) {
+                    return tag - InternalMin + ExternalMax + 1;
+                } else {
+                    assert tag <= ExternalMax;
+                }
+                return tag;
+            }
+
+            static JVM_CONSTANT get(int tag) {
+                JVM_CONSTANT res = table[indexOf(tag)];
+                if (res != null) {
+                    return res;
+                }
+                throw GraalInternalError.shouldNotReachHere("unknown JVM_CONSTANT tag " + tag);
+            }
+        }
+
+        public static JVM_CONSTANT getEnum(int tag) {
+            return TagValueMap.get(tag);
         }
     }
 
@@ -168,6 +198,9 @@
         HotSpotVMConfig config = runtime().getConfig();
         final long metaspaceConstantPoolTags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset);
         final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index);
+        if (tag == 0) {
+            return null;
+        }
         return JVM_CONSTANT.getEnum(tag);
     }
 
@@ -505,6 +538,10 @@
         }
 
         JVM_CONSTANT tag = getTagAt(index);
+        if (tag == null) {
+            assert getTagAt(index - 1) == JVM_CONSTANT.Double || getTagAt(index - 1) == JVM_CONSTANT.Long;
+            return;
+        }
         switch (tag) {
             case Fieldref:
             case MethodRef:
@@ -524,14 +561,19 @@
                 }
                 break;
             case InvokeDynamic:
-                if (!isInvokedynamicIndex(cpi)) {
-                    throw new IllegalArgumentException("InvokeDynamic entries must be accessed");
+                if (isInvokedynamicIndex(cpi)) {
+                    runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi);
                 }
-                runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi);
                 break;
             default:
                 // nothing
                 break;
         }
     }
+
+    @Override
+    public String toString() {
+        HotSpotResolvedObjectType holder = getHolder();
+        return "HotSpotConstantPool<" + holder.toJavaName() + ">";
+    }
 }
--- a/mx/mx_graal.py	Thu Oct 09 14:44:19 2014 +0200
+++ b/mx/mx_graal.py	Thu Oct 09 16:30:49 2014 +0200
@@ -1370,13 +1370,15 @@
         vmargs.append('-G:CompileTheWorldConfig=' + args.ctwopts)
 
     if args.jar:
-        jar = args.jar
+        jar = os.path.abspath(args.jar)
     else:
         jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar')
 
-    vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + jar]
+    vmargs += ['-XX:+CompileTheWorld']
     if _get_vm() == 'graal':
-        vmargs += ['-XX:+BootstrapGraal']
+        vmargs += ['-XX:+BootstrapGraal', '-G:CompileTheWorldClasspath=' + jar]
+    else:
+        vmargs += ['-Xbootclasspath/p:' + jar]
     vm(vmargs)
 
 def _basic_gate_body(args, tasks):
--- a/mx/suite.py	Thu Oct 09 14:44:19 2014 +0200
+++ b/mx/suite.py	Thu Oct 09 16:30:49 2014 +0200
@@ -1,5 +1,3 @@
-from suite_helper import maven
-
 suite = {
   "mxversion" : "1.0",
   "name" : "graal",
@@ -8,14 +6,14 @@
       "path" : "lib/junit-4.11.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/junit-4.11.jar",
-        maven("junit/junit/4.11/junit-4.11.jar"),
+        "https://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.jar",
       ],
       "sha1" : "4e031bb61df09069aeb2bffb4019e7a5034a4ee0",
       "eclipse.container" : "org.eclipse.jdt.junit.JUNIT_CONTAINER/4",
       "sourcePath" : "lib/junit-4.11-sources.jar",
       "sourceUrls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/junit-4.11-sources.jar",
-        maven("junit/junit/4.11/junit-4.11-sources.jar"),
+        "https://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11-sources.jar",
       ],
       "sourceSha1" : "28e0ad201304e4a4abf999ca0570b7cffc352c3c",
       "dependencies" : ["HAMCREST"],
@@ -25,13 +23,13 @@
       "path" : "lib/hamcrest-core-1.3.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/hamcrest-core-1.3.jar",
-        maven("org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"),
+        "https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
       ],
       "sha1" : "42a25dc3219429f0e5d060061f71acb49bf010a0",
       "sourcePath" : "lib/hamcrest-core-1.3-sources.jar",
       "sourceUrls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/hamcrest-core-1.3-sources.jar",
-        maven("org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"),
+        "https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar",
       ],
       "sourceSha1" : "1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b",
     },
@@ -136,14 +134,14 @@
       "path" : "lib/asm-5.0.3.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-5.0.3.jar",
-        maven("org/ow2/asm/asm/5.0.3/asm-5.0.3.jar"),
+        "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm/5.0.3/asm-5.0.3.jar",
       ],
       "sha1" : "dcc2193db20e19e1feca8b1240dbbc4e190824fa",
       "sourcePath" : "lib/asm-5.0.3-sources.jar",
       "sourceSha1" : "f0f24f6666c1a15c7e202e91610476bd4ce59368",
       "sourceUrls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-5.0.3-sources.jar",
-        maven("org/ow2/asm/asm/5.0.3/asm-5.0.3-sources.jar"),
+        "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm/5.0.3/asm-5.0.3-sources.jar",
       ],
     },
 
@@ -159,7 +157,7 @@
       "path" : "lib/vecmath-1.3.1.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/vecmath-1.3.1.jar",
-        maven("java3d/vecmath/1.3.1/vecmath-1.3.1.jar"),
+        "https://search.maven.org/remotecontent?filepath=java3d/vecmath/1.3.1/vecmath-1.3.1.jar",
       ],
       "sha1" : "a0ae4f51da409fa0c20fa0ca59e6bbc9413ae71d",
     }
--- a/mx/suite_helper.py	Thu Oct 09 14:44:19 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-def maven(filepath):
-    return 'https://search.maven.org/remotecontent?filepath=%s' % filepath
--- a/mxtool/mx.py	Thu Oct 09 14:44:19 2014 +0200
+++ b/mxtool/mx.py	Thu Oct 09 16:30:49 2014 +0200
@@ -896,8 +896,8 @@
         # For now fail fast if extra modules were loaded.
         # This can later be relaxed to simply remove the extra modules
         # from the sys.modules name space if necessary.
-        extraModules = snapshot - sys.modules.viewkeys()
-        assert len(extraModules) == 0, 'loading ' + modulePath + ' caused extra modules to be loaded: ' + ', '.join([m.__file__ for m in extraModules])
+        extraModules = sys.modules.viewkeys() - snapshot
+        assert len(extraModules) == 0, 'loading ' + modulePath + ' caused extra modules to be loaded: ' + ', '.join([m for m in extraModules])
 
         # revert the Python path
         del sys.path[0]