changeset 8230:d5239d9bbfac

Merge.
author Doug Simon <doug.simon@oracle.com>
date Tue, 12 Mar 2013 17:27:18 +0100
parents 3d33975f6497 (diff) df68f316a4c8 (current diff)
children 9560289a2b3e f58cfb2d004f
files
diffstat 6 files changed, 65 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Tue Mar 12 15:36:27 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Tue Mar 12 17:27:18 2013 +0100
@@ -41,11 +41,6 @@
 
     public static final Descriptor UNWIND_EXCEPTION = new Descriptor("unwindException", true, void.class, Object.class);
 
-    /**
-     * Vtable stubs expect the metaspace Method in RBX.
-     */
-    public static final Register METHOD = AMD64.rbx;
-
     @Use({REG}) protected AllocatableValue exception;
     @Temp private RegisterValue framePointer;
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Mar 12 15:36:27 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Mar 12 17:27:18 2013 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.java;
 
+import static com.oracle.graal.api.code.DeoptimizationAction.*;
+import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.bytecode.Bytecodes.*;
 import static java.lang.reflect.Modifier.*;
 
@@ -279,7 +281,7 @@
      * @param type the unresolved type of the constant
      */
     protected void handleUnresolvedLoadConstant(JavaType type) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.push(Kind.Object, append(ConstantNode.forObject(null, runtime, currentGraph)));
     }
 
@@ -288,7 +290,7 @@
      * @param object the object value whose type is being checked against {@code type}
      */
     protected void handleUnresolvedCheckCast(JavaType type, ValueNode object) {
-        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), DeoptimizationReason.Unresolved, DeoptimizationAction.InvalidateRecompile)));
+        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), Unresolved, InvalidateRecompile)));
         frameState.apush(appendConstant(Constant.NULL_OBJECT));
     }
 
@@ -298,7 +300,7 @@
      */
     protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object) {
         BlockPlaceholderNode successor = currentGraph.add(new BlockPlaceholderNode());
-        DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved));
+        DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved));
         IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 1));
         append(ifNode);
         lastInstr = successor;
@@ -309,7 +311,7 @@
      * @param type the type being instantiated
      */
     protected void handleUnresolvedNewInstance(JavaType type) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.apush(appendConstant(Constant.NULL_OBJECT));
     }
 
@@ -318,7 +320,7 @@
      * @param length the length of the array
      */
     protected void handleUnresolvedNewObjectArray(JavaType type, ValueNode length) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.apush(appendConstant(Constant.NULL_OBJECT));
     }
 
@@ -327,7 +329,7 @@
      * @param dims the dimensions for the multi-array
      */
     protected void handleUnresolvedNewMultiArray(JavaType type, ValueNode[] dims) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.apush(appendConstant(Constant.NULL_OBJECT));
     }
 
@@ -337,7 +339,7 @@
      */
     protected void handleUnresolvedLoadField(JavaField field, ValueNode receiver) {
         Kind kind = field.getKind();
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.push(kind.getStackKind(), append(ConstantNode.defaultForKind(kind, currentGraph)));
     }
 
@@ -347,7 +349,7 @@
      * @param receiver the object containing the field or {@code null} if {@code field} is static
      */
     protected void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
     }
 
     /**
@@ -355,12 +357,12 @@
      * @param type
      */
     protected void handleUnresolvedExceptionType(Representation representation, JavaType type) {
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
     }
 
     protected void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind) {
         boolean withReceiver = invokeKind != InvokeKind.Static;
-        append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
+        append(currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)));
         frameState.popArguments(javaMethod.getSignature().getParameterSlots(withReceiver), javaMethod.getSignature().getParameterCount(withReceiver));
         Kind kind = javaMethod.getSignature().getReturnKind();
         if (kind != Kind.Void) {
@@ -733,8 +735,7 @@
 
     private void genThrow() {
         ValueNode exception = frameState.apop();
-        FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile,
-                        true));
+        FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true));
         append(node);
         append(handleException(exception, bci()));
     }
@@ -1109,7 +1110,7 @@
     private void appendInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args) {
         Kind resultType = targetMethod.getSignature().getReturnKind();
         if (GraalOptions.DeoptALot) {
-            DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint));
+            DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(DeoptimizationAction.None, RuntimeConstraint));
             append(deoptimize);
             frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph));
             return;
@@ -1190,8 +1191,7 @@
         ValueNode local = frameState.loadLocal(localIndex);
         JsrScope scope = currentBlock.jsrScope;
         int retAddress = scope.nextReturnAddress();
-        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forInt(retAddress, currentGraph))), DeoptimizationReason.JavaSubroutineMismatch,
-                        DeoptimizationAction.InvalidateReprofile)));
+        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forInt(retAddress, currentGraph))), JavaSubroutineMismatch, InvalidateReprofile)));
         if (!successor.jsrScope.equals(scope.pop())) {
             throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)");
         }
