JDK-8067223 : [TESTBUG] Rename Whitebox API package
Type:Enhancement
Component:hotspot
Sub-Component:test
Affected Version:9,17
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2014-12-11
Updated:2024-07-09
Resolved:2021-08-02
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
As a second step after moving the Whitebox API from the hotspot repo to the top level repo (JDK-8066433) we need to rename the package name from 'sun.hotspot' to 'jdk.test.lib' and adapt the tests accordingly.
not to pollute `jdk/test/lib` package and to keep all whitebox-related classes together, it would be better to move sun/hotspot classes into its own (sub)package, e.g. `jdk/test/whitebox`.
28-07-2021
In addition to the jtreg tests, the following places in the hotspot source have to be adapted as well:
--- old/src/share/vm/prims/nativeLookup.cpp 2014-12-09 15:12:59.689780967 +0100
+++ new/src/share/vm/prims/nativeLookup.cpp 2014-12-09 15:12:59.345780956 +0100
@@ -120,7 +120,7 @@
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
{ CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
- { CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
+ { CC"Java_jdk_test.lib_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
};
static address lookup_special_native(char* jni_name) {
--- old/src/share/vm/prims/wbtestmethods/parserTests.cpp 2014-12-09 15:12:59.641780965 +0100
+++ new/src/share/vm/prims/wbtestmethods/parserTests.cpp 2014-12-09 15:12:59.337780956 +0100
@@ -50,7 +50,7 @@
*/
static const char* lookup_diagnosticArgumentEnum(const char* field_name, oop object) {
Thread* THREAD = Thread::current();
- const char* enum_sig = "Lsun/hotspot/parser/DiagnosticCommand$DiagnosticArgumentType;";
+ const char* enum_sig = "Ljdk/test/lib/parser/DiagnosticCommand$DiagnosticArgumentType;";
TempNewSymbol enumSigSymbol = SymbolTable::lookup(enum_sig, (int) strlen(enum_sig), THREAD);
int offset = WhiteBox::offset_for_field(field_name, object, enumSigSymbol);
oop enumOop = object->obj_field(offset);
--- old/src/share/vm/prims/whitebox.cpp 2014-12-09 15:12:59.649780965 +0100
+++ new/src/share/vm/prims/whitebox.cpp 2014-12-09 15:12:59.337780956 +0100
@@ -1145,12 +1145,12 @@
if (env->IsInstanceOf(throwable_obj, no_such_method_error_klass)) {
// NoSuchMethodError is thrown when a method can't be found or a method is not native.
// Ignoring the exception since it is not preventing use of other WhiteBox methods.
- tty->print_cr("Warning: 'NoSuchMethodError' on register of sun.hotspot.WhiteBox::%s%s",
+ tty->print_cr("Warning: 'NoSuchMethodError' on register of jdk.test.lib.WhiteBox::%s%s",
method_array[i].name, method_array[i].signature);
}
} else {
// Registration failed unexpectedly.
- tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
+ tty->print_cr("Warning: unexpected error on register of jdk.test.lib.WhiteBox::%s%s. All methods will be unregistered",
method_array[i].name, method_array[i].signature);
env->UnregisterNatives(wbclass);
break;
@@ -1169,7 +1169,7 @@
{CC"getVMPageSize", CC"()I", (void*)&WB_GetVMPageSize },
{CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive },
{CC"parseCommandLine",
- CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
+ CC"(Ljava/lang/String;C[Ljdk/test/lib/parser/DiagnosticCommand;)[Ljava/lang/Object;",
(void*) &WB_ParseCommandLine
},
{CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",