changeset 15518:fbe9e7088e35

Merge
author Miguel Garcia <miguel.m.garcia@oracle.com>
date Mon, 05 May 2014 21:23:25 +0200
parents 4f603d776ecc (current diff) 77eca555014f (diff)
children f8cf483ba31e a3f897fb3289
files
diffstat 14 files changed, 690 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Mon May 05 17:45:20 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Mon May 05 21:23:25 2014 +0200
@@ -203,7 +203,7 @@
             boxingSnippets.lower((BoxNode) n, tool);
         } else if (n instanceof UnboxNode) {
             boxingSnippets.lower((UnboxNode) n, tool);
-        } else if (n instanceof DeoptimizeNode || n instanceof UnwindNode) {
+        } else if (n instanceof DeoptimizeNode || n instanceof UnwindNode || n instanceof FloatRemNode) {
             /* No lowering, we generate LIR directly for these nodes. */
         } else {
             throw GraalInternalError.shouldNotReachHere("Node implementing Lowerable not handled: " + n);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java	Mon May 05 17:45:20 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java	Mon May 05 21:23:25 2014 +0200
@@ -31,7 +31,7 @@
 import com.oracle.graal.nodes.spi.*;
 
 @NodeInfo(shortName = "%")
-public final class FloatRemNode extends FloatArithmeticNode implements Canonicalizable {
+public class FloatRemNode extends FloatArithmeticNode implements Canonicalizable, Lowerable {
 
     public FloatRemNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) {
         super(stamp, x, y, isStrictFP);
@@ -57,6 +57,11 @@
     }
 
     @Override
+    public void lower(LoweringTool tool) {
+        tool.getLowerer().lower(this, tool);
+    }
+
+    @Override
     public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) {
         builder.setResult(this, gen.emitRem(builder.operand(x()), builder.operand(y()), null));
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Mon May 05 17:45:20 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Mon May 05 21:23:25 2014 +0200
@@ -200,7 +200,7 @@
     private void connectBlocks() {
         for (Block block : reversePostOrder) {
             List<Block> predecessors = new ArrayList<>(4);
-            double probability = 0;
+            double probability = block.getBeginNode() instanceof StartNode ? 1D : 0D;
             for (Node predNode : block.getBeginNode().cfgPredecessors()) {
                 Block predBlock = nodeToBlock.get(predNode);
                 if (predBlock.getId() >= 0) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import java.util.*;
+
+import junit.runner.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+public class GraalJUnitCore {
+
+    /**
+     * Run the tests contained in the classes named in the <code>args</code>. If all tests run
+     * successfully, exit with a status of 0. Otherwise exit with a status of 1. Write feedback
+     * while tests are running and write stack traces for all failed tests after the tests all
+     * complete.
+     *
+     * @param args names of classes in which to find tests to run
+     */
+    public static void main(String... args) {
+        JUnitSystem system = new RealSystem();
+        JUnitCore junitCore = new JUnitCore();
+        system.out().println("GraalJUnitCore");
+        system.out().println("JUnit version " + Version.id());
+        List<Class<?>> classes = new ArrayList<>();
+        List<Failure> missingClasses = new ArrayList<>();
+        boolean verbose = false;
+        boolean enableTiming = false;
+        for (String each : args) {
+            if (each.charAt(0) == '-') {
+                // command line arguments
+                if (each.contentEquals("-JUnitVerbose")) {
+                    verbose = true;
+                } else if (each.contentEquals("-JUnitEnableTiming")) {
+                    enableTiming = true;
+                } else {
+                    system.out().println("Unknown command line argument: " + each);
+                }
+
+            } else {
+                try {
+                    classes.add(Class.forName(each));
+                } catch (ClassNotFoundException e) {
+                    system.out().println("Could not find class: " + each);
+                    Description description = Description.createSuiteDescription(each);
+                    Failure failure = new Failure(description, e);
+                    missingClasses.add(failure);
+                }
+            }
+        }
+        GraalJUnitRunListener graalListener;
+        if (!verbose) {
+            graalListener = new GraalTextListener(system);
+        } else {
+            graalListener = new GraalVerboseTextListener(system);
+        }
+        if (enableTiming) {
+            graalListener = new TimingDecorator(graalListener);
+        }
+        junitCore.addListener(GraalTextListener.createRunListener(graalListener));
+        Result result = junitCore.run(classes.toArray(new Class[0]));
+        for (Failure each : missingClasses) {
+            result.getFailures().add(each);
+        }
+        System.exit(result.wasSuccessful() ? 0 : 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListener.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+public interface GraalJUnitRunListener {
+
+    /**
+     * Called before any tests have been run.
+     *
+     * @param description describes the tests to be run
+     */
+    public void testRunStarted(Description description);
+
+    /**
+     * Called when all tests have finished
+     *
+     * @param result the summary of the test run, including all the tests that failed
+     */
+    public void testRunFinished(Result result);
+
+    /**
+     * Called when a test class is about to be started.
+     *
+     * @param clazz the test class
+     */
+    void testClassStarted(Class<?> clazz);
+
+    /**
+     * Called when all tests of a test class have finished.
+     *
+     * @param clazz the test class
+     */
+    void testClassFinished(Class<?> clazz);
+
+    /**
+     * Called when an atomic test is about to be started. This is also called for ignored tests.
+     *
+     * @param description the description of the test that is about to be run (generally a class and
+     *            method name)
+     */
+    void testStarted(Description description);
+
+    /**
+     * Called when an atomic test has finished, whether the test succeeds, fails or is ignored.
+     *
+     * @param description the description of the test that just ran
+     */
+    void testFinished(Description description);
+
+    /**
+     * Called when an atomic test fails.
+     *
+     * @param failure describes the test that failed and the exception that was thrown
+     */
+    void testFailed(Failure failure);
+
+    /**
+     * Called when a test will not be run, generally because a test method is annotated with
+     * {@link org.junit.Ignore}.
+     *
+     * @param description describes the test that will not be run
+     */
+    public void testIgnored(Description description);
+
+    /**
+     * Called when an atomic test succeeds.
+     *
+     * @param description describes the test that will not be run
+     */
+    void testSucceeded(Description description);
+
+    /**
+     * Called when an atomic test flags that it assumes a condition that is false
+     *
+     * @param failure describes the test that failed and the {@link AssumptionViolatedException}
+     *            that was thrown
+     */
+    public void testAssumptionFailure(Failure failure);
+
+    /**
+     * Called after {@link #testClassFinished(Class)}.
+     */
+    public void testClassFinishedDelimiter();
+
+    /**
+     * Called after {@link #testClassStarted(Class)}
+     */
+    public void testClassStartedDelimiter();
+
+    /**
+     * Called after {@link #testStarted(Description)}
+     */
+    public void testStartedDelimiter();
+
+    /**
+     * Called after {@link #testFailed(Failure)}
+     */
+    public void testFinishedDelimiter();
+
+    public PrintStream getWriter();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListenerDecorator.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import java.io.*;
+
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+public class GraalJUnitRunListenerDecorator implements GraalJUnitRunListener {
+
+    private final GraalJUnitRunListener l;
+
+    public GraalJUnitRunListenerDecorator(GraalJUnitRunListener l) {
+        this.l = l;
+    }
+
+    @Override
+    public void testRunStarted(Description description) {
+        l.testRunStarted(description);
+    }
+
+    @Override
+    public void testRunFinished(Result result) {
+        l.testRunFinished(result);
+    }
+
+    @Override
+    public void testAssumptionFailure(Failure failure) {
+        l.testAssumptionFailure(failure);
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        l.testIgnored(description);
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        l.testClassStarted(clazz);
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz) {
+        l.testClassFinished(clazz);
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        l.testStarted(description);
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        l.testFinished(description);
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        l.testFailed(failure);
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+        l.testSucceeded(description);
+    }
+
+    @Override
+    public PrintStream getWriter() {
+        return l.getWriter();
+    }
+
+    public void testClassFinishedDelimiter() {
+        l.testClassFinishedDelimiter();
+    }
+
+    public void testClassStartedDelimiter() {
+        l.testClassStartedDelimiter();
+    }
+
+    public void testStartedDelimiter() {
+        l.testStartedDelimiter();
+    }
+
+    public void testFinishedDelimiter() {
+        l.testFinishedDelimiter();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTextListener.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+public class GraalTextListener implements GraalJUnitRunListener {
+
+    private final PrintStream fWriter;
+
+    public GraalTextListener(JUnitSystem system) {
+        this(system.out());
+    }
+
+    public GraalTextListener(PrintStream writer) {
+        fWriter = writer;
+    }
+
+    @Override
+    public PrintStream getWriter() {
+        return fWriter;
+    }
+
+    @Override
+    public void testRunStarted(Description description) {
+    }
+
+    @Override
+    public void testRunFinished(Result result) {
+    }
+
+    @Override
+    public void testAssumptionFailure(Failure failure) {
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz) {
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        getWriter().print('.');
+    }
+
+    @Override
+    public void testFinished(Description description) {
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        getWriter().print('E');
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        getWriter().print('I');
+    }
+
+    @Override
+    public void testClassFinishedDelimiter() {
+    }
+
+    @Override
+    public void testClassStartedDelimiter() {
+    }
+
+    @Override
+    public void testStartedDelimiter() {
+    }
+
+    @Override
+    public void testFinishedDelimiter() {
+    }
+
+    public static RunListener createRunListener(GraalJUnitRunListener l) {
+        return new TextListener(l.getWriter()) {
+            private Class<?> lastClass;
+            private boolean failed;
+
+            @Override
+            public final void testStarted(Description description) {
+                Class<?> currentClass = description.getTestClass();
+                if (currentClass != lastClass) {
+                    if (lastClass != null) {
+                        l.testClassFinished(lastClass);
+                        l.testClassFinishedDelimiter();
+                    }
+                    lastClass = currentClass;
+                    l.testClassStarted(currentClass);
+                    l.testClassStartedDelimiter();
+                }
+                failed = false;
+                l.testStarted(description);
+                l.testStartedDelimiter();
+            }
+
+            @Override
+            public final void testFailure(Failure failure) {
+                failed = true;
+                l.testFailed(failure);
+            }
+
+            @Override
+            public final void testFinished(Description description) {
+                // we have to do this because there is no callback for successful tests
+                if (!failed) {
+                    l.testSucceeded(description);
+                }
+                l.testFinished(description);
+                l.testFinishedDelimiter();
+            }
+
+            @Override
+            public void testIgnored(Description description) {
+                l.testStarted(description);
+                l.testStartedDelimiter();
+                l.testIgnored(description);
+                l.testFinished(description);
+                l.testFinishedDelimiter();
+            }
+
+            @Override
+            public void testRunStarted(Description description) {
+                l.testRunStarted(description);
+            }
+
+            @Override
+            public void testRunFinished(Result result) {
+                if (lastClass != null) {
+                    l.testClassFinished(lastClass);
+                }
+                l.testRunFinished(result);
+                super.testRunFinished(result);
+            }
+
+            @Override
+            public void testAssumptionFailure(Failure failure) {
+                l.testAssumptionFailure(failure);
+            }
+
+        };
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+public class GraalVerboseTextListener extends GraalTextListener {
+
+    public GraalVerboseTextListener(JUnitSystem system) {
+        this(system.out());
+    }
+
+    public GraalVerboseTextListener(PrintStream writer) {
+        super(writer);
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        getWriter().print(clazz.getName() + " started");
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz) {
+        getWriter().print(clazz.getName() + " finished");
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        getWriter().print("  " + description.getMethodName() + ": ");
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        getWriter().print("Ignored");
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+        getWriter().print("Passed");
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        getWriter().print("FAILED");
+    }
+
+    @Override
+    public void testClassFinishedDelimiter() {
+        getWriter().println();
+    }
+
+    @Override
+    public void testClassStartedDelimiter() {
+        getWriter().println();
+    }
+
+    @Override
+    public void testFinishedDelimiter() {
+        getWriter().println();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/TimingDecorator.java	Mon May 05 21:23:25 2014 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, 2014, 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.test;
+
+import org.junit.runner.*;
+
+/**
+ * Timing support for JUnit test runs.
+ */
+public class TimingDecorator extends GraalJUnitRunListenerDecorator {
+
+    private long startTime;
+    private long classStartTime;
+
+    public TimingDecorator(GraalJUnitRunListener l) {
+        super(l);
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        classStartTime = System.nanoTime();
+        super.testClassStarted(clazz);
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz) {
+        long totalTime = System.nanoTime() - classStartTime;
+        super.testClassFinished(clazz);
+        getWriter().print(' ' + valueToString(totalTime));
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        startTime = System.nanoTime();
+        super.testStarted(description);
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        long totalTime = System.nanoTime() - startTime;
+        super.testFinished(description);
+        getWriter().print(" " + valueToString(totalTime));
+    }
+
+    private static String valueToString(long value) {
+        return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10);
+    }
+
+}
--- a/mx/JUnitWrapper.java	Mon May 05 17:45:20 2014 +0200
+++ b/mx/JUnitWrapper.java	Mon May 05 21:23:25 2014 +0200
@@ -27,8 +27,7 @@
  * linux [depending on the settings]: ~2097k)
  * see http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx
  */
-
-import org.junit.runner.*;
+import com.oracle.graal.test.*;
 import java.io.*;
 import java.util.*;
 
@@ -44,6 +43,10 @@
             System.exit(1);
         }
         ArrayList<String> tests = new ArrayList<String>(1000);
+        // add JUnit command line arguments
+        for (int i = 1; i < args.length; i++) {
+            tests.add(args[i]);
+        }
         BufferedReader br = null;
         try {
             br = new BufferedReader(new FileReader(args[0]));
@@ -72,6 +75,6 @@
         } else {
             System.out.printf("executing junit tests now... (%d test classes)\n", strargs.length);
         }
-        JUnitCore.main(strargs);
+        GraalJUnitCore.main(strargs);
     }
 }
--- a/mx/mx_graal.py	Mon May 05 17:45:20 2014 +0200
+++ b/mx/mx_graal.py	Mon May 05 21:23:25 2014 +0200
@@ -946,7 +946,7 @@
         f_testfile.close()
         harness(projectscp, vmArgs)
 
-def _unittest(args, annotations, prefixcp="", whitelist=None):
+def _unittest(args, annotations, prefixcp="", whitelist=None, verbose=False, enable_timing=False):
     mxdir = dirname(__file__)
     name = 'JUnitWrapper'
     javaSource = join(mxdir, name + '.java')
@@ -955,6 +955,12 @@
     if testfile is None:
         (_, testfile) = tempfile.mkstemp(".testclasses", "graal")
         os.close(_)
+    corecp = mx.classpath(['com.oracle.graal.test'])
+    coreArgs = []
+    if verbose:
+        coreArgs.append('-JUnitVerbose')
+    if enable_timing:
+        coreArgs.append('-JUnitEnableTiming')
 
     def harness(projectscp, vmArgs):
         if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
@@ -968,9 +974,9 @@
         if len(testclasses) == 1:
             # Execute Junit directly when one test is being run. This simplifies
             # replaying the VM execution in a native debugger (e.g., gdb).
-            vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp, 'org.junit.runner.JUnitCore'] + testclasses)
+            vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp, 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses)
         else:
-            vm(prefixArgs + vmArgs + ['-cp', prefixcp + projectscp + os.pathsep + mxdir, name] + [testfile])
+            vm(prefixArgs + vmArgs + ['-cp', prefixcp + corecp + ':' + projectscp + os.pathsep + mxdir, name] + [testfile] + coreArgs)
 
     try:
         _run_tests(args, harness, annotations, testfile, whitelist)
@@ -983,6 +989,8 @@
 
       --whitelist            run only testcases which are included
                              in the given whitelist
+      --verbose              enable verbose JUnit output
+      --enable-timing        enable JUnit test timing
 
     To avoid conflicts with VM options '--' can be used as delimiter.
 
@@ -1020,6 +1028,8 @@
           epilog=_unittestHelpSuffix,
         )
     parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>')
+    parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true')
+    parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true')
 
     ut_args = []
     delimiter = False
@@ -1046,7 +1056,7 @@
         except IOError:
             mx.log('warning: could not read whitelist: ' + parsed_args.whitelist)
 
-    _unittest(args, ['@Test', '@Parameters'], whitelist=whitelist)
+    _unittest(args, ['@Test', '@Parameters'], whitelist=whitelist, verbose=parsed_args.verbose, enable_timing=parsed_args.enable_timing)
 
 def shortunittest(args):
     """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'{0}"""
@@ -1158,12 +1168,12 @@
 
     with VM('server', 'product'):  # hosted mode
         t = Task('UnitTests:hosted-product')
-        unittest([])
+        unittest(['--enable-timing', '--verbose'])
         tasks.append(t.stop())
 
     with VM('server', 'product'):  # hosted mode
         t = Task('UnitTests-BaselineCompiler:hosted-product')
-        unittest(['--whitelist', 'test/whitelist_baseline.txt', '-G:+UseBaselineCompiler'])
+        unittest(['--enable-timing', '--verbose', '--whitelist', 'test/whitelist_baseline.txt', '-G:+UseBaselineCompiler'])
         tasks.append(t.stop())
 
     for vmbuild in ['fastdebug', 'product']:
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon May 05 17:45:20 2014 +0200
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Mon May 05 21:23:25 2014 +0200
@@ -107,10 +107,6 @@
   return Address(rsp,  Interpreter::expr_offset_in_bytes(2));
 }
 
-static inline Address at_tos_p3() {
-  return Address(rsp,  Interpreter::expr_offset_in_bytes(3));
-}
-
 // Condition conversion
 static Assembler::Condition j_not(TemplateTable::Condition cc) {
   switch (cc) {
--- a/src/share/vm/prims/jvmtiTagMap.cpp	Mon May 05 17:45:20 2014 +0200
+++ b/src/share/vm/prims/jvmtiTagMap.cpp	Mon May 05 21:23:25 2014 +0200
@@ -2790,6 +2790,7 @@
   return true;
 }
 
+#ifdef ASSERT
 // verify that a static oop field is in range
 static inline bool verify_static_oop(InstanceKlass* ik,
                                      oop mirror, int offset) {
@@ -2804,6 +2805,7 @@
     return false;
   }
 }
+#endif // #ifdef ASSERT
 
 // a class references its super class, interfaces, class loader, ...
 // and finally its static fields
--- a/src/share/vm/runtime/mutex.cpp	Mon May 05 17:45:20 2014 +0200
+++ b/src/share/vm/runtime/mutex.cpp	Mon May 05 21:23:25 2014 +0200
@@ -280,16 +280,6 @@
   return x & 0x7FFFFFFF ;
 }
 
-static inline jint MarsagliaXOR (jint * const a) {
-  jint x = *a ;
-  if (x == 0) x = UNS(a)|1 ;
-  x ^= x << 6;
-  x ^= ((unsigned)x) >> 21;
-  x ^= x << 7 ;
-  *a = x ;
-  return x & 0x7FFFFFFF ;
-}
-
 static int Stall (int its) {
   static volatile jint rv = 1 ;
   volatile int OnFrame = 0 ;