Skip to content

Commit e98df71

Browse files
committed
8348028: Unable to run gtests with CDS enabled
Reviewed-by: dholmes, iklam, ihse
1 parent d6c4be6 commit e98df71

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

make/hotspot/lib/CompileJvm.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ CFLAGS_VM_VERSION := \
8989
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
9090
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
9191
-DHOTSPOT_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"' \
92+
-DJVM_VARIANT='"$(JVM_VARIANT)"' \
9293
#
9394

9495
################################################################################

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,6 @@ static char cpu_arch[] = "ppc";
242242
#error Add appropriate cpu_arch setting
243243
#endif
244244

245-
// JVM variant
246-
#if defined(ZERO)
247-
#define JVM_VARIANT "zero"
248-
#elif defined(COMPILER2)
249-
#define JVM_VARIANT "server"
250-
#else
251-
#define JVM_VARIANT "client"
252-
#endif
253-
254-
255245
void os::Bsd::initialize_system_info() {
256246
int mib[2];
257247
size_t len;
@@ -1558,7 +1548,7 @@ void os::jvm_path(char *buf, jint buflen) {
15581548
// Add the appropriate JVM variant subdir
15591549
len = strlen(buf);
15601550
jrelib_p = buf + len;
1561-
snprintf(jrelib_p, buflen-len, "/%s", JVM_VARIANT);
1551+
snprintf(jrelib_p, buflen-len, "/%s", Abstract_VM_Version::vm_variant());
15621552
if (0 != access(buf, F_OK)) {
15631553
snprintf(jrelib_p, buflen-len, "%s", "");
15641554
}

src/hotspot/share/cds/cdsConfig.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ void CDSConfig::initialize() {
8989

9090
char* CDSConfig::default_archive_path() {
9191
if (_default_archive_path == nullptr) {
92-
char jvm_path[JVM_MAXPATHLEN];
93-
os::jvm_path(jvm_path, sizeof(jvm_path));
94-
char *end = strrchr(jvm_path, *os::file_separator());
95-
if (end != nullptr) *end = '\0';
9692
stringStream tmp;
97-
tmp.print("%s%sclasses", jvm_path, os::file_separator());
93+
const char* subdir = WINDOWS_ONLY("bin") NOT_WINDOWS("lib");
94+
tmp.print("%s%s%s%s%s%sclasses", Arguments::get_java_home(), os::file_separator(), subdir,
95+
os::file_separator(), Abstract_VM_Version::vm_variant(), os::file_separator());
9896
#ifdef _LP64
9997
if (!UseCompressedOops) {
10098
tmp.print_raw("_nocoops");

src/hotspot/share/runtime/abstract_vm_version.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ VirtualizationType Abstract_VM_Version::_detected_virtualization = NoDetectedVir
8181
#error HOTSPOT_BUILD_TIME must be defined
8282
#endif
8383

84+
#ifndef JVM_VARIANT
85+
#error JVM_VARIANT must be defined
86+
#endif
87+
8488
#define VM_RELEASE HOTSPOT_VERSION_STRING
8589

8690
// HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
@@ -195,6 +199,10 @@ const char *Abstract_VM_Version::vm_platform_string() {
195199
return OS "-" CPU;
196200
}
197201

202+
const char* Abstract_VM_Version::vm_variant() {
203+
return JVM_VARIANT;
204+
}
205+
198206
const char* Abstract_VM_Version::internal_vm_info_string() {
199207
#ifndef HOTSPOT_BUILD_COMPILER
200208
#ifdef _MSC_VER

src/hotspot/share/runtime/abstract_vm_version.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, 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
@@ -110,6 +110,7 @@ class Abstract_VM_Version: AllStatic {
110110
static const char* vm_info_string();
111111
static const char* vm_release();
112112
static const char* vm_platform_string();
113+
static const char* vm_variant();
113114

114115
static int vm_major_version() { return _vm_major_version; }
115116
static int vm_minor_version() { return _vm_minor_version; }

0 commit comments

Comments
 (0)