Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8332074: Create a "jdk.exploded" test property to check if the testee jdk is exploded #19178

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/hotspot/share/prims/whitebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderStats.hpp"
#include "classfile/classPrinter.hpp"
Expand Down Expand Up @@ -2121,6 +2122,10 @@ WB_ENTRY(jboolean, WB_IsCDSIncluded(JNIEnv* env))
#endif // INCLUDE_CDS
WB_END

WB_ENTRY(jboolean, WB_IsJdkExploded(JNIEnv* env))
return !ClassLoader::has_jrt_entry();
WB_END

WB_ENTRY(jboolean, WB_isC2OrJVMCIIncluded(JNIEnv* env))
#if COMPILER2_OR_JVMCI
return true;
Expand Down Expand Up @@ -2875,6 +2880,7 @@ static JNINativeMethod methods[] = {
{CC"linkClass", CC"(Ljava/lang/Class;)V", (void*)&WB_LinkClass},
{CC"areOpenArchiveHeapObjectsMapped", CC"()Z", (void*)&WB_AreOpenArchiveHeapObjectsMapped},
{CC"isCDSIncluded", CC"()Z", (void*)&WB_IsCDSIncluded },
{CC"isJdkExploded", CC"()Z", (void*)&WB_IsJdkExploded },
{CC"isJFRIncluded", CC"()Z", (void*)&WB_IsJFRIncluded },
{CC"isDTraceIncluded", CC"()Z", (void*)&WB_IsDTraceIncluded },
{CC"hasLibgraal", CC"()Z", (void*)&WB_HasLibgraal },
Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/TEST.ROOT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2024, 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
Expand Down Expand Up @@ -87,7 +87,8 @@ requires.properties= \
vm.musl \
vm.flagless \
docker.support \
jdk.containerized
jdk.containerized \
jdk.exploded

# Minimum jtreg version
requiredVersion=7.3.1+1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Red Hat, Inc. All rights reserved.
* Copyright (c) 2023, 2024, 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
Expand All @@ -26,6 +27,9 @@
* @summary Test the various CPU-specific reservation schemes
* @requires vm.bits == 64 & !vm.graal.enabled & vm.debug == true
* @requires vm.flagless
* @requires vm.cds
* @requires !jdk.exploded
*
* @requires (os.family != "windows") & (os.family != "aix")
* @library /test/lib
* @modules java.base/jdk.internal.misc
Expand Down
3 changes: 2 additions & 1 deletion test/jdk/TEST.ROOT
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ requires.properties= \
docker.support \
release.implementor \
jdk.containerized \
jdk.foreign.linker
jdk.foreign.linker \
jdk.exploded

# Minimum jtreg version
requiredVersion=7.3.1+1
Expand Down
11 changes: 11 additions & 0 deletions test/jtreg-ext/requires/VMProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public Map<String, String> call() {
map.put("vm.cds", this::vmCDS);
map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders);
map.put("vm.cds.write.archived.java.heap", this::vmCDSCanWriteArchivedJavaHeap);
map.put("jdk.exploded", this::jdkExploded);
map.put("vm.continuations", this::vmContinuations);
// vm.graal.enabled is true if Graal is used as JIT
map.put("vm.graal.enabled", this::isGraalEnabled);
Expand All @@ -135,6 +136,7 @@ public Map<String, String> call() {
map.put("jdk.containerized", this::jdkContainerized);
map.put("vm.flagless", this::isFlagless);
map.put("jdk.foreign.linker", this::jdkForeignLinker);

vmGC(map); // vm.gc.X = true/false
vmGCforCDS(map); // may set vm.gc
vmOptFinalFlags(map);
Expand Down Expand Up @@ -465,6 +467,15 @@ protected String vmCDSCanWriteArchivedJavaHeap() {
return "" + ("true".equals(vmCDS()) && WB.canWriteJavaHeapArchive());
}

/**
* Check whether the test JDK is exploded. An exploded JDK will prohibit use of CDS.
*
* @return true if JDK is exploded
*/
protected String jdkExploded() {
return "" + WB.isJdkExploded();
}

/**
* @return "true" if this VM supports continuations.
*/
Expand Down
1 change: 1 addition & 0 deletions test/lib/jdk/test/whitebox/WhiteBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ public Object getMethodOption(Executable method, String name) {
public native boolean areSharedStringsMapped();
public native boolean isSharedInternedString(String s);
public native boolean isCDSIncluded();
public native boolean isJdkExploded();
public native boolean isJFRIncluded();
public native boolean isDTraceIncluded();
public native boolean canWriteJavaHeapArchive();
Expand Down