Skip to content

Commit 1173205

Browse files
Merge in jdk-24+36 (24.2)
PullRequest: labsjdk-ce/151
2 parents 85ebcc9 + 47fc4b7 commit 1173205

File tree

39 files changed

+1280
-5859
lines changed

39 files changed

+1280
-5859
lines changed

make/common/Modules.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2014, 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
@@ -92,7 +92,7 @@ SRC_SUBDIRS += share/classes
9292

9393
SPEC_SUBDIRS += share/specs
9494

95-
MAN_SUBDIRS += share/man
95+
MAN_SUBDIRS += share/man windows/man
9696

9797
# Find all module-info.java files for the current build target platform and
9898
# configuration.

make/conf/version-numbers.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ DEFAULT_VERSION_CLASSFILE_MINOR=0
3939
DEFAULT_VERSION_DOCS_API_SINCE=11
4040
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="23 24"
4141
DEFAULT_JDK_SOURCE_TARGET_VERSION=24
42-
DEFAULT_PROMOTED_VERSION_PRE=ea
42+
DEFAULT_PROMOTED_VERSION_PRE=

src/hotspot/share/cds/cdsConfig.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ void CDSConfig::check_flag_aliases() {
420420
bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) {
421421
check_flag_aliases();
422422

423+
if (!FLAG_IS_DEFAULT(AOTMode)) {
424+
// Using any form of the new AOTMode switch enables enhanced optimizations.
425+
FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);
426+
}
427+
423428
if (AOTClassLinking) {
424429
// If AOTClassLinking is specified, enable all AOT optimizations by default.
425430
FLAG_SET_ERGO_IF_DEFAULT(AOTInvokeDynamicLinking, true);

src/hotspot/share/cds/filemap.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,13 @@ bool FileMapInfo::validate_aot_class_linking() {
25112511
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with -Djava.security.manager=%s.", prop);
25122512
return false;
25132513
}
2514+
2515+
#if INCLUDE_JVMTI
2516+
if (Arguments::has_jdwp_agent()) {
2517+
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with JDWP agent");
2518+
return false;
2519+
}
2520+
#endif
25142521
}
25152522

25162523
return true;

src/hotspot/share/classfile/systemDictionaryShared.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
327327
if (!k->is_linked()) {
328328
if (has_class_failed_verification(k)) {
329329
return warn_excluded(k, "Failed verification");
330+
} else if (CDSConfig::is_dumping_aot_linked_classes()) {
331+
// Most loaded classes should have been speculatively linked by MetaspaceShared::link_class_for_cds().
332+
// However, we do not speculatively link old classes, as they are not recorded by
333+
// SystemDictionaryShared::record_linking_constraint(). As a result, such an unlinked
334+
// class may fail to verify in AOTLinkedClassBulkLoader::init_required_classes_for_loader(),
335+
// causing the JVM to fail at bootstrap.
336+
return warn_excluded(k, "Unlinked class not supported by AOTClassLinking");
330337
}
331338
} else {
332339
if (!k->can_be_verified_at_dumptime()) {

src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ static const Node* get_base_and_offset(const MachNode* mach, intptr_t& offset) {
559559
// The memory address is computed by 'base' and fed to 'mach' via an
560560
// indirect memory operand (indicated by offset == 0). The ultimate base and
561561
// offset can be fetched directly from the inputs and Ideal type of 'base'.
562-
offset = base->bottom_type()->isa_oopptr()->offset();
562+
const TypeOopPtr* oopptr = base->bottom_type()->isa_oopptr();
563+
if (oopptr == nullptr) return nullptr;
564+
offset = oopptr->offset();
563565
// Even if 'base' is not an Ideal AddP node anymore, Matcher::ReduceInst()
564566
// guarantees that the base address is still available at the same slot.
565567
base = base->in(AddPNode::Base);

src/hotspot/share/runtime/arguments.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ bool Arguments::_ClipInlining = ClipInlining;
103103
size_t Arguments::_default_SharedBaseAddress = SharedBaseAddress;
104104

105105
bool Arguments::_enable_preview = false;
106+
bool Arguments::_has_jdwp_agent = false;
106107

107108
LegacyGCLogging Arguments::_legacyGCLogging = { nullptr, 0 };
108109

@@ -2021,7 +2022,7 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
20212022
return JNI_OK;
20222023
}
20232024

2024-
#if !INCLUDE_JVMTI
2025+
#if !INCLUDE_JVMTI || INCLUDE_CDS
20252026
// Checks if name in command-line argument -agent{lib,path}:name[=options]
20262027
// represents a valid JDWP agent. is_path==true denotes that we
20272028
// are dealing with -agentpath (case where name is a path), otherwise with
@@ -2319,6 +2320,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin
23192320
"Debugging agents are not supported in this VM\n");
23202321
return JNI_ERR;
23212322
}
2323+
#elif INCLUDE_CDS
2324+
if (valid_jdwp_agent(name, is_absolute_path)) {
2325+
_has_jdwp_agent = true;
2326+
}
23222327
#endif // !INCLUDE_JVMTI
23232328
JvmtiAgentList::add(name, options, is_absolute_path);
23242329
os::free(name);

