codeCache.cpp revision 2200
1472N/A * or visit www.oracle.com if you need additional information or have any
1879N/A#include "precompiled.hpp"
1879N/A#include "code/codeBlob.hpp"
1879N/A#include "code/codeCache.hpp"
1879N/A#include "code/dependencies.hpp"
1879N/A#include "code/nmethod.hpp"
1879N/A#include "code/pcDesc.hpp"
1879N/A#include "gc_implementation/shared/markSweep.hpp"
1879N/A#include "memory/allocation.inline.hpp"
1879N/A#include "memory/gcLocker.hpp"
1879N/A#include "memory/iterator.hpp"
1879N/A#include "memory/resourceArea.hpp"
1879N/A#include "oops/methodOop.hpp"
1879N/A#include "oops/objArrayOop.hpp"
1879N/A#include "oops/oop.inline.hpp"
1879N/A#include "runtime/handles.inline.hpp"
1879N/A#include "runtime/icache.hpp"
1879N/A#include "runtime/mutexLocker.hpp"
1879N/A#include "services/memoryService.hpp"
1879N/A#include "utilities/xmlstream.hpp"
0N/Aclass CodeBlob_sizes {
0N/A int total_size;
0N/A int header_size;
0N/A int relocation_size;
0N/A int scopes_oop_size;
0N/A int scopes_data_size;
0N/A int scopes_pcs_size;
0N/A CodeBlob_sizes() {
0N/A total_size = 0;
0N/A header_size = 0;
0N/A relocation_size = 0;
0N/A scopes_oop_size = 0;
0N/A scopes_data_size = 0;
0N/A scopes_pcs_size = 0;
0N/A tty->print_cr(" #%d %s = %dK (hdr %d%%, loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])",
0N/A if (PrintCodeCacheExtension) {
0N/A#define FOR_ALL_ALIVE_BLOBS(var) for (CodeBlob *var = alive(first()); var != NULL; var = alive(next(var)))
0N/A#define FOR_ALL_ALIVE_NMETHODS(var) for (nmethod *var = alive_nmethod(first()); var != NULL; var = alive_nmethod(next(var)))
0N/A// This method is safe to call without holding the CodeCache_lock, as long as a dead codeblob is not
0N/A// looked up (i.e., one that has been marked for deletion). It only dependes on the _segmap to contain
0N/A// valid indices, which it will always do, as long as the CodeBlob is not in the process of being recycled.
0N/A guarantee(!result->is_zombie() || result->is_locked_by_vm() || is_error_reported(), "unsafe access to zombie method");
0N/A FOR_ALL_BLOBS(p) {
0N/A bool unloading_occurred) {
989N/A for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
989N/A if (TraceScavenge) {
989N/A for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
1202N/A if (PrintMethodFlushing) {
1202N/A assert(nm->is_in_use() && !nm->is_speculatively_disconnected(), "should only disconnect live nmethods");
1202N/A if (PrintMethodFlushing) {
0N/A if (needs_cache_clean()) {
0N/A set_needs_cache_clean(false);
0N/Avoid icache_init();
0N/A assert(CodeCacheSegmentSize >= (uintx)CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points");
0N/A assert(CodeCacheSegmentSize >= (uintx)OptoLoopAlignment, "CodeCacheSegmentSize must be large enough to align inner loops");
0N/A assert(CodeCacheSegmentSize >= sizeof(jdouble), "CodeCacheSegmentSize must be large enough to align constants");
0N/A icache_init();
0N/Avoid codeCache_init() {
0N/A//------------------------------------------------------------------------------------------------
0N/Astatic int dependentCheckCount = 0;
0N/A int number_of_marked_CodeBlobs = 0;
0N/A if (VerifyDependencies) {
0N/A return number_of_marked_CodeBlobs;
0N/A int number_of_marked_CodeBlobs = 0;
0N/A return number_of_marked_CodeBlobs;
0N/A int number_of_marked_CodeBlobs = 0;
0N/A return number_of_marked_CodeBlobs;
0N/A FOR_ALL_ALIVE_BLOBS(p) {
0N/A//------------------------------------------------------------------------------------------------
0N/A if (VerifyCodeCacheOften) {
0N/A int nmethodCount = 0;
0N/A int runtimeStubCount = 0;
0N/A int adapterCount = 0;
0N/A int deoptimizationStubCount = 0;
0N/A int uncommonTrapStubCount = 0;
0N/A int bufferBlobCount = 0;
0N/A int nmethodAlive = 0;
0N/A int nmethodNotEntrant = 0;
0N/A int nmethodZombie = 0;
0N/A int nmethodUnloaded = 0;
0N/A int nmethodJava = 0;
0N/A int nmethodNative = 0;
0N/A int maxCodeSize = 0;
0N/A nmethodCount++;
0N/A nmethodJava++;
0N/A adapterCount++;
0N/A for(int i=0; i<bucketLimit; i++) {
0N/A FOR_ALL_BLOBS(p) {
0N/A int number_of_blobs = 0;
0N/A int number_of_oop_maps = 0;
0N/A FOR_ALL_BLOBS(p) {