# HG changeset patch # User Roland Schatz # Date 1413446787 -7200 # Node ID cdd0b5d3d9bf1d6556fd1765ee15b55b55acb073 # Parent 35ae3e9165822339e78a829c7fed646d9dcf1ff6 Substitution method for inserting a native breakpoint into a unit test. diff -r 35ae3e916582 -r cdd0b5d3d9bf graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- 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> iter = ret.getHighTier().findPhase(CleanTypeProfileProxyPhase.class); diff -r 35ae3e916582 -r cdd0b5d3d9bf graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTestSubstitutions.java --- /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(); + } +} diff -r 35ae3e916582 -r cdd0b5d3d9bf graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InjectProfileDataSubstitutions.java --- 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); - } -} diff -r 35ae3e916582 -r cdd0b5d3d9bf graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java --- 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 arguments() { return arguments; } + + @NodeIntrinsic + public static native void breakpoint(); }