/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
*/
#include "precompiled.hpp"
#include "ci/ciMethodData.hpp"
#include "ci/ciUtilities.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/deoptimization.hpp"
// ciMethodData
// ------------------------------------------------------------------
// ciMethodData::ciMethodData
//
_data_size = 0;
_extra_data_size = 0;
_current_mileage = 0;
_invocation_counter = 0;
_backedge_counter = 0;
_saw_free_extra_data = false;
// Set an initial hint. Don't use set_hint_di() because
// first_di() may be out of bounds if data_size is 0.
// Initialize the escape information (to "don't know.");
}
// ------------------------------------------------------------------
// ciMethodData::ciMethodData
//
// No methodDataOop.
_data_size = 0;
_extra_data_size = 0;
_current_mileage = 0;
_invocation_counter = 0;
_backedge_counter = 0;
_saw_free_extra_data = false;
// Set an initial hint. Don't use set_hint_di() because
// first_di() may be out of bounds if data_size is 0.
// Initialize the escape information (to "don't know.");
}
// To do: don't copy the data if it is not "ripe" -- require a minimum #
// of invocations.
// Snapshot the data -- actually, take an approximate snapshot of
// the data. Any concurrently executing threads may be changing the
// data as we copy it.
// Traverse the profile data, translating any oops into their
// ci equivalents.
}
// Note: Extra data are all BitData, and do not need translation.
}
if (k != NULL) {
}
}
}
// Get the data at an arbitrary (sort of) data index.
if (out_of_bounds(data_index)) {
return NULL;
}
switch (data_layout->tag()) {
case DataLayout::no_tag:
default:
return NULL;
case DataLayout::bit_data_tag:
return new ciBitData(data_layout);
case DataLayout::counter_data_tag:
return new ciCounterData(data_layout);
case DataLayout::jump_data_tag:
return new ciJumpData(data_layout);
case DataLayout::receiver_type_data_tag:
return new ciReceiverTypeData(data_layout);
case DataLayout::virtual_call_data_tag:
return new ciVirtualCallData(data_layout);
case DataLayout::ret_data_tag:
return new ciRetData(data_layout);
case DataLayout::branch_data_tag:
return new ciBranchData(data_layout);
case DataLayout::multi_branch_data_tag:
return new ciMultiBranchData(data_layout);
case DataLayout::arg_info_data_tag:
return new ciArgInfoData(data_layout);
};
}
// Iteration over data.
return next;
}
// Translate a bci to its corresponding data, or NULL.
return data;
break;
}
}
// bci_to_extra_data(bci) ...
_saw_free_extra_data = true; // observed an empty slot (common case)
return NULL;
}
break; // ArgInfoData is at the end of extra data section.
}
}
}
return NULL;
}
// Conservatively decode the trap_state of a ciProfileData.
int per_bc_reason
if (trap_count(reason) == 0) {
// Impossible for this trap to have occurred, regardless of trap_state.
// Note: This happens if the MDO is empty.
return 0;
// We cannot conclude anything; a trap happened somewhere, maybe here.
return -1;
// No profile here, not even an extra_data record allocated on the fly.
// If there are empty extra_data records, and there had been a trap,
// there would have been a non-null data pointer. If there are no
// free extra_data records, we must return a conservative -1.
if (_saw_free_extra_data)
return 0; // Q.E.D.
else
return -1; // bail with a conservative answer
} else {
}
}
} else {
}
}
mdo->clear_escape_info();
for (int i = 0; i < arg_count; i++) {
set_arg_modified(i, 0);
}
}
}
// copy our escape info to the methodDataOop if it exists
for (int i = 0; i < arg_count; i++) {
}
}
}
}
}
mdo->set_would_profile(p);
}
}
}
}
clear_bits(_eflags, f);
}
}
set_nth_bit(_arg_local, i);
}
set_nth_bit(_arg_stack, i);
}
set_nth_bit(_arg_returned, i);
}
return;
}
return is_set_nth_bit(_arg_local, i);
}
return is_set_nth_bit(_arg_stack, i);
}
return is_set_nth_bit(_arg_returned, i);
}
return 0;
}
// Get offset within methodDataOop of the data array
// Get cell offset of the ProfileData within data array
// Add in counter_offset, the # of bytes into the ProfileData of counter or flag
return in_ByteSize(offset);
}
// Should be last, have to skip all traps.
return new ciArgInfoData(dp);
}
return NULL;
}
// Implementation of the print method.
}
#ifndef PRODUCT
}
}
} else {
}
}
}
int entries = 0;
}
}
}
}
}
}
#endif