mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8247808: Move JVMTI strong oops to OopStorage
Remove JVMTI oops_do calls from JVMTI and GCs Reviewed-by: sspitsyn, stefank, zgu, dholmes, iklam
This commit is contained in:
parent
1f5e21a16e
commit
749be7e761
24 changed files with 18 additions and 133 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "code/nmethod.hpp"
|
||||
#include "code/pcDesc.hpp"
|
||||
#include "code/scopeDesc.hpp"
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "logging/log.hpp"
|
||||
|
@ -39,6 +40,7 @@
|
|||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/oopHandle.inline.hpp"
|
||||
#include "prims/jvmtiCodeBlobEvents.hpp"
|
||||
#include "prims/jvmtiEventController.hpp"
|
||||
#include "prims/jvmtiEventController.inline.hpp"
|
||||
|
@ -2599,10 +2601,6 @@ void JvmtiExport::clear_detected_exception(JavaThread* thread) {
|
|||
}
|
||||
}
|
||||
|
||||
void JvmtiExport::oops_do(OopClosure* f) {
|
||||
JvmtiObjectAllocEventCollector::oops_do_for_all_threads(f);
|
||||
}
|
||||
|
||||
void JvmtiExport::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
|
||||
JvmtiTagMap::weak_oops_do(is_alive, f);
|
||||
}
|
||||
|
@ -2828,8 +2826,11 @@ void JvmtiObjectAllocEventCollector::generate_call_for_allocated() {
|
|||
if (_allocated) {
|
||||
set_enabled(false);
|
||||
for (int i = 0; i < _allocated->length(); i++) {
|
||||
oop obj = _allocated->at(i);
|
||||
oop obj = _allocated->at(i).resolve();
|
||||
_post_callback(JavaThread::current(), obj);
|
||||
// Release OopHandle
|
||||
_allocated->at(i).release(OopStorageSet::vm_global());
|
||||
|
||||
}
|
||||
delete _allocated, _allocated = NULL;
|
||||
}
|
||||
|
@ -2838,48 +2839,11 @@ void JvmtiObjectAllocEventCollector::generate_call_for_allocated() {
|
|||
void JvmtiObjectAllocEventCollector::record_allocation(oop obj) {
|
||||
assert(is_enabled(), "Object alloc event collector is not enabled");
|
||||
if (_allocated == NULL) {
|
||||
_allocated = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<oop>(1, mtServiceability);
|
||||
_allocated = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<OopHandle>(1, mtServiceability);
|
||||
}
|
||||
_allocated->push(obj);
|
||||
_allocated->push(OopHandle(OopStorageSet::vm_global(), obj));
|
||||
}
|
||||
|
||||
// GC support.
|
||||
void JvmtiObjectAllocEventCollector::oops_do(OopClosure* f) {
|
||||
if (_allocated) {
|
||||
for(int i = _allocated->length() - 1; i >= 0; i--) {
|
||||
if (_allocated->at(i) != NULL) {
|
||||
f->do_oop(_allocated->adr_at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JvmtiObjectAllocEventCollector::oops_do_for_all_threads(OopClosure* f) {
|
||||
// no-op if jvmti not enabled
|
||||
if (!JvmtiEnv::environments_might_exist()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jthr = jtiwh.next(); ) {
|
||||
JvmtiThreadState *state = jthr->jvmti_thread_state();
|
||||
if (state != NULL) {
|
||||
JvmtiObjectAllocEventCollector *collector;
|
||||
collector = state->get_vm_object_alloc_event_collector();
|
||||
while (collector != NULL) {
|
||||
collector->oops_do(f);
|
||||
collector = (JvmtiObjectAllocEventCollector*) collector->get_prev();
|
||||
}
|
||||
|
||||
collector = state->get_sampled_object_alloc_event_collector();
|
||||
while (collector != NULL) {
|
||||
collector->oops_do(f);
|
||||
collector = (JvmtiObjectAllocEventCollector*) collector->get_prev();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Disable collection of VMObjectAlloc events
|
||||
NoJvmtiVMObjectAllocMark::NoJvmtiVMObjectAllocMark() : _collector(NULL) {
|
||||
// a no-op if VMObjectAlloc event is not enabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue