On Tue, 28 Mar 2023 18:57:23 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
>> The fix is to enable virtual threads support for late binding JVMTI agents. >> The fix includes: >> - New function `JvmtiEnvBase::enable_virtual_threads_notify_jvmti()` which >> does enabling JVMTI VTMS transition notifications in case of agent loaded >> into running VM. This function executes a VM operation counting VTMS >> transition bits in all `JavaThread`'s to correctly set the static counter >> `_VTMS_transition_count` needed for VTMS transition protocol. >> - New function `JvmtiEnvBase::disable_virtual_threads_notify_jvmti()` which >> is needed for testing. It is used by the `WhiteBox` API. >> - New WhiteBox function `WB_SetVirtualThreadsNotifyJvmtiMode(JNIEnv* env, >> jobject wb, jboolean enable)` needed for testing of this update. >> - New regression test: `serviceability/jvmti/vthread/ToggleNotifyJvmtiTest` >> >> Testing: >> - New test: `serviceability/jvmti/vthread/ToggleNotifyJvmtiTest` >> - The originally failed tests are expected to pass now: >> `runtime/vthread/RedefineClass.java` >> `runtime/vthread/TestObjectAllocationSampleEvent.java` >> - In progress: Run the tiers 1-6 to make sure there are no regression. > > Serguei Spitsyn has updated the pull request incrementally with one > additional commit since the last revision: > > fixed trailing spaces in two files Pushed a couple of updates which include: (1) Addressed review comments: - fixed minor issues in `libToggleNotifyJvmtiTest.cpp`: added volatile specifier and removed unneeded static variable - fixed the typo in `disable_virtual_threads_notify_jvmti` - added comments for two new functions in `jvmtiEnvBase` (enabling and disabling notifyJvmti events) - added comments to `ToggleNotifyJvmtiTest.java` (2) Refactored the `ToggleNotifyJvmtiTest.java` to run isolated sequential test cycles for the sake of `disable_virtual_threads_notify_jvmti` safety (no virtual threads are allowed to run when it is executed) (3) Extended `libToggleNotifyJvmtiTest.cpp` to request more JVMTI events: `VirtualThreadEnd`, `ThreadStart` and `ThreadEnd` (4) Other updates: - updated `JVM_VirtualThreadHideFrames` and `LibraryCallKit::inline_native_notify_jvmti_hide` to always (unconditionally) set the temporary VTMS transition bit to avoid asserts - renamed VMop: `InitNotifyJvmtiEventsMode` => `SetNotifyJvmtiEventsMode` - updated `VM_SetNotifyJvmtiEventsMode` to correct `jt->jvmti_thread_state()` and `jt->jvmti_vthread()` if necessary (needed to fix `JvmtiThreadState` double-deallocation issue) I hope that all review comments have been addressed now. Please, let me know if anything is missed. The mach5 tiers 1-6 tuns are good. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13133#issuecomment-1487477975