void CodeBlobCollector::do_blob(CodeBlob* cb) { // ignore nmethods if (cb->is_nmethod()) { return; } // exclude VtableStubs, which are processed separately if (cb->is_buffer_blob() && strcmp(cb->name(), "vtable chunks") == 0) { return; } // check if this starting address has been seen already - the // assumption is that stubs are inserted into the list before the // enclosing BufferBlobs. address addr = cb->code_begin(); for (int i=0; i<_global_code_blobs->length(); i++) { JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i); if (addr == scb->code_begin()) { return; } } // record the CodeBlob details as a JvmtiCodeBlobDesc JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end()); _global_code_blobs->append(scb); }
jvmtiError JvmtiCodeBlobEvents::generate_dynamic_code_events(JvmtiEnv* env) { CodeBlobCollector collector; // first collect all the code blobs { MutexLocker mu(CodeCache_lock); collector.collect(); } // iterate over the collected list and post an event for each blob JvmtiCodeBlobDesc* blob = collector.first(); while (blob != NULL) { JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end()); blob = collector.next(); } return JVMTI_ERROR_NONE; }
void CodeBlobCollector::do_blob(CodeBlob* cb) { // ignore nmethods if (cb->is_nmethod()) { return; } // check if this starting address has been seen already - the // assumption is that stubs are inserted into the list before the // enclosing BufferBlobs. address addr = cb->instructions_begin(); for (int i=0; i<_global_code_blobs->length(); i++) { JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i); if (addr == scb->code_begin()) { return; } } // we must name the CodeBlob - some CodeBlobs already have names :- // - stubs used by compiled code to call a (static) C++ runtime routine // - non-relocatable machine code such as the interpreter, stubroutines, etc. // - various singleton blobs // // others are unnamed so we create a name :- // - OSR adapter (interpreter frame that has been on-stack replaced) // - I2C and C2I adapters const char* name = NULL; if (cb->is_runtime_stub()) { name = ((RuntimeStub*)cb)->name(); } if (cb->is_buffer_blob()) { name = ((BufferBlob*)cb)->name(); } if (cb->is_deoptimization_stub() || cb->is_safepoint_stub()) { name = ((SingletonBlob*)cb)->name(); } if (cb->is_uncommon_trap_stub() || cb->is_exception_stub()) { name = ((SingletonBlob*)cb)->name(); } // record the CodeBlob details as a JvmtiCodeBlobDesc JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(name, cb->instructions_begin(), cb->instructions_end()); _global_code_blobs->append(scb); }
jvmtiError JvmtiCodeBlobEvents::generate_dynamic_code_events(JvmtiEnv* env) { CodeBlobCollector collector; // First collect all the code blobs. This has to be done in a // single pass over the code cache with CodeCache_lock held because // there isn't any safe way to iterate over regular CodeBlobs since // they can be freed at any point. { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); collector.collect(); } // iterate over the collected list and post an event for each blob JvmtiCodeBlobDesc* blob = collector.first(); while (blob != NULL) { JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end()); blob = collector.next(); } return JVMTI_ERROR_NONE; }
void CodeBlobCollector::do_blob(CodeBlob* cb) { if(cb->is_methodCode()){ return; } // check if this starting address has been seen already - the // assumption is that stubs are inserted into the list before the // enclosing BufferBlobs. address addr=cb->code_begins(); for (int i=0; i<_global_code_blobs->length(); i++) { JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i); if (addr == scb->code_begin()) { return; } } // we must name the CodeBlob - some CodeBlobs already have names :- // - stubs used by compiled code to call a (static) C++ runtime routine // - non-relocatable machine code such as the interpreter, stubroutines, etc. // - various singleton blobs // // others are unnamed so we create a name :- // - OSR adapter (interpreter frame that has been on-stack replaced) // - I2C and C2I adapters // // CodeBlob::name() should return any defined name string, first. const char* name = cb->methodname(); // returns NULL or methodname+signature if (! name ) { name = cb->name(); // returns generic name... } else { ShouldNotReachHere(); } // record the CodeBlob details as a JvmtiCodeBlobDesc JvmtiCodeBlobDesc*scb=new JvmtiCodeBlobDesc(name,cb->code_begins(), cb->code_ends()); _global_code_blobs->append(scb); }