changeset 10425:b61e946bf0ef

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 20 Jun 2013 01:10:56 +0200
parents e6cf435419b2 (current diff) 1669d8b5863a (diff)
children 2fe8c94089b8
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java
diffstat 7 files changed, 147 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Wed Jun 19 23:50:43 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Jun 20 01:10:56 2013 +0200
@@ -1077,7 +1077,7 @@
             // lowering introduces class constants, therefore it must be after lowering
             ret.getHighTier().appendPhase(new LoadJavaMirrorWithKlassPhase());
             if (VerifyPhases.getValue()) {
-                ret.getHighTier().appendPhase(new AheadOfTimeVerifcationPhase());
+                ret.getHighTier().appendPhase(new AheadOfTimeVerificationPhase());
             }
         }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java	Wed Jun 19 23:50:43 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- */
-package com.oracle.graal.hotspot.phases;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.phases.*;
-
-/**
- * Checking for embedded oops in the graph. (Interned) Strings are an exception as they live in CDS
- * space.
- * 
- * @see LoadJavaMirrorWithKlassPhase
- */
-public class AheadOfTimeVerifcationPhase extends VerifyPhase {
-
-    @Override
-    protected boolean verify(StructuredGraph graph) {
-        for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) {
-            assert !isOop(node) || isNullReference(node) || isString(node) : "embedded oop: " + node;
-        }
-        return true;
-    }
-
-    private static boolean isOop(ConstantNode node) {
-        return node.kind() == Kind.Object;
-    }
-
-    private static boolean isNullReference(ConstantNode node) {
-        return isOop(node) && node.asConstant().asObject() == null;
-    }
-
-    private static boolean isString(ConstantNode node) {
-        return isOop(node) && node.asConstant().asObject() instanceof String;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Thu Jun 20 01:10:56 2013 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+package com.oracle.graal.hotspot.phases;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.phases.*;
+
+/**
+ * Checks for illegal object constants in a graph processed for AOT compilation. The only legal
+ * object constants are {@linkplain String#intern() interned} strings as they will be installed in
+ * the Class Data Sharing (CDS) space.
+ * 
+ * @see LoadJavaMirrorWithKlassPhase
+ */
+public class AheadOfTimeVerificationPhase extends VerifyPhase {
+
+    @Override
+    protected boolean verify(StructuredGraph graph) {
+        for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) {
+            assert !isObject(node) || isNullReference(node) || isInternedString(node) : "illegal object constant: " + node;
+        }
+        return true;
+    }
+
+    private static boolean isObject(ConstantNode node) {
+        return node.kind() == Kind.Object;
+    }
+
+    private static boolean isNullReference(ConstantNode node) {
+        return isObject(node) && node.asConstant().asObject() == null;
+    }
+
+    private static boolean isInternedString(ConstantNode node) {
+        if (!isObject(node)) {
+            return false;
+        }
+
+        Object o = node.asConstant().asObject();
+        if (!(o instanceof String)) {
+            return false;
+        }
+
+        String s = (String) o;
+        return s == s.intern();
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Wed Jun 19 23:50:43 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Thu Jun 20 01:10:56 2013 +0200
@@ -30,16 +30,19 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
 
 /**
- * For AOT compilation we aren't allowed to use a class reference (javaMirror) directly. Instead the
- * class reference should be obtained from the klass object. The reason for this is, that in CDS a
- * klass object is mapped to a fixed address in memory, but the javaMirror is not (which lives in
- * the java heap).
+ * For AOT compilation we aren't allowed to use a {@link Class} reference ({@code javaMirror})
+ * directly. Instead the {@link Class} reference should be obtained from the {@code Klass} object.
+ * The reason for this is, that in Class Data Sharing (CDS) a {@code Klass} object is mapped to a
+ * fixed address in memory, but the {@code javaMirror} is not (which lives in the Java heap).
  * 
- * Lowering can introduce new ConstantNodes containing a class reference, thus this phase must be
- * applied after lowering.
+ * Lowering can introduce new {@link ConstantNode}s containing a {@link Class} reference, thus this
+ * phase must be applied after {@link LoweringPhase}.
+ * 
+ * @see AheadOfTimeVerificationPhase
  */
 public class LoadJavaMirrorWithKlassPhase extends BasePhase<PhaseContext> {
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Jun 19 23:50:43 2013 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Thu Jun 20 01:10:56 2013 +0200
@@ -172,6 +172,9 @@
         for (int i = 0; i < stackSize(); i++) {
             storeStack(i, merge(stackAt(i), other.stackAt(i), block));
         }
+        for (int i = 0; i < locks.length; i++) {
+            locks[i] = merge(locks[i], other.locks[i], block);
+        }
     }
 
     private ValueNode merge(ValueNode currentValue, ValueNode otherValue, MergeNode block) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/SynchronizedLoopExit01.java	Thu Jun 20 01:10:56 2013 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+/*
+ */
+package com.oracle.graal.jtt.threads;
+
+import org.junit.*;
+
+import com.oracle.graal.jtt.*;
+
+/**
+ * Inspired by {@code com.sun.media.sound.DirectAudioDevice$DirectDL.drain()}.
+ * 
+ * Two loop exits hold a monitor while merging.
+ * 
+ */
+public final class SynchronizedLoopExit01 extends JTTTest {
+
+    protected Object object = new Object();
+    protected volatile boolean drained = false;
+    protected volatile boolean someBoolean = true;
+
+    public boolean test() {
+        boolean b = true;
+        while (!drained) {
+            synchronized (object) {
+                boolean c = b = someBoolean;
+                if (c || drained) {
+                    break;
+                }
+            }
+        }
+        return b;
+    }
+
+    @Test
+    public void run0() throws Throwable {
+        runTest("test");
+    }
+
+}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Wed Jun 19 23:50:43 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Thu Jun 20 01:10:56 2013 +0200
@@ -31,6 +31,8 @@
 import com.oracle.graal.graph.Graph.NodeChangedListener;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
@@ -85,6 +87,10 @@
          * @param workingSet the initial working set of nodes on which the canonicalizer works,
          *            should be an auto-grow node bitmap
          * @param customCanonicalizer
+         * @param canonicalizeReads flag to indicate if
+         *            {@link LoadFieldNode#canonical(CanonicalizerTool)} and
+         *            {@link ReadNode#canonical(CanonicalizerTool)} should canonicalize reads of
+         *            constant fields.
          */
         public Instance(MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads, Iterable<Node> workingSet, CustomCanonicalizer customCanonicalizer) {
             this(runtime, assumptions, canonicalizeReads, workingSet, 0, customCanonicalizer);