Skip to content
Permalink
Browse files
8256811: Delayed/missed jdwp class unloading events
Co-authored-by: Chris Plummer <cjplummer@openjdk.org>
Reviewed-by: cjplummer, coleenp, sspitsyn
  • Loading branch information
zhengyu123 and plummercj committed Jul 22, 2022
1 parent 75c1e99 commit 54854d9
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 241 deletions.
@@ -1690,20 +1690,25 @@ void JvmtiExport::continuation_yield_cleanup(JavaThread* thread, jint continuati
}
}

void JvmtiExport::post_object_free(JvmtiEnv* env, jlong tag) {
Thread *thread = Thread::current();
void JvmtiExport::post_object_free(JvmtiEnv* env, GrowableArray<jlong>* objects) {
assert(objects != NULL, "Nothing to post");

if (thread->is_Java_thread() && JavaThread::cast(thread)->is_in_VTMS_transition()) {
JavaThread *javaThread = JavaThread::current();
if (javaThread->is_in_VTMS_transition()) {
return; // no events should be posted if thread is in a VTMS transition
}
assert(env->is_enabled(JVMTI_EVENT_OBJECT_FREE), "checking");

EVT_TRIG_TRACE(JVMTI_EVENT_OBJECT_FREE, ("[?] Trg Object Free triggered" ));
EVT_TRACE(JVMTI_EVENT_OBJECT_FREE, ("[?] Evt Object Free sent"));

JvmtiThreadEventMark jem(javaThread);
JvmtiJavaThreadEventTransition jet(javaThread);
jvmtiEventObjectFree callback = env->callbacks()->ObjectFree;
if (callback != NULL) {
(*callback)(env->jvmti_external(), tag);
for (int index = 0; index < objects->length(); index++) {
(*callback)(env->jvmti_external(), objects->at(index));
}
}
}

@@ -386,7 +386,7 @@ class JvmtiExport : public AllStatic {
static void post_monitor_contended_entered(JavaThread *thread, ObjectMonitor *obj_mntr) NOT_JVMTI_RETURN;
static void post_monitor_wait(JavaThread *thread, oop obj, jlong timeout) NOT_JVMTI_RETURN;
static void post_monitor_waited(JavaThread *thread, ObjectMonitor *obj_mntr, jboolean timed_out) NOT_JVMTI_RETURN;
static void post_object_free(JvmtiEnv* env, jlong tag) NOT_JVMTI_RETURN;
static void post_object_free(JvmtiEnv* env, GrowableArray<jlong>* objects) NOT_JVMTI_RETURN;
static void post_resource_exhausted(jint resource_exhausted_flags, const char* detail) NOT_JVMTI_RETURN;
static void record_vm_internal_object_allocation(oop object) NOT_JVMTI_RETURN;
// Post objects collected by vm_object_alloc_event_collector.

1 comment on commit 54854d9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.