8203356: VM Object Allocation Collector can infinite recurse

VM Event callback do not provoke a VM alloc event

Reviewed-by: sspitsyn, phh, amenkov, cjplummer
This commit is contained in:
Jean Christophe Beyler 2018-08-30 09:47:12 -07:00
parent 3c135ae705
commit b9b522a7ad
4 changed files with 176 additions and 1 deletions

View file

@ -2722,7 +2722,14 @@ void JvmtiEventCollector::setup_jvmti_thread_state() {
// should not happen since we're trying to configure for event collection
guarantee(state != NULL, "exiting thread called setup_jvmti_thread_state");
if (is_vm_object_alloc_event()) {
_prev = state->get_vm_object_alloc_event_collector();
JvmtiVMObjectAllocEventCollector *prev = state->get_vm_object_alloc_event_collector();
// If we have a previous collector and it is disabled, it means this allocation came from a
// callback induced VM Object allocation, do not register this collector then.
if (prev && !prev->is_enabled()) {
return;
}
_prev = prev;
state->set_vm_object_alloc_event_collector((JvmtiVMObjectAllocEventCollector *)this);
} else if (is_dynamic_code_event()) {
_prev = state->get_dynamic_code_event_collector();