Skip to content

Commit 2ced774

Browse files
committed
Merge branch 'master' into jdk-8333446-systemd-slice-tests
2 parents 139a906 + d41d2a7 commit 2ced774

File tree

337 files changed

+4647
-2855
lines changed

Some content is hidden

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

337 files changed

+4647
-2855
lines changed

make/Docs.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# This code is free software; you can redistribute it and/or modify it
@@ -714,7 +714,7 @@ SPEC_HEADER_BLOCK := \
714714
<div class="navbar"> \
715715
<div>$(HEADER_RIGHT_SIDE_INFO)</div> \
716716
<nav><ul><li><a href="PATH_TO_SPECS/../api/index.html">API</a> \
717-
<li><a href="PATH_TO_SPECS/index.html">OTHER SPECIFICATIONS \
717+
<li><a href="PATH_TO_SPECS/index.html">OTHER SPECIFICATIONS</a> \
718718
<li><a href="PATH_TO_SPECS/man/index.html">TOOL GUIDES</a></ul></nav> \
719719
</div> \
720720
</header>

make/InitSupport.gmk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ ifeq ($(HAS_SPEC),)
6363

6464
# The variable MAKEOVERRIDES contains variable assignments from the command
6565
# line, but in reverse order to what the user entered.
66-
# The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
67-
COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
66+
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
67+
COMMAND_LINE_VARIABLES := $(subst §,\ , $(call reverse, $(subst \ ,§,$(MAKEOVERRIDES))))
6868

6969
# A list like FOO="val1" BAR="val2" containing all user-supplied make
7070
# variables that we should propagate.
71-
# The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
72-
USER_MAKE_VARS := $(subst \#,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
73-
$(subst \ ,\#,$(MAKEOVERRIDES))))
71+
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
72+
USER_MAKE_VARS := $(subst §,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
73+
$(subst \ ,§,$(MAKEOVERRIDES))))
7474

7575
# Setup information about available configurations, if any.
7676
ifneq ($(CUSTOM_ROOT), )

make/jdk/src/classes/build/tools/taglet/SealedGraph.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2024, 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
@@ -107,7 +107,7 @@ public String toString(List<? extends DocTree> tags, Element element) {
107107
throw new RuntimeException(e);
108108
}
109109

110-
String simpleTypeName = element.getSimpleName().toString();
110+
String simpleTypeName = packagelessCanonicalName(typeElement).replace('.', '/');
111111
String imageFile = simpleTypeName + "-sealed-graph.svg";
112112
int thumbnailHeight = 100; // also appears in the stylesheet
113113
String hoverImage = "<span>"
@@ -315,14 +315,14 @@ private static Optional<String> packageName(TypeElement element) {
315315
case MEMBER -> packageName((TypeElement) element.getEnclosingElement());
316316
};
317317
}
318+
}
318319

319-
private static String packagelessCanonicalName(TypeElement element) {
320-
String result = element.getSimpleName().toString();
321-
while (element.getNestingKind() == NestingKind.MEMBER) {
322-
element = (TypeElement) element.getEnclosingElement();
323-
result = element.getSimpleName().toString() + '.' + result;
324-
}
325-
return result;
320+
private static String packagelessCanonicalName(TypeElement element) {
321+
String result = element.getSimpleName().toString();
322+
while (element.getNestingKind() == NestingKind.MEMBER) {
323+
element = (TypeElement) element.getEnclosingElement();
324+
result = element.getSimpleName().toString() + '.' + result;
326325
}
326+
return result;
327327
}
328328
}

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3360,7 +3360,7 @@ encode %{
33603360
}
33613361
%}
33623362

3363-
/// mov envcodings
3363+
// mov encodings
33643364

