Skip to content

Commit 5033376

Browse files
author
Rob McKenna
committed
Merge
2 parents c082dcf + 47c15b5 commit 5033376

File tree

76 files changed

+3641
-4215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3641
-4215
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.

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/opto/callGenerator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,9 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms) {
933933

934934
// Make the hot call:
935935
JVMState* new_jvms = _if_hit->generate(kit.sync_jvms());
936+
if (kit.failing()) {
937+
return nullptr;
938+
}
936939
if (new_jvms == nullptr) {
937940
// Inline failed, so make a direct call.
938941
assert(_if_hit->is_inline(), "must have been a failed inline");
@@ -1260,6 +1263,9 @@ JVMState* PredicatedIntrinsicGenerator::generate(JVMState* jvms) {
12601263
PreserveJVMState pjvms(&kit);
12611264
// Generate intrinsic code:
12621265
JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms());
1266+
if (kit.failing()) {
1267+
return nullptr;
1268+
}
12631269
if (new_jvms == nullptr) {
12641270
// Intrinsic failed, use normal compilation path for this predicate.
12651271
slow_region->add_req(kit.control());

src/hotspot/share/opto/library_call.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4309,7 +4309,12 @@ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region,
43094309
if (obj != nullptr && is_array_ctrl != nullptr && is_array_ctrl != top()) {
43104310
// Keep track of the fact that 'obj' is an array to prevent
43114311
// array specific accesses from floating above the guard.
4312-
*obj = _gvn.transform(new CastPPNode(is_array_ctrl, *obj, TypeAryPtr::BOTTOM));
4312+
Node* cast = _gvn.transform(new CastPPNode(is_array_ctrl, *obj, TypeAryPtr::BOTTOM));
4313+
// Check for top because in rare cases, the type system can determine that
4314+
// the object can't be an array but the layout helper check is not folded.
4315+
if (!cast->is_top()) {
4316+
*obj = cast;
4317+
}
43134318
}
43144319
return ctrl;
43154320
}

src/hotspot/share/opto/library_call.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ class LibraryCallKit : public GraphKit {
106106
void push_result() {
107107
// Push the result onto the stack.
108108
if (!stopped() && result() != nullptr) {
109+
if (result()->is_top()) {
110+
assert(false, "Can't determine return value.");
111+
C->record_method_not_compilable("Can't determine return value.");
112+
}
109113
BasicType bt = result()->bottom_type()->basic_type();
110114
push_node(bt, result());
111115
}

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/classfile/AccessFlags.java

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 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
@@ -30,37 +30,70 @@
3030
import jdk.internal.classfile.impl.AccessFlagsImpl;
3131

3232
/**
33-
* Models the access flags for a class, method, or field. Delivered as a
34-
* {@link ClassElement}, {@link FieldElement}, or {@link MethodElement}
35-
* when traversing the corresponding model type.
33+
* Models the access flags for a class, method, or field. The access flags
34+
* appears exactly once in each class, method, or field; a {@link
35+
* ClassBuilder} and a {@link FieldBuilder} chooses an unspecified default value
36+
* if access flags are not provided, and a {@link MethodBuilder} is always
37+
* created with access flags.
38+
* <p>
39+
* {@code AccessFlags} cannot be created via a factory method directly; it can
40+
* be created with {@code withFlags} methods on the respective builders.
41+
* <p>
42+
* A {@link MethodBuilder} throws an {@link IllegalArgumentException} if it is
43+
* supplied an {@code AccessFlags} object that changes the preexisting
44+
* {@link ClassFile#ACC_STATIC ACC_STATIC} flag of the builder, because the
45+
* access flag change may invalidate previously supplied data to the builder.
3646
*
47+
* @apiNote
48+
* The access flags of classes, methods, and fields are modeled as a standalone
49+
* object to support streaming as elements for {@link ClassFileTransform}.
50+
* Other access flags are not elements of a {@link CompoundElement} and thus not
51+
* modeled by {@code AccessFlags}; they provide their own {@code flagsMask},
52+
* {@code flags}, and {@code has} methods.
53+
*
54+
* @see ClassModel#flags()
55+
* @see FieldModel#flags()
56+
* @see MethodModel#flags()
57+
* @see ClassBuilder#withFlags
58+
* @see FieldBuilder#withFlags
59+
* @see MethodBuilder#withFlags
3760
* @since 24
3861
*/
3962
public sealed interface AccessFlags
4063
extends ClassElement, MethodElement, FieldElement
4164
permits AccessFlagsImpl {
4265

4366
/**
44-
* {@return the access flags, as a bit mask}
67+
* {@return the access flags, as a bit mask} It is in the range of unsigned
68+
* short, {@code [0, 0xFFFF]}.
4569
*/
4670
int flagsMask();
4771

4872
/**
49-
* {@return the access flags}
73+
* {@return the access flags, as a set of flag enums}
74+
*
75+
* @throws IllegalArgumentException if the flags mask has any undefined bit set
76+
* @see #location()
5077
*/
5178
Set<AccessFlag> flags();
5279

5380
/**
54-
* {@return whether the specified flag is present} The specified flag
55-
* should be a valid flag for the classfile location associated with this
56-
* element otherwise false is returned.
81+
* {@return whether the specified flag is set} If the specified flag
82+
* is not available to this {@linkplain #location() location}, returns
83+
* {@code false}.
84+
*
5785
* @param flag the flag to test
86+
* @see #location()
5887
*/
5988
boolean has(AccessFlag flag);
6089

6190
/**
62-
* {@return the classfile location for this element, which is either class,
63-
* method, or field}
91+
* {@return the {@code class} file location for this element, which is
92+
* either class, method, or field}
93+
*
94+
* @see AccessFlag.Location#CLASS
95+
* @see AccessFlag.Location#FIELD
96+
* @see AccessFlag.Location#METHOD
6497
*/
6598
AccessFlag.Location location();
6699
}

0 commit comments

Comments
 (0)