Skip to content

Commit ada58d1

Browse files
committed
8067223: [TESTBUG] Rename Whitebox API package
Reviewed-by: dholmes, kvn
1 parent f8fb571 commit ada58d1

36 files changed

Lines changed: 1394 additions & 72 deletions

File tree

src/hotspot/share/prims/nativeLookup.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static JNINativeMethod lookup_special_native_methods[] = {
244244
{ CC"Java_jdk_internal_invoke_NativeEntryPoint_registerNatives", NULL, FN_PTR(JVM_RegisterNativeEntryPointMethods) },
245245
{ CC"Java_jdk_internal_perf_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
246246
{ CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
247+
{ CC"Java_jdk_test_whitebox_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
247248
{ CC"Java_jdk_internal_vm_vector_VectorSupport_registerNatives", NULL, FN_PTR(JVM_RegisterVectorSupportMethods)},
248249
#if INCLUDE_JVMCI
249250
{ CC"Java_jdk_vm_ci_runtime_JVMCI_initializeRuntime", NULL, FN_PTR(JVM_GetJVMCIRuntime) },

src/hotspot/share/prims/wbtestmethods/parserTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* This method Returns a char* representation of that enum value.
5151
*/
5252
static const char* lookup_diagnosticArgumentEnum(const char* field_name, oop object) {
53-
const char* enum_sig = "Lsun/hotspot/parser/DiagnosticCommand$DiagnosticArgumentType;";
53+
const char* enum_sig = "Ljdk/test/whitebox/parser/DiagnosticCommand$DiagnosticArgumentType;";
5454
TempNewSymbol enumSigSymbol = SymbolTable::new_symbol(enum_sig);
5555
int offset = WhiteBox::offset_for_field(field_name, object, enumSigSymbol);
5656
oop enumOop = object->obj_field(offset);

src/hotspot/share/prims/whitebox.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,9 @@ bool WhiteBox::lookup_bool(const char* field_name, oop object) {
21512151

21522152
void WhiteBox::register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread, JNINativeMethod* method_array, int method_count) {
21532153
ResourceMark rm;
2154+
Klass* klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(wbclass));
2155+
const char* klass_name = klass->external_name();
2156+
21542157
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
21552158

21562159
// one by one registration natives for exception catching
@@ -2166,13 +2169,13 @@ void WhiteBox::register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
21662169
if (env->IsInstanceOf(throwable_obj, no_such_method_error_klass)) {
21672170
// NoSuchMethodError is thrown when a method can't be found or a method is not native.
21682171
// Ignoring the exception since it is not preventing use of other WhiteBox methods.
2169-
tty->print_cr("Warning: 'NoSuchMethodError' on register of sun.hotspot.WhiteBox::%s%s",
2170-
method_array[i].name, method_array[i].signature);
2172+
tty->print_cr("Warning: 'NoSuchMethodError' on register of %s::%s%s",
2173+
klass_name, method_array[i].name, method_array[i].signature);
21712174
}
21722175
} else {
21732176
// Registration failed unexpectedly.
2174-
tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered",
2175-
method_array[i].name, method_array[i].signature);
2177+
tty->print_cr("Warning: unexpected error on register of %s::%s%s. All methods will be unregistered",
2178+
klass_name, method_array[i].name, method_array[i].signature);
21762179
env->UnregisterNatives(wbclass);
21772180
break;
21782181
}
@@ -2387,7 +2390,7 @@ static JNINativeMethod methods[] = {
23872390
{CC"countAliveClasses0", CC"(Ljava/lang/String;)I", (void*)&WB_CountAliveClasses },
23882391
{CC"getSymbolRefcount", CC"(Ljava/lang/String;)I", (void*)&WB_GetSymbolRefcount },
23892392
{CC"parseCommandLine0",
2390-
CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
2393+
CC"(Ljava/lang/String;C[Ljdk/test/whitebox/parser/DiagnosticCommand;)[Ljava/lang/Object;",
23912394
(void*) &WB_ParseCommandLine
23922395
},
23932396
{CC"addToBootstrapClassLoaderSearch0", CC"(Ljava/lang/String;)V",

test/hotspot/jtreg/TEST.ROOT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ groups=TEST.groups TEST.quick-groups
4040
# to determine additional characteristics of the system for use with the @requires tag.
4141
# Note: compiled bootlibs classes will be added to BCP.
4242
requires.extraPropDefns = ../../jtreg-ext/requires/VMProps.java
43-
requires.extraPropDefns.bootlibs = ../../lib/sun
43+
requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox
4444
requires.extraPropDefns.libs = \
4545
../../lib/jdk/test/lib/Platform.java \
4646
../../lib/jdk/test/lib/Container.java

test/hotspot/jtreg/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
* jdk.internal.vm.ci/jdk.vm.ci.runtime
3838
*
3939
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
40-
* sun.hotspot.WhiteBox sun.hotspot.parser.DiagnosticCommand
40+
* sun.hotspot.WhiteBox jdk.test.whitebox.parser.DiagnosticCommand
4141
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
42-
* sun.hotspot.parser.DiagnosticCommand
42+
* jdk.test.whitebox.parser.DiagnosticCommand
4343
* @run main/othervm -Xbootclasspath/a:.
4444
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
4545
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI

test/hotspot/jtreg/runtime/cds/appcds/JarBuilder.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,27 +131,37 @@ static void update(String jarFile, String dir) throws Exception {
131131
}
132132

133133
// Add commonly used inner classes that are often omitted by mistake. Currently
134-
// we support only sun/hotspot/WhiteBox$WhiteBoxPermission. See JDK-8199290
134+
// we support only jdk/test/whitebox/WhiteBox$WhiteBoxPermission and
135+
// sun/hotspot/WhiteBox$WhiteBoxPermission. See JDK-8199290
135136
private static String[] addInnerClasses(String[] classes, int startIdx) {
136-
boolean seenWB = false;
137-
boolean seenWBInner = false;
137+
boolean seenNewWb = false;
138+
boolean seenNewWbInner = false;
139+
boolean seenOldWb = false;
140+
boolean seenOldWbInner = false;
138141
// This method is different than ClassFileInstaller.addInnerClasses which
139142
// uses "." as the package delimiter :-(
140-
final String wb = "sun/hotspot/WhiteBox";
141-
final String wbInner = "sun/hotspot/WhiteBox$WhiteBoxPermission";
143+
final String newWb = "jdk/test/whitebox/WhiteBox";
144+
final String newWbInner = newWb + "$WhiteBoxPermission";
145+
final String oldWb = "sun/hotspot/WhiteBox";
146+
final String oldWbInner = oldWb + "$WhiteBoxPermission";
142147

143148
ArrayList<String> list = new ArrayList<>();
144149

145150
for (int i = startIdx; i < classes.length; i++) {
146151
String cls = classes[i];
147152
list.add(cls);
148153
switch (cls) {
149-
case wb: seenWB = true; break;
150-
case wbInner: seenWBInner = true; break;
154+
case newWb: seenNewWb = true; break;
155+
case newWbInner: seenNewWbInner = true; break;
156+
case oldWb: seenOldWb = true; break;
157+
case oldWbInner: seenOldWbInner = true; break;
151158
}
152159
}
153-
if (seenWB && !seenWBInner) {
154-
list.add(wbInner);
160+
if (seenNewWb && !seenNewWbInner) {
161+
list.add(newWbInner);
162+
}
163+
if (seenOldWb && !seenOldWbInner) {
164+
list.add(oldWbInner);
155165
}
156166

157167
String[] array = new String[list.size()];

test/hotspot/jtreg/serviceability/ParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
import java.math.BigInteger;
3535

36-
import sun.hotspot.parser.DiagnosticCommand;
37-
import sun.hotspot.parser.DiagnosticCommand.DiagnosticArgumentType;
36+
import jdk.test.whitebox.parser.DiagnosticCommand;
37+
import jdk.test.whitebox.parser.DiagnosticCommand.DiagnosticArgumentType;
3838
import sun.hotspot.WhiteBox;
3939

4040
public class ParserTest {

test/hotspot/jtreg/testlibrary/ctw/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@ LIB_FILES = $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \
4747
$(TESTLIBRARY_DIR)/jdk/test/lib/util \
4848
$(TESTLIBRARY_DIR)/jtreg \
4949
-maxdepth 1 -name '*.java')
50-
WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot -name '*.java')
50+
WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot $(TESTLIBRARY_DIR)/jdk/test/whitebox -name '*.java')
5151
EXPORTS=--add-exports java.base/jdk.internal.jimage=ALL-UNNAMED \
5252
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
5353
--add-exports java.base/jdk.internal.reflect=ALL-UNNAMED \

test/jdk/TEST.ROOT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ groups=TEST.groups
3939
# to determine additional characteristics of the system for use with the @requires tag.
4040
# Note: compiled bootlibs classes will be added to BCP.
4141
requires.extraPropDefns = ../jtreg-ext/requires/VMProps.java
42-
requires.extraPropDefns.bootlibs = ../lib/sun
42+
requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
4343
requires.extraPropDefns.libs = \
4444
../lib/jdk/test/lib/Platform.java \
4545
../lib/jdk/test/lib/Container.java

test/jtreg-ext/requires/VMProps.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
import java.util.regex.Matcher;
4545
import java.util.regex.Pattern;
4646

47-
import sun.hotspot.code.Compiler;
48-
import sun.hotspot.cpuinfo.CPUInfo;
49-
import sun.hotspot.gc.GC;
50-
import sun.hotspot.WhiteBox;
47+
import jdk.test.whitebox.code.Compiler;
48+
import jdk.test.whitebox.cpuinfo.CPUInfo;
49+
import jdk.test.whitebox.gc.GC;
50+
import jdk.test.whitebox.WhiteBox;
5151
import jdk.test.lib.Platform;
5252
import jdk.test.lib.Container;
5353

0 commit comments

Comments
 (0)