sharkInliner.cpp revision 1612
1612N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. 1612N/A * Copyright 2009 Red Hat, Inc. 1612N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1612N/A * This code is free software; you can redistribute it and/or modify it 1612N/A * under the terms of the GNU General Public License version 2 only, as 1612N/A * published by the Free Software Foundation. 1612N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1612N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1612N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1612N/A * version 2 for more details (a copy is included in the LICENSE file that 1612N/A * You should have received a copy of the GNU General Public License version 1612N/A * 2 along with this work; if not, write to the Free Software Foundation, 1612N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1612N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1612N/A#
include "incls/_precompiled.incl" 1612N/A // Local variables for inlinability check 1612N/A // Expression stack for inlinability check 1612N/A // Methods for two-word locals 1612N/A// Quick checks so we can bail out before doing too much 1612N/A // We can't inline native methods 1612N/A // Not much point inlining abstract ones, and in any 1612N/A // case we'd need a stack frame to throw the exception 1612N/A // Don't inline anything huge 1612N/A // Monitors aren't allowed without a frame to put them in 1612N/A // We don't do control flow 1612N/A // Don't try to inline constructors, as they must 1612N/A // eventually call Object.<init> which we can't inline. 1612N/A // Note that this catches <clinit> too, but why would 1612N/A // Mustn't inline Object.<init> 1612N/A // Should be caught by the above, but just in case... 1612N/A// Full-on detailed check, for methods that pass the quick checks 1612N/A// Inlined methods have no stack frame, so we can't do anything 1612N/A// that would require one. This means no safepoints (and hence 1612N/A// no loops) and no VM calls. No VM calls means, amongst other 1612N/A// things, that no exceptions can be created, which means no null 1612N/A// checks or divide-by-zero checks are allowed. The lack of null 1612N/A// checks in particular would eliminate practically everything, 1612N/A// but we can get around that restriction by relying on the zero- 1612N/A// check eliminator to strip the checks. To do that, we need to 1612N/A// walk through the method, tracking which values are and are not 1612N/A // If the holder isn't linked then there isn't a lot we can do 1612N/A // If the field is mismatched then an exception needs throwing 1612N/A // Pop the value off the stack if necessary 1612N/A // Pop and null-check the receiver if necessary 1612N/A // Push the result if necessary