8348028: Unable to run gtests with CDS enabled

Reviewed-by: dholmes, iklam, ihse
This commit is contained in:
Calvin Cheung 2025-02-28 17:08:25 +00:00
parent d6c4be672f
commit e98df71d9c
5 changed files with 15 additions and 17 deletions

View File

@ -89,6 +89,7 @@ CFLAGS_VM_VERSION := \
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
-DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"' \
-DJVM_VARIANT='"$(JVM_VARIANT)"' \
#
################################################################################

View File

@ -242,16 +242,6 @@ static char cpu_arch[] = "ppc";
#error Add appropriate cpu_arch setting
#endif
// JVM variant
#if defined(ZERO)
#define JVM_VARIANT "zero"
#elif defined(COMPILER2)
#define JVM_VARIANT "server"
#else
#define JVM_VARIANT "client"
#endif
void os::Bsd::initialize_system_info() {
int mib[2];
size_t len;
@ -1558,7 +1548,7 @@ void os::jvm_path(char *buf, jint buflen) {
// Add the appropriate JVM variant subdir
len = strlen(buf);
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/%s", JVM_VARIANT);
snprintf(jrelib_p, buflen-len, "/%s", Abstract_VM_Version::vm_variant());
if (0 != access(buf, F_OK)) {
snprintf(jrelib_p, buflen-len, "%s", "");
}

View File

@ -89,12 +89,10 @@ void CDSConfig::initialize() {
char* CDSConfig::default_archive_path() {
if (_default_archive_path == nullptr) {
char jvm_path[JVM_MAXPATHLEN];
os::jvm_path(jvm_path, sizeof(jvm_path));
char *end = strrchr(jvm_path, *os::file_separator());
if (end != nullptr) *end = '\0';
stringStream tmp;
tmp.print("%s%sclasses", jvm_path, os::file_separator());
const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
tmp.print("%s%s%s%s%s%sclasses", Arguments::get_java_home(), os::file_separator(), subdir,
os::file_separator(), Abstract_VM_Version::vm_variant(), os::file_separator());
#ifdef _LP64
if (!UseCompressedOops) {
tmp.print_raw("_nocoops");

View File

@ -81,6 +81,10 @@ VirtualizationType Abstract_VM_Version::_detected_virtualization = NoDetectedVir
#error HOTSPOT_BUILD_TIME must be defined
#endif
#ifndef JVM_VARIANT
#error JVM_VARIANT must be defined
#endif
#define VM_RELEASE HOTSPOT_VERSION_STRING
// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
@ -195,6 +199,10 @@ const char *Abstract_VM_Version::vm_platform_string() {
return OS "-" CPU;
}
const char* Abstract_VM_Version::vm_variant() {
return JVM_VARIANT;
}
const char* Abstract_VM_Version::internal_vm_info_string() {
#ifndef HOTSPOT_BUILD_COMPILER
#ifdef _MSC_VER

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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
@ -110,6 +110,7 @@ class Abstract_VM_Version: AllStatic {
static const char* vm_info_string();
static const char* vm_release();
static const char* vm_platform_string();
static const char* vm_variant();
static int vm_major_version() { return _vm_major_version; }
static int vm_minor_version() { return _vm_minor_version; }