diff graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java @ 10030:85f926430ae6

Test deoptimization in DynamicNewArrayNode.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 13 Jun 2013 13:50:29 +0200
parents 6e4b72bcc97f
children 74cbc5d6e38f
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Jun 13 13:19:56 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Jun 13 13:50:29 2013 +0200
@@ -358,7 +358,7 @@
         test(method, expect, Collections.<DeoptimizationReason> emptySet(), receiver, args);
     }
 
-    protected void test(Method method, Result expect, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
+    protected Result executeActualCheckDeopt(Method method, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
         Map<DeoptimizationReason, Integer> deoptCounts = new EnumMap<>(DeoptimizationReason.class);
         ProfilingInfo profile = runtime.lookupJavaMethod(method).getProfilingInfo();
         for (DeoptimizationReason reason : shouldNotDeopt) {
@@ -368,7 +368,10 @@
         for (DeoptimizationReason reason : shouldNotDeopt) {
             Assert.assertEquals((int) deoptCounts.get(reason), profile.getDeoptimizationCount(reason));
         }
+        return actual;
+    }
 
+    protected void assertEquals(Result expect, Result actual) {
         if (expect.exception != null) {
             Assert.assertTrue("expected " + expect.exception, actual.exception != null);
             Assert.assertEquals(expect.exception.getClass(), actual.exception.getClass());
@@ -382,6 +385,11 @@
         }
     }
 
+    protected void test(Method method, Result expect, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) {
+        Result actual = executeActualCheckDeopt(method, shouldNotDeopt, receiver, args);
+        assertEquals(expect, actual);
+    }
+
     private Map<ResolvedJavaMethod, InstalledCode> cache = new HashMap<>();
 
     /**