@@ -1391,7 +1391,7 @@
     private FixedNode createTarget(double probability, Block block, FrameStateBuilder stateAfter) {
         assert probability >= 0 && probability <= 1.01 : probability;
         if (isNeverExecutedCode(probability)) {
-            return currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.UnreachedCode));
+            return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode));
         } else {
             assert block != null;
             return createTarget(block, stateAfter);
@@ -1553,7 +1553,10 @@
     private void createUnwind() {
         assert frameState.stackSize() == 1 : frameState;
         synchronizedEpilogue(FrameState.AFTER_EXCEPTION_BCI);
-        UnwindNode unwindNode = currentGraph.add(new UnwindNode(frameState.apop()));
+        ValueNode exception = frameState.apop();
+        FixedGuardNode guard = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true));
+        append(guard);
+        UnwindNode unwindNode = currentGraph.add(new UnwindNode(exception));
         append(unwindNode);
     }
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Except_Synchronized05.java	Tue Mar 12 15:36:27 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Except_Synchronized05.java	Tue Mar 12 17:27:18 2013 +0100
@@ -29,29 +29,11 @@
 
 public class Except_Synchronized05 extends JTTTest {
 
-    Object field;
-
-    public static int test(int arg) {
-        Except_Synchronized05 obj = new Except_Synchronized05();
-        int a = obj.bar(arg) != null ? 1 : 0;
-        int b = obj.baz(arg) != null ? 1 : 0;
-        return a + b;
-    }
+    static class Foo {
 
-    public synchronized Object bar(int arg) {
-        try {
-            String f = foo1(arg);
-            if (f == null) {
-                field = new Object();
-            }
-        } catch (NullPointerException e) {
-            // do nothing
-        }
-        return field;
-    }
+        Object field;
 
-    public Object baz(int arg) {
-        synchronized (this) {
+        public synchronized Object bar(int arg) {
             try {
                 String f = foo1(arg);
                 if (f == null) {
@@ -62,14 +44,36 @@
             }
             return field;
         }
+
+        public Object baz(int arg) {
+            synchronized (this) {
+                try {
+                    String f = foo1(arg);
+                    if (f == null) {
+                        field = new Object();
+                    }
+                } catch (NullPointerException e) {
+                    // do nothing
+                }
+                return field;
+            }
+        }
+
+        @SuppressWarnings("static-method")
+        private String foo1(int arg) {
+            if (arg == 0) {
+                throw null;
+            }
+            return null;
+        }
+
     }
 
-    @SuppressWarnings("static-method")
-    private String foo1(int arg) {
-        if (arg == 0) {
-            throw null;
-        }
-        return null;
+    public static int test(int arg) {
+        Foo obj = new Foo();
+        int a = obj.bar(arg) != null ? 1 : 0;
+        int b = obj.baz(arg) != null ? 1 : 0;
+        return a + b;
     }
 
     @Test
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Mar 12 15:36:27 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Mar 12 17:27:18 2013 +0100
@@ -1000,6 +1000,17 @@
         return count;
     }
 
+    static MonitorExitNode findPrecedingMonitorExit(UnwindNode unwind) {
+        Node pred = unwind.predecessor();
+        while (pred != null) {
+            if (pred instanceof MonitorExitNode) {
+                return (MonitorExitNode) pred;
+            }
+            pred = pred.predecessor();
+        }
+        return null;
+    }
+
     /**
      * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph.
      * 
@@ -1070,13 +1081,13 @@
         } else {
             if (unwindNode != null) {
                 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
+                MonitorExitNode monitorExit = findPrecedingMonitorExit(unwindDuplicate);
                 DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler);
                 unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode));
                 // move the deopt upwards if there is a monitor exit that tries to use the
                 // "after exception" frame state
                 // (because there is no "after exception" frame state!)
-                if (deoptimizeNode.predecessor() instanceof MonitorExitNode) {
-                    MonitorExitNode monitorExit = (MonitorExitNode) deoptimizeNode.predecessor();
+                if (monitorExit != null) {
                     if (monitorExit.stateAfter() != null && monitorExit.stateAfter().bci == FrameState.AFTER_EXCEPTION_BCI) {
                         FrameState monitorFrameState = monitorExit.stateAfter();
                         graph.removeFixed(monitorExit);
--- a/make/build-graal.xml	Tue Mar 12 15:36:27 2013 +0100
+++ b/make/build-graal.xml	Tue Mar 12 17:27:18 2013 +0100
@@ -34,7 +34,7 @@
 
   <target name="compile">
     <mkdir dir="${classes.dir}"/>
-    <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on">
+    <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on" includeantruntime="false">
       <include name="com.oracle.graal.*/**"/>
       <exclude name="com.oracle.graal.test/**"/>
       <exclude name="com.oracle.graal.*.test/**"/>
--- a/src/cpu/x86/vm/graalRuntime_x86.cpp	Tue Mar 12 15:36:27 2013 +0100
+++ b/src/cpu/x86/vm/graalRuntime_x86.cpp	Tue Mar 12 17:27:18 2013 +0100
@@ -925,19 +925,6 @@
       __ movptr(rsp, rbp);
       __ pop(rbp);
 
-      Label nonNullExceptionOop;
-      __ testptr(rax, rax);
-      __ jcc(Assembler::notZero, nonNullExceptionOop);
-      {
-        __ enter();
-        oop_maps = new OopMapSet();
-        OopMap* oop_map = save_live_registers(sasm, 0);
-        int call_offset = __ call_RT(rax, noreg, (address)create_null_exception, 0);
-        oop_maps->add_gc_map(call_offset, oop_map);
-        __ leave();
-      }
-      __ bind(nonNullExceptionOop);
-
       __ set_info("unwind_exception", dont_gc_arguments);
       // note: no stubframe since we are about to leave the current
       //       activation and we are calling a leaf VM function only.