On Fri, 24 Jun 2022 04:20:45 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> Zhengyu Gu has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 18 additional >> commits since the last revision: >> >> - Improve naming and cleanup >> - Merge branch 'master' into JDK-8256811-jdi-missing-class-unloading-event >> - v4 >> - v3 >> - v2 >> - Merge branch 'master' into JDK-8256811-jdi-missing-class-unloading-event >> - Merge branch 'jdi_tmp' into JDK-8256811-jdi-missing-class-unloading-event >> - v0 >> - v2 >> - v1 >> - ... and 8 more: https://git.openjdk.org/jdk/compare/fae7ca88...559b4bf1 > > src/hotspot/share/prims/jvmtiExport.cpp line 1702: > >> 1700: } else { >> 1701: post_object_free_on_java_thread(env, objects); >> 1702: } > > Can you explain why sometimes it is a VMThread and why sometimes it is a > JavaThread? I hope, it is okay if I explain it. :) The `post_object_free` can be called in different contexts. It is (recursively) called from `JvmtiTagMap::check_hashmaps_for_heapwalk()` which is used in VM_ops: - VM_HeapIterateOperation - VM_HeapWalkOperation Also, the `post_object_free` is called from `JvmtiTagMap` functions: - flush_object_free_events - get_objects_with_tags which can be called from the `ServiceThread` or the JVMTI functions like `SetEvenNotificationMode`, `SetEventCallBacks` or `GetObjectsWithTags`. ------------- PR: https://git.openjdk.org/jdk/pull/9168