From 62b16c6a52d57fdc1e8200e0c30d50609fb2b0ad Mon Sep 17 00:00:00 2001 From: Patricio Chilano Mateo Date: Thu, 7 Nov 2024 14:58:35 -0400 Subject: [PATCH] Use get_method_name + copyright revert in jvmtiThreadState.cpp --- src/hotspot/share/prims/jvmtiThreadState.cpp | 2 +- .../VThreadEventTest/libVThreadEventTest.cpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/prims/jvmtiThreadState.cpp b/src/hotspot/share/prims/jvmtiThreadState.cpp index 40cc44bd3f9d7..d175aa6c78d1f 100644 --- a/src/hotspot/share/prims/jvmtiThreadState.cpp +++ b/src/hotspot/share/prims/jvmtiThreadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp index 8e225f3b19933..d69519e88ffa4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp @@ -62,14 +62,12 @@ void JNICALL VirtualThreadMount(jvmtiEnv* jvmti, ...) { if (count < verification_count) return; for (int idx = 0; idx < verification_count; idx++) { - char *methodName = nullptr; - - err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, nullptr, nullptr); - check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); - + char* methodName = get_method_name(jvmti, jni, frameInfo[idx].method); if (strcmp(methodName, expected_methods[idx]) != 0) { + deallocate(jvmti, jni, methodName); return; } + deallocate(jvmti, jni, methodName); } thread_mount_cnt++; } @@ -98,14 +96,12 @@ void JNICALL VirtualThreadUnmount(jvmtiEnv* jvmti, ...) { if (count < verification_count) return; for (int idx = 0; idx < verification_count; idx++) { - char *methodName = nullptr; - - err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, nullptr, nullptr); - check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); - + char* methodName = get_method_name(jvmti, jni, frameInfo[idx].method); if (strcmp(methodName, expected_methods[idx]) != 0) { + deallocate(jvmti, jni, methodName); return; } + deallocate(jvmti, jni, methodName); } thread_unmount_cnt++; }