Skip to content

Commit 4b93af7

Browse files
committed
8366440: [lworld] Two tests broken with JDK-8364483
Reviewed-by: phubner
1 parent 858be30 commit 4b93af7

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6218,7 +6218,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
62186218
"(cause: field type in LoadableDescriptors attribute) but loaded class is not a value class",
62196219
name->as_C_string(), _class_name->as_C_string());
62206220
}
6221-
} else {
6221+
} else {
62226222
log_warning(class, preload)("Preloading of class %s during loading of class %s "
62236223
"(cause: field type in LoadableDescriptors attribute) failed : %s",
62246224
name->as_C_string(), _class_name->as_C_string(),
@@ -6229,11 +6229,16 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
62296229
CLEAR_PENDING_EXCEPTION;
62306230
}
62316231
} else {
6232-
// Just poking the system dictionary to see if the class has already be loaded
6232+
// Just poking the system dictionary to see if the class has already be loaded. Looking for migrated classes
6233+
// used when --enable-preview when jdk isn't compiled with --enable-preview so doesn't include LoadableDescriptors.
6234+
// This is temporary.
62336235
oop loader = loader_data()->class_loader();
62346236
InstanceKlass* klass = SystemDictionary::find_instance_klass(THREAD, name, Handle(THREAD, loader));
62356237
if (klass != nullptr && klass->is_inline_klass()) {
62366238
_inline_layout_info_array->adr_at(fieldinfo.index())->set_klass(InlineKlass::cast(klass));
6239+
log_info(class, preload)("Preloading of class %s during loading of class %s "
6240+
"(cause: field type not in LoadableDescriptors attribute) succeeded",
6241+
name->as_C_string(), _class_name->as_C_string());
62376242
}
62386243
}
62396244
}

test/hotspot/jtreg/runtime/valhalla/inlinetypes/ValuePreloadTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public static void main(String[] args) throws Exception {
6161
checkFor(pb, "[warning][class,preload] Preloading of class PreloadValue1 during linking of class ValuePreloadClient1 (cause: LoadableDescriptors attribute) failed");
6262

6363
pb = exec("-Xlog:class+preload", "PreloadShared");
64-
checkFor(pb, "[info][class,preload] Preloading of class java/time/LocalDate during loading of shared class java/time/LocalDateTime (cause: field type in LoadableDescriptors attribute) succeeded");
64+
// Class java/time/LocalDate is already preloaded, so the LoadableDescriptor attribute does not trigger it
65+
// to be loaded from the shared archive.
66+
// checkFor(pb, "[info][class,preload] Preloading of class java/time/LocalDate during loading of shared class java/time/LocalDateTime (cause: field type in LoadableDescriptors attribute) succeeded");
67+
checkFor(pb, "[info][class,preload] Preloading of class java/time/LocalDateTime during linking of class PreloadShared (cause: LoadableDescriptors attribute) succeeded");
6568
}
6669
}

test/hotspot/jtreg/runtime/verifier/CFLH/TestVerify.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
*/
4040

4141
import java.lang.invoke.MethodHandles;
42-
import java.time.Duration;
4342
import java.lang.classfile.ClassFile;
4443
import java.lang.classfile.ClassTransform;
4544
import java.lang.classfile.MethodTransform;
@@ -61,7 +60,7 @@
6160

6261
public class TestVerify {
6362

64-
private static final String CLASS_TO_BREAK = "java.time.Duration";
63+
private static final String CLASS_TO_BREAK = "java.util.Date";
6564
private static final String INTERNAL_CLASS_TO_BREAK = CLASS_TO_BREAK.replace('.', '/');
6665
private static final boolean DEBUG = false;
6766

@@ -91,7 +90,7 @@ public byte[] transform(Module module, ClassLoader loader, String className, Cla
9190
}
9291
builder.with(element);
9392
});
94-
var classTransform = ClassTransform.transformingMethods(mm -> mm.methodName().stringValue().equals("getSeconds"), methodTransform);
93+
var classTransform = ClassTransform.transformingMethods(mm -> mm.methodName().stringValue().equals("parse"), methodTransform);
9594

9695
byte[] bytes;
9796
try {
@@ -164,7 +163,8 @@ public static void main(String argv[]) throws Exception {
164163
} else {
165164
// Load the class instrumented with CFLH for the VerifyError.
166165
inst.addTransformer(new BadTransformer());
167-
System.out.println("1 hour is " + Duration.ofHours(1).getSeconds() + " seconds");
166+
Class<?> cls = Class.forName(CLASS_TO_BREAK);
167+
System.out.println("class loaded" + cls);
168168
}
169169
throw new RuntimeException("Failed: Did not throw VerifyError");
170170
} catch (VerifyError e) {

0 commit comments

Comments
 (0)