changeset 17605:cdd0b5d3d9bf

Substitution method for inserting a native breakpoint into a unit test.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 16 Oct 2014 10:06:27 +0200
parents 35ae3e916582
children 45d7b2c7029d
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTestSubstitutions.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InjectProfileDataSubstitutions.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java
diffstat 4 files changed, 53 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Oct 16 09:26:14 2014 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Oct 16 10:06:27 2014 +0200
@@ -117,11 +117,14 @@
 
     private void installSubstitutions() {
         if (!substitutionsInstalled) {
-            this.providers.getReplacements().registerSubstitutions(GraalCompilerTest.class, InjectProfileDataSubstitutions.class);
+            this.providers.getReplacements().registerSubstitutions(GraalCompilerTest.class, GraalCompilerTestSubstitutions.class);
             substitutionsInstalled = true;
         }
     }
 
+    protected static void breakpoint() {
+    }
+
     protected Suites createSuites() {
         Suites ret = backend.getSuites().createSuites();
         ListIterator<BasePhase<? super HighTierContext>> iter = ret.getHighTier().findPhase(CleanTypeProfileProxyPhase.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTestSubstitutions.java	Thu Oct 16 10:06:27 2014 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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.compiler.test;
+
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.extended.*;
+
+@ClassSubstitution(GraalCompilerTest.class)
+class GraalCompilerTestSubstitutions {
+
+    @MethodSubstitution
+    public static boolean branchProbability(double p, boolean cond) {
+        return BranchProbabilityNode.probability(p, cond);
+    }
+
+    @MethodSubstitution
+    public static boolean iterationCount(double i, boolean cond) {
+        return BranchProbabilityNode.probability(1. - 1. / i, cond);
+    }
+
+    @MethodSubstitution
+    public static void breakpoint() {
+        BreakpointNode.breakpoint();
+    }
+}
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InjectProfileDataSubstitutions.java	Thu Oct 16 09:26:14 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 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.compiler.test;
-
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.nodes.extended.*;
-
-@ClassSubstitution(GraalCompilerTest.class)
-class InjectProfileDataSubstitutions {
-
-    @MethodSubstitution
-    public static boolean branchProbability(double p, boolean cond) {
-        return BranchProbabilityNode.probability(p, cond);
-    }
-
-    @MethodSubstitution
-    public static boolean iterationCount(double i, boolean cond) {
-        return BranchProbabilityNode.probability(1. - 1. / i, cond);
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Thu Oct 16 09:26:14 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Thu Oct 16 10:06:27 2014 +0200
@@ -67,4 +67,7 @@
     public NodeInputList<ValueNode> arguments() {
         return arguments;
     }
+
+    @NodeIntrinsic
+    public static native void breakpoint();
 }