On Thu, 4 May 2023 23:20:21 GMT, Alex Menkov <amen...@openjdk.org> wrote:
>> The fix updates JVMTI FollowReferences implementation to report references >> from virtual threads: >> - unmounted vthreads are detected, their stack references for >> JVMTI_HEAP_REFERENCE_STACK_LOCAL/JVMTI_HEAP_REFERENCE_JNI_LOCAL; >> - stacks of mounted vthreads are splitted into 2 parts (virtual thread stack >> and carrier thread stack), references are reported with correct thread >> id/class tag/object tags/frame depth; >> - common code to handle stack frames are moved into separate class; >> >> Threads are reported as: >> - platform threads: JVMTI_HEAP_REFERENCE_THREAD (as before); >> - mounted vthreads (synthetic references, consider them as heap roots >> because carrier threads are roots): JVMTI_HEAP_REFERENCE_OTHER; >> - unmounted vthreads: not reported as heap roots. > > Alex Menkov has updated the pull request incrementally with one additional > commit since the last revision: > > Updated test test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 106: > 104: extern "C" JNIEXPORT jint JNICALL > 105: Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { > 106: if (vm->GetEnv(reinterpret_cast<void **>(&jvmti), JVMTI_VERSION) != > JNI_OK || jvmti == nullptr) { Nit: This line is long and non readable. There are many examples in tests how it is normally done. test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 113: > 111: memset(&capabilities, 0, sizeof(capabilities)); > 112: capabilities.can_tag_objects = 1; > 113: //capabilities.can_support_virtual_threads = 1; The line 113 can be removed. test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 130: > 128: Java_VThreadStackRefTest_test(JNIEnv* env, jclass clazz, jobjectArray > classes) { > 129: jsize classesCount = env->GetArrayLength(classes); > 130: for (int i=0; i<classesCount; i++) { Spaces are missed arounf '=' and '<' signs. test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 154: > 152: } > 153: > 154: static void printtCreatedClass(JNIEnv* env, jclass cls) { Why is printt with 'tt' ? test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 167: > 165: > 166: extern "C" JNIEXPORT void JNICALL > 167: Java_VThreadStackRefTest_createObjAndCallback(JNIEnv* env, jclass clazz, > jclass cls, jobject callback) { Some comment would be helpful about what this function does. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1185720838 PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1185720066 PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1185721404 PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1185722065 PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1185722636