# HG changeset patch # User Thomas Wuerthinger # Date 1310047631 -7200 # Node ID 80ac21188fce8a4124415d67f16382bc8ed31b28 # Parent c7c5b06e92ddcf477056b8e62bef05229affa826 Drafted inlining guide interface. Added new compiler flag -G:Extend diff -r c7c5b06e92dd -r 80ac21188fce graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Wed Jul 06 21:48:33 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Thu Jul 07 16:07:11 2011 +0200 @@ -85,6 +85,8 @@ public static boolean PrintDOTGraphToPdf = ____; public static boolean OmitDOTFrameStates = ____; + public static boolean Extend = ____; + // Ideal graph visualizer output settings public static boolean Plot = ____; public static boolean PlotOnError = ____; diff -r c7c5b06e92dd -r 80ac21188fce graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Wed Jul 06 21:48:33 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Thu Jul 07 16:07:11 2011 +0200 @@ -31,6 +31,7 @@ import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction; import com.oracle.max.graal.compiler.value.*; +import com.oracle.max.graal.extensions.*; import com.oracle.max.graal.graph.*; import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; @@ -314,14 +315,28 @@ if (GraalOptions.TraceInlining) { TTY.println("not inlining %s because of code size (size: %d, max size: %d, ratio %5.3f, %s)", methodName(method, invoke), method.codeSize(), maximumSize, ratio, profile); } + if (GraalOptions.Extend) { + return overrideInliningDecision(method, false); + } return false; } if (GraalOptions.TraceInlining) { TTY.println("inlining %s (size: %d, max size: %d, ratio %5.3f, %s)", methodName(method, invoke), method.codeSize(), maximumSize, ratio, profile); } + if (GraalOptions.Extend) { + return overrideInliningDecision(method, true); + } return true; } + private boolean overrideInliningDecision(RiMethod method, boolean previousDecision) { + ServiceLoader loader = ServiceLoader.load(InliningGuide.class); + for (InliningGuide guide : loader) { + TTY.println("inlining guide " + guide); + } + return previousDecision; + } + private void inlineMethod(Invoke invoke, RiMethod method) { RiMethod parent = invoke.stateAfter().method(); FrameState stateAfter = invoke.stateAfter(); diff -r c7c5b06e92dd -r 80ac21188fce graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningGuide.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningGuide.java Thu Jul 07 16:07:11 2011 +0200 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.extensions; + + +public interface InliningGuide { + +}