src/hotspot/share/runtime/arguments.hpp

Lines changed: 7 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
@@ -254,6 +254,9 @@ class Arguments : AllStatic {
254254
// preview features
255255
static bool _enable_preview;
256256

257+
// jdwp
258+
static bool _has_jdwp_agent;
259+
257260
// Used to save default settings
258261
static bool _AlwaysCompileLoopMethods;
259262
static bool _UseOnStackReplacement;
@@ -506,6 +509,9 @@ class Arguments : AllStatic {
506509
static void set_enable_preview() { _enable_preview = true; }
507510
static bool enable_preview() { return _enable_preview; }
508511

512+
// jdwp
513+
static bool has_jdwp_agent() { return _has_jdwp_agent; }
514+
509515
// Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
510516
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
511517

src/java.base/share/classes/java/lang/AbstractStringBuilder.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,14 @@ private AbstractStringBuilder appendNull() {
640640
int count = this.count;
641641
byte[] val = this.value;
642642
if (isLatin1()) {
643-
StringLatin1.putCharsAt(val, count, 'n', 'u', 'l', 'l');
643+
val[count++] = 'n';
644+
val[count++] = 'u';
645+
val[count++] = 'l';
646+
val[count++] = 'l';
644647
} else {
645-
StringUTF16.putCharsAt(val, count, 'n', 'u', 'l', 'l');
648+
count = StringUTF16.putCharsAt(val, count, 'n', 'u', 'l', 'l');
646649
}
647-
this.count = count + 4;
650+
this.count = count;
648651
return this;
649652
}
650653

@@ -769,18 +772,25 @@ public AbstractStringBuilder append(boolean b) {
769772
byte[] val = this.value;
770773
if (isLatin1()) {
771774
if (b) {
772-
StringLatin1.putCharsAt(val, count, 't', 'r', 'u', 'e');
775+
val[count++] = 't';
776+
val[count++] = 'r';
777+
val[count++] = 'u';
778+
val[count++] = 'e';
773779
} else {
774-
StringLatin1.putCharsAt(val, count, 'f', 'a', 'l', 's', 'e');
780+
val[count++] = 'f';
781+
val[count++] = 'a';
782+
val[count++] = 'l';
783+
val[count++] = 's';
784+
val[count++] = 'e';
775785
}
776786
} else {
777787
if (b) {
778-
StringUTF16.putCharsAt(val, count, 't', 'r', 'u', 'e');
788+
count = StringUTF16.putCharsAt(val, count, 't', 'r', 'u', 'e');
779789
} else {
780-
StringUTF16.putCharsAt(val, count, 'f', 'a', 'l', 's', 'e');
790+
count = StringUTF16.putCharsAt(val, count, 'f', 'a', 'l', 's', 'e');
781791
}
782792
}
783-
this.count = count + (b ? 4 : 5);
793+
this.count = count;
784794
return this;
785795
}
786796

src/java.base/share/classes/java/lang/StringConcatHelper.java

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,35 @@ static long prepend(long indexCoder, byte[] buf, boolean value, String prefix) {
236236
if (indexCoder < UTF16) {
237237
if (value) {
238238
index -= 4;
239-
StringLatin1.putCharsAt(buf, index, 't', 'r', 'u', 'e');
239+
buf[index] = 't';
240+
buf[index + 1] = 'r';
241+
buf[index + 2] = 'u';
242+
buf[index + 3] = 'e';
240243
} else {
241244
index -= 5;
242-
StringLatin1.putCharsAt(buf, index, 'f', 'a', 'l', 's', 'e');
245+
buf[index] = 'f';
246+
buf[index + 1] = 'a';
247+
buf[index + 2] = 'l';
248+
buf[index + 3] = 's';
249+
buf[index + 4] = 'e';
243250
}
244251
index -= prefix.length();
245252
prefix.getBytes(buf, index, String.LATIN1);
246253
return index;
247254
} else {
248255
if (value) {
249256
index -= 4;
250-
StringUTF16.putCharsAt(buf, index, 't', 'r', 'u', 'e');
257+
StringUTF16.putChar(buf, index, 't');
258+
StringUTF16.putChar(buf, index + 1, 'r');
259+
StringUTF16.putChar(buf, index + 2, 'u');
260+
StringUTF16.putChar(buf, index + 3, 'e');
251261
} else {
252262
index -= 5;
253-
StringUTF16.putCharsAt(buf, index, 'f', 'a', 'l', 's', 'e');
263+
StringUTF16.putChar(buf, index, 'f');
264+
StringUTF16.putChar(buf, index + 1, 'a');
265+
StringUTF16.putChar(buf, index + 2, 'l');
266+
StringUTF16.putChar(buf, index + 3, 's');
267+
StringUTF16.putChar(buf, index + 4, 'e');
254268
}
255269
index -= prefix.length();
256270
prefix.getBytes(buf, index, String.UTF16);
@@ -624,20 +638,34 @@ static int prepend(int index, byte coder, byte[] buf, boolean value, String pref
624638
if (coder == String.LATIN1) {
625639
if (value) {
626640
index -= 4;
627-
StringLatin1.putCharsAt(buf, index, 't', 'r', 'u', 'e');
641+
buf[index] = 't';
642+
buf[index + 1] = 'r';
643+
buf[index + 2] = 'u';
644+
buf[index + 3] = 'e';
628645
} else {
629646
index -= 5;
630-
StringLatin1.putCharsAt(buf, index, 'f', 'a', 'l', 's', 'e');
647+
buf[index] = 'f';
648+
buf[index + 1] = 'a';
649+
buf[index + 2] = 'l';
650+
buf[index + 3] = 's';
651+
buf[index + 4] = 'e';
631652
}
632653
index -= prefix.length();
633654
prefix.getBytes(buf, index, String.LATIN1);
634655
} else {
635656
if (value) {
636657
index -= 4;
637-
StringUTF16.putCharsAt(buf, index, 't', 'r', 'u', 'e');
658+
StringUTF16.putChar(buf, index, 't');
659+
StringUTF16.putChar(buf, index + 1, 'r');
660+
StringUTF16.putChar(buf, index + 2, 'u');
661+
StringUTF16.putChar(buf, index + 3, 'e');
638662
} else {
639663
index -= 5;
640-
StringUTF16.putCharsAt(buf, index, 'f', 'a', 'l', 's', 'e');
664+
StringUTF16.putChar(buf, index, 'f');
665+
StringUTF16.putChar(buf, index + 1, 'a');
666+
StringUTF16.putChar(buf, index + 2, 'l');
667+
StringUTF16.putChar(buf, index + 3, 's');
668+
StringUTF16.putChar(buf, index + 4, 'e');
641669
}
642670
index -= prefix.length();
643671
prefix.getBytes(buf, index, String.UTF16);

0 commit comments

Comments
 (0)