33653365
enc_class aarch64_enc_movw_imm(iRegI dst, immI src) %{
33663366
uint32_t con = (uint32_t)$src$$constant;

src/hotspot/cpu/aarch64/globalDefinitions_aarch64.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -76,4 +76,6 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
7676

7777
#define USE_POINTERS_TO_REGISTER_IMPL_ARRAY
7878

79+
#define USE_TRAMPOLINE_STUB_FIX_OWNER
80+
7981
#endif // CPU_AARCH64_GLOBALDEFINITIONS_AARCH64_HPP

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,7 @@ void InterpreterMacroAssembler::notify_method_entry() {
14181418
bind(L);
14191419
}
14201420

1421-
{
1422-
SkipIfEqual skip(this, &DTraceMethodProbes, false);
1421+
if (DTraceMethodProbes) {
14231422
get_method(c_rarg1);
14241423
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
14251424
rthread, c_rarg1);
@@ -1458,8 +1457,7 @@ void InterpreterMacroAssembler::notify_method_exit(
14581457
pop(state);
14591458
}
14601459

1461-
{
1462-
SkipIfEqual skip(this, &DTraceMethodProbes, false);
1460+
if (DTraceMethodProbes) {
14631461
push(state);
14641462
get_method(c_rarg1);
14651463
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),

src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -51,13 +51,18 @@ void NativeInstruction::wrote(int offset) {
5151
}
5252

5353
address NativeCall::destination() const {
54-
address addr = (address)this;
55-
address destination = instruction_address() + displacement();
54+
address addr = instruction_address();
55+
address destination = addr + displacement();
56+
57+
// Performance optimization: no need to call find_blob() if it is a self-call
58+
if (destination == addr) {
59+
return destination;
60+
}
5661

5762
// Do we use a trampoline stub for this call?
5863
CodeBlob* cb = CodeCache::find_blob(addr);
59-
assert(cb && cb->is_nmethod(), "sanity");
60-
nmethod *nm = (nmethod *)cb;
64+
assert(cb != nullptr && cb->is_nmethod(), "nmethod expected");
65+
nmethod *nm = cb->as_nmethod();
6166
if (nm->stub_contains(destination) && is_NativeCallTrampolineStub_at(destination)) {
6267
// Yes we do, so get the destination from the trampoline stub.
6368
const address trampoline_stub_addr = destination;
@@ -72,12 +77,8 @@ address NativeCall::destination() const {
7277
// call instruction at all times.
7378
//
7479
// Used in the runtime linkage of calls; see class CompiledIC.
75-
//
76-
// Add parameter assert_lock to switch off assertion
77-
// during code generation, where no patching lock is needed.
78-
void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
79-
assert(!assert_lock ||
80-
(Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
80+
void NativeCall::set_destination_mt_safe(address dest) {
81+
assert((Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
8182
CompiledICLocker::is_safe(addr_at(0)),
8283
"concurrent code patching");
8384

@@ -104,22 +105,18 @@ void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
104105
}
105106

106107
address NativeCall::get_trampoline() {
107-
address call_addr = addr_at(0);
108+
address call_addr = instruction_address();
108109

109110
CodeBlob *code = CodeCache::find_blob(call_addr);
110-
assert(code != nullptr, "Could not find the containing code blob");
111+
assert(code != nullptr && code->is_nmethod(), "nmethod expected");
112+
nmethod* nm = code->as_nmethod();
111113

112-
address bl_destination
113-
= MacroAssembler::pd_call_destination(call_addr);
114-
if (code->contains(bl_destination) &&
114+
address bl_destination = call_addr + displacement();
115+
if (nm->stub_contains(bl_destination) &&
115116
is_NativeCallTrampolineStub_at(bl_destination))
116117
return bl_destination;
117118

118-
if (code->is_nmethod()) {
119-
return trampoline_stub_Relocation::get_trampoline_for(call_addr, (nmethod*)code);
120-
}
121-
122-
return nullptr;
119+
return trampoline_stub_Relocation::get_trampoline_for(call_addr, nm);
123120
}
124121

125122
// Inserts a native call instruction at a given pc

src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2108, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -174,6 +174,7 @@ class NativeCall: public NativeInstruction {
174174
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
175175
address displacement_address() const { return addr_at(displacement_offset); }
176176
address return_address() const { return addr_at(return_address_offset); }
177+
address raw_destination() const { return instruction_address() + displacement(); }
177178
address destination() const;
178179

179180
void set_destination(address dest) {
@@ -213,9 +214,7 @@ class NativeCall: public NativeInstruction {
213214
//
214215
// Used in the runtime linkage of calls; see class CompiledIC.
215216
// (Cf. 4506997 and 4479829, where threads witnessed garbage displacements.)
216-
217-
// The parameter assert_lock disables the assertion during code generation.
218-
void set_destination_mt_safe(address dest, bool assert_lock = true);
217+
void set_destination_mt_safe(address dest);
219218

220219
address get_trampoline();
221220
#if INCLUDE_JVMCI

src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ void Relocation::pd_set_data_value(address x, bool verify_only) {
6060

6161
address Relocation::pd_call_destination(address orig_addr) {
6262
assert(is_call(), "should be a call here");
63-
if (NativeCall::is_call_at(addr())) {
64-
address trampoline = nativeCall_at(addr())->get_trampoline();
65-
if (trampoline) {
66-
return nativeCallTrampolineStub_at(trampoline)->destination();
63+
if (orig_addr == nullptr) {
64+
if (NativeCall::is_call_at(addr())) {
65+
NativeCall* call = nativeCall_at(addr());
66+
return call->destination();
6767
}
68-
}
69-
if (orig_addr != nullptr) {
68+
} else {
7069
address new_addr = MacroAssembler::pd_call_destination(orig_addr);
7170
// If call is branch to self, don't try to relocate it, just leave it
7271
// as branch to self. This happens during code generation if the code
@@ -82,16 +81,26 @@ address Relocation::pd_call_destination(address orig_addr) {
8281
void Relocation::pd_set_call_destination(address x) {
8382
assert(is_call(), "should be a call here");
8483
if (NativeCall::is_call_at(addr())) {
85-
address trampoline = nativeCall_at(addr())->get_trampoline();
86-
if (trampoline) {
87-
nativeCall_at(addr())->set_destination_mt_safe(x, /* assert_lock */false);
88-
return;
89-
}
84+
NativeCall* call = nativeCall_at(addr());
85+
call->set_destination(x);
86+
} else {
87+
MacroAssembler::pd_patch_instruction(addr(), x);
9088
}
91-
MacroAssembler::pd_patch_instruction(addr(), x);
9289
assert(pd_call_destination(addr()) == x, "fail in reloc");
9390
}
9491

92+
void trampoline_stub_Relocation::pd_fix_owner_after_move() {
93+
NativeCall* call = nativeCall_at(owner());
94+
assert(call->raw_destination() == owner(), "destination should be empty");
95+
address trampoline = addr();
96+
address dest = nativeCallTrampolineStub_at(trampoline)->destination();
97+
if (!Assembler::reachable_from_branch_at(owner(), dest)) {
98+
dest = trampoline;
99+
}
100+
call->set_destination(dest);
101+
}
102+
103+
95104
address* Relocation::pd_address_in_code() {
96105
return (address*)(addr() + 8);
97106
}

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,11 +1754,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
17541754
__ set_last_Java_frame(sp, noreg, native_return, rscratch1);
17551755

17561756
Label dtrace_method_entry, dtrace_method_entry_done;
1757-
{
1758-
uint64_t offset;
1759-
__ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset);
1760-
__ ldrb(rscratch1, Address(rscratch1, offset));
1761-
__ cbnzw(rscratch1, dtrace_method_entry);
1757+
if (DTraceMethodProbes) {
1758+
__ b(dtrace_method_entry);
17621759
__ bind(dtrace_method_entry_done);
17631760
}
17641761

@@ -1990,11 +1987,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
19901987
}
19911988

19921989
Label dtrace_method_exit, dtrace_method_exit_done;
1993-
{
1994-
uint64_t offset;
1995-
__ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset);
1996-
__ ldrb(rscratch1, Address(rscratch1, offset));
1997-
__ cbnzw(rscratch1, dtrace_method_exit);
1990+
if (DTraceMethodProbes) {
1991+
__ b(dtrace_method_exit);
19981992
__ bind(dtrace_method_exit_done);
19991993
}
20001994

@@ -2138,37 +2132,38 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
21382132
}
21392133

21402134
// SLOW PATH dtrace support
2141-
{
2142-
__ block_comment("dtrace entry {");
2143-
__ bind(dtrace_method_entry);
2144-
2145-
// We have all of the arguments setup at this point. We must not touch any register
2146-
// argument registers at this point (what if we save/restore them there are no oop?
2147-
2148-
save_args(masm, total_c_args, c_arg, out_regs);
2149-
__ mov_metadata(c_rarg1, method());
2150-
__ call_VM_leaf(
2151-
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
2152-
rthread, c_rarg1);
2153-
restore_args(masm, total_c_args, c_arg, out_regs);
2154-
__ b(dtrace_method_entry_done);
2155-
__ block_comment("} dtrace entry");
2156-
}
2135+
if (DTraceMethodProbes) {
2136+
{
2137+
__ block_comment("dtrace entry {");
2138+
__ bind(dtrace_method_entry);
2139+
2140+
// We have all of the arguments setup at this point. We must not touch any register
2141+
// argument registers at this point (what if we save/restore them there are no oop?
2142+
2143+
save_args(masm, total_c_args, c_arg, out_regs);
2144+
__ mov_metadata(c_rarg1, method());
2145+
__ call_VM_leaf(
2146+
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
2147+
rthread, c_rarg1);
2148+
restore_args(masm, total_c_args, c_arg, out_regs);
2149+
__ b(dtrace_method_entry_done);
2150+
__ block_comment("} dtrace entry");
2151+
}
21572152

2158-
{
2159-
__ block_comment("dtrace exit {");
2160-
__ bind(dtrace_method_exit);
2161-
save_native_result(masm, ret_type, stack_slots);
2162-
__ mov_metadata(c_rarg1, method());
2163-
__ call_VM_leaf(
2164-
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2165-
rthread, c_rarg1);
2166-
restore_native_result(masm, ret_type, stack_slots);
2167-
__ b(dtrace_method_exit_done);
2168-
__ block_comment("} dtrace exit");
2153+
{
2154+
__ block_comment("dtrace exit {");
2155+
__ bind(dtrace_method_exit);
2156+
save_native_result(masm, ret_type, stack_slots);
2157+
__ mov_metadata(c_rarg1, method());
2158+
__ call_VM_leaf(
2159+
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2160+
rthread, c_rarg1);
2161+
restore_native_result(masm, ret_type, stack_slots);
2162+
__ b(dtrace_method_exit_done);
2163+
__ block_comment("} dtrace exit");
2164+
}
21692165
}
21702166

2171-
21722167
__ flush();
21732168

21742169
nmethod *nm = nmethod::new_native_nmethod(method,

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,8 +3648,7 @@ void TemplateTable::_new() {
36483648
__ store_klass_gap(r0, zr); // zero klass gap for compressed oops
36493649
__ store_klass(r0, r4); // store klass last
36503650

3651-
{
3652-
SkipIfEqual skip(_masm, &DTraceAllocProbes, false);
3651+
if (DTraceAllocProbes) {
36533652
// Trigger dtrace event for fastpath
36543653
__ push(atos); // save the return value
36553654
__ call_VM_leaf(

src/hotspot/cpu/ppc/templateTable_ppc_64.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,10 +3859,11 @@ void TemplateTable::_new() {
38593859
__ store_klass(RallocatedObject, RinstanceKlass, Rscratch); // klass (last for cms)
38603860

38613861
// Check and trigger dtrace event.
3862-
SkipIfEqualZero::skip_to_label_if_equal_zero(_masm, Rscratch, &DTraceAllocProbes, Ldone);
3863-
__ push(atos);
3864-
__ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)));
3865-
__ pop(atos);
3862+
if (DTraceAllocProbes) {
3863+
__ push(atos);
3864+
__ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)));
3865+
__ pop(atos);
3866+
}
38663867

38673868
__ b(Ldone);
38683869
}

src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
318318
}
319319
Address resolve(SharedRuntime::get_resolve_static_call_stub(),
320320
relocInfo::static_call_type);
321-
address call = __ trampoline_call(resolve);
321+
address call = __ reloc_call(resolve);
322322
if (call == nullptr) {
323323
ce->bailout("trampoline stub overflow");
324324
return;

0 commit comments

Comments
 (0)