# HG changeset patch # User Doug Simon # Date 1428272370 -7200 # Node ID 30ba345cffeb26b86bee7e1354cfb893fae5133f # Parent 9794217565cd7377f9124da81744b02bbe386c4a replaced method substitution for GraalCompilerTest.breakpoint() with an InvocationPlugin diff -r 9794217565cd -r 30ba345cffeb 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 Mon Apr 06 00:08:22 2015 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Apr 06 00:19:30 2015 +0200 @@ -49,7 +49,8 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.graphbuilderconf.*; -import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*; +import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins; +import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver; import com.oracle.graal.java.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.phases.*; @@ -123,15 +124,6 @@ return true; } - private static boolean substitutionsInstalled; - - private void installSubstitutions() { - if (!substitutionsInstalled) { - this.providers.getReplacements().registerSubstitutions(GraalCompilerTest.class, GraalCompilerTestSubstitutions.class); - substitutionsInstalled = true; - } - } - protected static void breakpoint() { } @@ -180,7 +172,6 @@ this.providers = getBackend().getProviders(); this.suites = new DerivedOptionValue<>(this::createSuites); this.lirSuites = new DerivedOptionValue<>(this::createLIRSuites); - installSubstitutions(); } /** @@ -201,7 +192,6 @@ this.providers = backend.getProviders(); this.suites = new DerivedOptionValue<>(this::createSuites); this.lirSuites = new DerivedOptionValue<>(this::createLIRSuites); - installSubstitutions(); } @BeforeClass @@ -855,6 +845,13 @@ } protected GraphBuilderConfiguration editGraphBuilderConfiguration(GraphBuilderConfiguration conf) { + InvocationPlugins invocationPlugins = conf.getPlugins().getInvocationPlugins(); + invocationPlugins.register(new InvocationPlugin() { + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) { + b.add(new BreakpointNode()); + return true; + } + }, GraalCompilerTest.class, "breakpoint"); return conf; } diff -r 9794217565cd -r 30ba345cffeb graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTestSubstitutions.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTestSubstitutions.java Mon Apr 06 00:08:22 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014, 2015, 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.*; - -@ClassSubstitution(GraalCompilerTest.class) -class GraalCompilerTestSubstitutions { - - @MethodSubstitution - public static void breakpoint() { - BreakpointNode.breakpoint(); - } -} diff -r 9794217565cd -r 30ba345cffeb 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 Mon Apr 06 00:08:22 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Mon Apr 06 00:19:30 2015 +0200 @@ -51,7 +51,7 @@ public static final NodeClass TYPE = NodeClass.create(BreakpointNode.class); @Input NodeInputList arguments; - public BreakpointNode(ValueNode[] arguments) { + public BreakpointNode(ValueNode... arguments) { super(TYPE, StampFactory.forVoid()); this.arguments = new NodeInputList<>(this, arguments); }