8349620: Add VMProps for static JDK

Reviewed-by: alanb, manc
This commit is contained in:
Jiangli Zhou 2025-02-20 15:47:54 +00:00
parent 735805d925
commit 960ad21186
6 changed files with 19 additions and 3 deletions

View File

@ -47,6 +47,7 @@
#include "gc/shared/gcConfig.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "gc/shared/genArguments.hpp"
#include "jvm.h"
#include "jvmtifiles/jvmtiEnv.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
@ -1804,6 +1805,10 @@ WB_ENTRY(jlong, WB_RootChunkWordSize(JNIEnv* env))
return (jlong)Metaspace::reserve_alignment_words();
WB_END
WB_ENTRY(jboolean, WB_IsStaticallyLinked(JNIEnv* env, jobject wb))
return JVM_IsStaticallyLinked();
WB_END
//////////////
WB_ENTRY(jlong, WB_AllocateMetaspace(JNIEnv* env, jobject wb, jobject class_loader, jlong size))
@ -3003,7 +3008,8 @@ static JNINativeMethod methods[] = {
{CC"printString", CC"(Ljava/lang/String;I)Ljava/lang/String;", (void*)&WB_PrintString},
{CC"lockAndStuckInSafepoint", CC"()V", (void*)&WB_TakeLockAndHangInSafepoint},
{CC"wordSize", CC"()J", (void*)&WB_WordSize},
{CC"rootChunkWordSize", CC"()J", (void*)&WB_RootChunkWordSize}
{CC"rootChunkWordSize", CC"()J", (void*)&WB_RootChunkWordSize},
{CC"isStatic", CC"()Z", (void*)&WB_IsStaticallyLinked}
};

View File

@ -92,7 +92,8 @@ requires.properties= \
systemd.support \
jdk.containerized \
jlink.runtime.linkable \
jlink.packagedModules
jlink.packagedModules \
jdk.static
# Minimum jtreg version
requiredVersion=7.5.1+1

View File

@ -27,6 +27,7 @@
* @bug 8220095
* @requires os.family == "linux" | os.family == "mac"
* @requires vm.flagless
* @requires !jdk.static
* @library /test/lib
* @modules java.management
* jdk.jlink

View File

@ -111,7 +111,8 @@ requires.properties= \
jdk.containerized \
jdk.foreign.linker \
jlink.runtime.linkable \
jlink.packagedModules
jlink.packagedModules \
jdk.static
# Minimum jtreg version
requiredVersion=7.5.1+1

View File

@ -140,6 +140,7 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.flagless", this::isFlagless);
map.put("jdk.foreign.linker", this::jdkForeignLinker);
map.put("jlink.packagedModules", this::packagedModules);
map.put("jdk.static", this::isStatic);
vmGC(map); // vm.gc.X = true/false
vmGCforCDS(map); // may set vm.gc
vmOptFinalFlags(map);
@ -820,6 +821,10 @@ public class VMProps implements Callable<Map<String, String>> {
return String.valueOf(CABI.current());
}
private String isStatic() {
return Boolean.toString(WB.isStatic());
}
/**
* Dumps the map to the file if the file name is given as the property.
* This functionality could be helpful to know context in the real

View File

@ -798,4 +798,6 @@ public class WhiteBox {
public native void preTouchMemory(long addr, long size);
public native long rss();
public native boolean isStatic();
}