methodDataOop.cpp revision 2124
4305N/A * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 4305N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4305N/A * This code is free software; you can redistribute it and/or modify it 4305N/A * under the terms of the GNU General Public License version 2 only, as 4305N/A * published by the Free Software Foundation. 4305N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4305N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4305N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4305N/A * version 2 for more details (a copy is included in the LICENSE file that 4305N/A * You should have received a copy of the GNU General Public License version 4305N/A * 2 along with this work; if not, write to the Free Software Foundation, 4305N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4305N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4305N/A// ================================================================== 4305N/A// Overlay for generic profiling data. 4305N/A// Some types of data layouts need a length field. 4305N/A// Perform generic initialization of the data. More specific 4305N/A// initialization occurs in overrides of ProfileData::post_initialize. // ================================================================== // A ProfileData object is created to refer to a section of profiling // data in a structured way. // Constructor for invalid ProfileData. // ================================================================== // A BitData corresponds to a one-bit flag. This is used to indicate // whether a checkcast bytecode has seen a null value. // ================================================================== // A CounterData corresponds to a simple counter. // ================================================================== // A JumpData is used to access profiling information for a direct // branch. It is a counter, used for counting the number of branches, // plus a data displacement, used for realigning the data pointer to // the corresponding target bci. // ================================================================== // A ReceiverTypeData is used to access profiling information about a // dynamic type check. It consists of a counter which counts the total times // that the check is reached, and a series of (klassOop, count) pairs // which are used to store a type profile for the receiver of the check. // This is a set of weak references that need // to be followed at the end of the strong marking // phase. Memoize this object so it can be visited // in the weak roots processing phase. // This is a set of weak references that need // to be followed at the end of the strong marking // phase. Memoize this object so it can be visited // in the weak roots processing phase. // This is a set of weak references that need // to be followed at the end of the strong marking // phase. Memoize this object so it can be visited // in the weak roots processing phase. // Currently, this interface is called only during card-scanning for // a young gen gc, in which case this object cannot contribute anything, // since it does not contain any references that cross out of // the perm gen. However, for future more general use we allow // the possibility of calling for instance from more general // iterators (for example, a future regionalized perm gen for G1, // or the possibility of moving some references out of perm in // the case of other collectors). In that case, you will need // to relax or remove some of the assertions below. // Verify that none of the embedded oop references cross out of return;
// Nothing to do, see comment above // This is a set of weak references that need // to be followed at the end of the strong marking // phase. Memoize this object so it can be visited // in the weak roots processing phase. // Test that the current cursor and the two ends of the range // that we may have skipped iterating over are monotonically ordered; // this is just a paranoid assertion, just in case represetations // should change in the future rendering the short-circuit return break;
// remaining should be outside this mr too // boundary test hoisted outside the loop (see klassVTable for an example); // however, row_limit() is small enough (2) to make that less efficient. // ================================================================== // A RetData is used to access profiling information for a ret bytecode. // It is composed of a count of the number of times that the ret has // been executed, followed by a series of triples of the form // (bci, count, di) which count the number of times that some bci was the // target of the ret and cache a corresponding displacement. // release so other threads see a consistent state. bci is used as // a valid flag for bci_displacement. // This routine needs to atomically update the RetData structure, so the // caller needs to hold the RetData_lock before it gets here. Since taking // the lock can block (and allow GC) and since RetData is a ProfileData is a // wrapper around a derived oop, taking the lock in _this_ method will // basically cause the 'this' pointer's _data field to contain junk after the // lock. We require the caller to take the lock before making the ProfileData // structure. Currently the only caller is InterpreterRuntime::update_mdp_for_ret // First find the mdp which corresponds to the return bci. // Now check to see if any of the cache slots are open. // Barrier to ensure displacement is written before the bci; allows // the interpreter to read displacement without fear of race condition. st->
print_cr(
"bci(%d: count(%u) displacement(%d))",
// ================================================================== // A BranchData is used to access profiling data for a two-way branch. // It consists of taken and not_taken counts as well as a data displacement // ================================================================== // A MultiBranchData is used to access profiling information for // a multi-way branch (*switch bytecodes). It consists of a series // of (count, displacement) pairs, which count the number of times each // case was taken and specify the data displacment for each branch target. st->
print_cr(
"default_count(%u) displacement(%d)",
for (
int i = 0; i <
cases; i++) {
for (
int i = 0; i <
nargs; i++) {
// ================================================================== // A methodDataOop holds information which has been collected about // Compute the size of the profiling information corresponding to // Note: cell_count might be zero, meaning that there is just // a DataLayout header, with no extra cells. // Assume that up to 3% of BCIs with no MDP will need to allocate one. // If the method is large, let the extra BCIs grow numerous (to ~1%). // Compute the size of the methodDataOop necessary to store // profiling information about a given method. Size is in bytes. // Add some extra DataLayout cells (at least one) to track stray traps. // Add a cell to record information about modified arguments. // Compute the size of the methodDataOop necessary to store // profiling information about a given method. Size is in words // Initialize an individual data segment. Returns the size of // %%% should make a type profile for any invokedynamic that takes a ref argument // Get the data at an arbitrary (sort of) data index. // Give each of the data entries a chance to perform specific // Initialize the methodDataOop corresponding to a given method. // Set the method back-pointer. // Initialize flags and trap history. // Go through the bytecodes and allocate and initialize the // corresponding data cells. // Add some extra DataLayout cells (at least one) to track stray traps. // Add a cell to record information about modified arguments. // Set up _args_modified array after traps cells so that // the code for traps cells works. // Set an initial hint. Don't use set_hint_di() because // first_di() may be out of bounds if data_size is 0. // In that situation, _hint_di is never used, but at // Get a measure of how much mileage the method has on it. // Translate a bci to its corresponding data index (di). // Translate a bci to its corresponding data, or NULL. // Translate a bci to its corresponding extra data, or NULL. // No need for "OrderAccess::load_acquire" ops, // since the data structure is monotonic. dp =
end;
// ArgInfoData is at the end of extra data section. // Allocate this one. There is no mutual exclusion, // so two threads could allocate different BCIs to the // same data layout. This means these extra data // records, like most other MDO contents, must not be //NO: assert(dp->bci() == bci, "no concurrent allocation"); // No need for "OrderAccess::load_acquire" ops, // since the data structure is monotonic. dp =
end;
// ArgInfoData is at the end of extra data section.