InlineEverythingPolicy.java revision 12651:6ef01bd40ce2
1219820Sjeff/* 2219820Sjeff * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 3219820Sjeff * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4219820Sjeff * 5271127Shselasky * This code is free software; you can redistribute it and/or modify it 6219820Sjeff * under the terms of the GNU General Public License version 2 only, as 7219820Sjeff * published by the Free Software Foundation. 8219820Sjeff * 9219820Sjeff * This code is distributed in the hope that it will be useful, but WITHOUT 10219820Sjeff * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11219820Sjeff * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12219820Sjeff * version 2 for more details (a copy is included in the LICENSE file that 13219820Sjeff * accompanied this code). 14219820Sjeff * 15219820Sjeff * You should have received a copy of the GNU General Public License version 16219820Sjeff * 2 along with this work; if not, write to the Free Software Foundation, 17219820Sjeff * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18219820Sjeff * 19219820Sjeff * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20219820Sjeff * or visit www.oracle.com if you need additional information or have any 21219820Sjeff * questions. 22219820Sjeff */ 23219820Sjeffpackage org.graalvm.compiler.phases.common.inlining.policy; 24219820Sjeff 25219820Sjeffimport static org.graalvm.compiler.core.common.GraalOptions.MaximumDesiredSize; 26219820Sjeff 27219820Sjeffimport org.graalvm.compiler.common.PermanentBailoutException; 28219820Sjeffimport org.graalvm.compiler.nodes.StructuredGraph; 29219820Sjeffimport org.graalvm.compiler.nodes.spi.Replacements; 30219820Sjeffimport org.graalvm.compiler.phases.common.inlining.InliningUtil; 31219820Sjeffimport org.graalvm.compiler.phases.common.inlining.walker.MethodInvocation; 32219820Sjeff 33219820Sjeffpublic class InlineEverythingPolicy implements InliningPolicy { 34219820Sjeff 35219820Sjeff @Override 36219820Sjeff public boolean continueInlining(StructuredGraph graph) { 37219820Sjeff if (InliningUtil.getNodeCount(graph) >= MaximumDesiredSize.getValue()) { 38219820Sjeff throw new PermanentBailoutException("Inline all calls failed. The resulting graph is too large."); 39219820Sjeff } 40219820Sjeff return true; 41219820Sjeff } 42219820Sjeff 43219820Sjeff @Override 44219820Sjeff public boolean isWorthInlining(Replacements replacements, MethodInvocation invocation, int inliningDepth, boolean fullyProcessed) { 45219820Sjeff return true; 46219820Sjeff } 47219820Sjeff} 48219820Sjeff