Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Aug 3, 2024
2 parents 74aead3 + 34edc73 commit ed2eb9e
Show file tree
Hide file tree
Showing 131 changed files with 1,540 additions and 1,486 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, 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
Expand Down Expand Up @@ -375,7 +375,7 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
__ load_method_holder_cld(rscratch1, rmethod);

// Is it a strong CLD?
__ ldrw(rscratch2, Address(rscratch1, ClassLoaderData::keep_alive_offset()));
__ ldrw(rscratch2, Address(rscratch1, ClassLoaderData::keep_alive_ref_count_offset()));
__ cbnz(rscratch2, method_live);

// Is it a weak but alive CLD?
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void MacroAssembler::reserved_stack_check() {
br(Assembler::LO, no_reserved_zone_enabling);

enter(); // LR and FP are live.
lea(rscratch1, CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone));
lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone)));
mov(c_rarg0, rthread);
blr(rscratch1);
leave();
Expand Down Expand Up @@ -1879,7 +1879,7 @@ void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file,
movptr(rscratch1, (uintptr_t)(address)b);

// call indirectly to solve generation ordering problem
lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
lea(rscratch2, RuntimeAddress(StubRoutines::verify_oop_subroutine_entry_address()));
ldr(rscratch2, Address(rscratch2));
blr(rscratch2);

Expand Down Expand Up @@ -1918,7 +1918,7 @@ void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* f
movptr(rscratch1, (uintptr_t)(address)b);

// call indirectly to solve generation ordering problem
lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
lea(rscratch2, RuntimeAddress(StubRoutines::verify_oop_subroutine_entry_address()));
ldr(rscratch2, Address(rscratch2));
blr(rscratch2);

Expand Down Expand Up @@ -6454,7 +6454,7 @@ void MacroAssembler::verify_cross_modify_fence_not_required() {
Label fence_not_required;
cbz(rscratch1, fence_not_required);
// If it does then fail.
lea(rscratch1, CAST_FROM_FN_PTR(address, JavaThread::verify_cross_modify_fence_failure));
lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::verify_cross_modify_fence_failure)));
mov(c_rarg0, rthread);
blr(rscratch1);
bind(fence_not_required);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7045,7 +7045,7 @@ class StubGenerator: public StubCodeGenerator {
Label thaw_success;
// rscratch2 contains the size of the frames to thaw, 0 if overflow or no more frames
__ cbnz(rscratch2, thaw_success);
__ lea(rscratch1, ExternalAddress(StubRoutines::throw_StackOverflowError_entry()));
__ lea(rscratch1, RuntimeAddress(StubRoutines::throw_StackOverflowError_entry()));
__ br(rscratch1);
__ bind(thaw_success);

Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -1337,8 +1337,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label L;
__ ldr(r10, Address(rmethod, Method::native_function_offset()));
address unsatisfied = (SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
__ mov(rscratch2, unsatisfied);
ExternalAddress unsatisfied(SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
__ lea(rscratch2, unsatisfied);
__ ldr(rscratch2, rscratch2);
__ cmp(r10, rscratch2);
__ br(Assembler::NE, L);
Expand Down Expand Up @@ -1432,7 +1432,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// hand.
//
__ mov(c_rarg0, rthread);
__ mov(rscratch2, CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans));
__ lea(rscratch2, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
__ blr(rscratch2);
__ get_method(rmethod);
__ reinit_heapbase();
Expand Down Expand Up @@ -1482,7 +1482,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {

__ push_call_clobbered_registers();
__ mov(c_rarg0, rthread);
__ mov(rscratch2, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
__ lea(rscratch2, RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
__ blr(rscratch2);
__ pop_call_clobbered_registers();

Expand Down Expand Up @@ -2085,7 +2085,7 @@ void TemplateInterpreterGenerator::trace_bytecode(Template* t) {

assert(Interpreter::trace_code(t->tos_in()) != nullptr,
"entry must have been generated");
__ bl(Interpreter::trace_code(t->tos_in()));
__ bl(RuntimeAddress(Interpreter::trace_code(t->tos_in())));
__ reinit_heapbase();
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -238,7 +238,7 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler *masm, Register tmp1,
__ ld(tmp1_class_loader_data, in_bytes(InstanceKlass::class_loader_data_offset()), tmp1);

// Fast path: If class loader is strong, the holder cannot be unloaded.
__ lwz(tmp2, in_bytes(ClassLoaderData::keep_alive_offset()), tmp1_class_loader_data);
__ lwz(tmp2, in_bytes(ClassLoaderData::keep_alive_ref_count_offset()), tmp1_class_loader_data);
__ cmpdi(CCR0, tmp2, 0);
__ bne(CCR0, skip_barrier);

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -326,7 +326,7 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
__ load_method_holder_cld(t0, xmethod);

// Is it a strong CLD?
__ lwu(t1, Address(t0, ClassLoaderData::keep_alive_offset()));
__ lwu(t1, Address(t0, ClassLoaderData::keep_alive_ref_count_offset()));
__ bnez(t1, method_live);

// Is it a weak but alive CLD?
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file,
}

// call indirectly to solve generation ordering problem
ExternalAddress target(StubRoutines::verify_oop_subroutine_entry_address());
RuntimeAddress target(StubRoutines::verify_oop_subroutine_entry_address());
relocate(target.rspec(), [&] {
int32_t offset;
la(t1, target.target(), offset);
Expand Down Expand Up @@ -592,7 +592,7 @@ void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* f
}

// call indirectly to solve generation ordering problem
ExternalAddress target(StubRoutines::verify_oop_subroutine_entry_address());
RuntimeAddress target(StubRoutines::verify_oop_subroutine_entry_address());
relocate(target.rspec(), [&] {
int32_t offset;
la(t1, target.target(), offset);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3774,7 +3774,7 @@ class StubGenerator: public StubCodeGenerator {
Label thaw_success;
// t1 contains the size of the frames to thaw, 0 if overflow or no more frames
__ bnez(t1, thaw_success);
__ la(t0, ExternalAddress(StubRoutines::throw_StackOverflowError_entry()));
__ la(t0, RuntimeAddress(StubRoutines::throw_StackOverflowError_entry()));
__ jr(t0);
__ bind(thaw_success);

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label L;
__ ld(x28, Address(xmethod, Method::native_function_offset()));
address unsatisfied = (SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
__ mv(t, unsatisfied);
ExternalAddress unsatisfied(SharedRuntime::native_method_throw_unsatisfied_link_error_entry());
__ la(t, unsatisfied);
__ load_long_misaligned(t1, Address(t, 0), t0, 2); // 2 bytes aligned, but not 4 or 8

__ bne(x28, t1, L);
Expand Down Expand Up @@ -1815,7 +1815,7 @@ void TemplateInterpreterGenerator::trace_bytecode(Template* t) {
// the tosca in-state for the given template.

assert(Interpreter::trace_code(t->tos_in()) != nullptr, "entry must have been generated");
__ call(Interpreter::trace_code(t->tos_in()));
__ rt_call(Interpreter::trace_code(t->tos_in()));
__ reinit_heapbase();
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, 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
Expand Down Expand Up @@ -423,7 +423,7 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
__ load_method_holder_cld(tmp1, rbx);

// Is it a strong CLD?
__ cmpl(Address(tmp1, ClassLoaderData::keep_alive_offset()), 0);
__ cmpl(Address(tmp1, ClassLoaderData::keep_alive_ref_count_offset()), 0);
__ jcc(Assembler::greater, method_live);

// Is it a weak but alive CLD?
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3702,7 +3702,7 @@ address StubGenerator::generate_cont_thaw(const char* label, Continuation::thaw_
Label L_thaw_success;
__ testptr(rbx, rbx);
__ jccb(Assembler::notZero, L_thaw_success);
__ jump(ExternalAddress(StubRoutines::throw_StackOverflowError_entry()));
__ jump(RuntimeAddress(StubRoutines::throw_StackOverflowError_entry()));
__ bind(L_thaw_success);

// Make room for the thawed frames and align the stack.
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
Expand Down Expand Up @@ -178,7 +178,7 @@ address TemplateInterpreterGenerator::generate_exception_handler_common(
rarg, rarg2);
}
// throw exception
__ jump(ExternalAddress(Interpreter::throw_exception_entry()));
__ jump(RuntimeAddress(Interpreter::throw_exception_entry()));
return entry;
}

Expand Down Expand Up @@ -546,7 +546,7 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(void) {
// Note: the restored frame is not necessarily interpreted.
// Use the shared runtime version of the StackOverflowError.
assert(StubRoutines::throw_StackOverflowError_entry() != nullptr, "stub not yet generated");
__ jump(ExternalAddress(StubRoutines::throw_StackOverflowError_entry()));
__ jump(RuntimeAddress(StubRoutines::throw_StackOverflowError_entry()));
// all done with frame size check
__ bind(after_frame_check_pop);
NOT_LP64(__ pop(rsi));
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/cpu/x86/templateTable_x86.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
Expand Down Expand Up @@ -774,7 +774,7 @@ void TemplateTable::index_check_without_pop(Register array, Register index) {
__ jccb(Assembler::below, skip);
// Pass array to create more detailed exceptions.
__ mov(NOT_LP64(rax) LP64_ONLY(c_rarg1), array);
__ jump(ExternalAddress(Interpreter::_throw_ArrayIndexOutOfBoundsException_entry));
__ jump(RuntimeAddress(Interpreter::_throw_ArrayIndexOutOfBoundsException_entry));
__ bind(skip);
}

Expand Down Expand Up @@ -1152,7 +1152,7 @@ void TemplateTable::aastore() {

// Come here on failure
// object is at TOS
__ jump(ExternalAddress(Interpreter::_throw_ArrayStoreException_entry));
__ jump(RuntimeAddress(Interpreter::_throw_ArrayStoreException_entry));

// Come here on success
__ bind(ok_is_subtype);
Expand Down Expand Up @@ -1432,7 +1432,7 @@ void TemplateTable::ldiv() {
// generate explicit div0 check
__ testq(rcx, rcx);
__ jump_cc(Assembler::zero,
ExternalAddress(Interpreter::_throw_ArithmeticException_entry));
RuntimeAddress(Interpreter::_throw_ArithmeticException_entry));
// Note: could xor rax and rcx and compare with (-1 ^ min_int). If
// they are not equal, one could do a normal division (no correction
// needed), which may speed up this implementation for the common case.
Expand All @@ -1445,7 +1445,7 @@ void TemplateTable::ldiv() {
// check if y = 0
__ orl(rax, rdx);
__ jump_cc(Assembler::zero,
ExternalAddress(Interpreter::_throw_ArithmeticException_entry));
RuntimeAddress(Interpreter::_throw_ArithmeticException_entry));
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::ldiv));
__ addptr(rsp, 4 * wordSize); // take off temporaries
#endif
Expand All @@ -1458,7 +1458,7 @@ void TemplateTable::lrem() {
__ pop_l(rax);
__ testq(rcx, rcx);
__ jump_cc(Assembler::zero,
ExternalAddress(Interpreter::_throw_ArithmeticException_entry));
RuntimeAddress(Interpreter::_throw_ArithmeticException_entry));
// Note: could xor rax and rcx and compare with (-1 ^ min_int). If
// they are not equal, one could do a normal division (no correction
// needed), which may speed up this implementation for the common case.
Expand All @@ -1472,7 +1472,7 @@ void TemplateTable::lrem() {
// check if y = 0
__ orl(rax, rdx);
__ jump_cc(Assembler::zero,
ExternalAddress(Interpreter::_throw_ArithmeticException_entry));
RuntimeAddress(Interpreter::_throw_ArithmeticException_entry));
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::lrem));
__ addptr(rsp, 4 * wordSize);
#endif
Expand Down Expand Up @@ -4222,7 +4222,7 @@ void TemplateTable::checkcast() {
// Come here on failure
__ push_ptr(rdx);
// object is at TOS
__ jump(ExternalAddress(Interpreter::_throw_ClassCastException_entry));
__ jump(RuntimeAddress(Interpreter::_throw_ClassCastException_entry));

// Come here on success
__ bind(ok_is_subtype);
Expand Down Expand Up @@ -4340,7 +4340,7 @@ void TemplateTable::_breakpoint() {
void TemplateTable::athrow() {
transition(atos, vtos);
__ null_check(rax);
__ jump(ExternalAddress(Interpreter::throw_exception_entry()));
__ jump(RuntimeAddress(Interpreter::throw_exception_entry()));
}

//-----------------------------------------------------------------------------
Expand Down
26 changes: 13 additions & 13 deletions src/hotspot/share/classfile/classLoaderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool has_class_mirror_ho
// A non-strong hidden class loader data doesn't have anything to keep
// it from being unloaded during parsing of the non-strong hidden class.
// The null-class-loader should always be kept alive.
_keep_alive((has_class_mirror_holder || h_class_loader.is_null()) ? 1 : 0),
_keep_alive_ref_count((has_class_mirror_holder || h_class_loader.is_null()) ? 1 : 0),
_claim(0),
_handles(),
_klasses(nullptr), _packages(nullptr), _modules(nullptr), _unnamed_module(nullptr), _dictionary(nullptr),
Expand Down Expand Up @@ -345,26 +345,26 @@ void ClassLoaderData::demote_strong_roots() {
// while the class is being parsed, and if the class appears on the module fixup list.
// Due to the uniqueness that no other class shares the hidden class' name or
// ClassLoaderData, no other non-GC thread has knowledge of the hidden class while
// it is being defined, therefore _keep_alive is not volatile or atomic.
void ClassLoaderData::inc_keep_alive() {
// it is being defined, therefore _keep_alive_ref_count is not volatile or atomic.
void ClassLoaderData::inc_keep_alive_ref_count() {
if (has_class_mirror_holder()) {
assert(_keep_alive > 0, "Invalid keep alive increment count");
_keep_alive++;
assert(_keep_alive_ref_count > 0, "Invalid keep alive increment count");
_keep_alive_ref_count++;
}
}

void ClassLoaderData::dec_keep_alive() {
void ClassLoaderData::dec_keep_alive_ref_count() {
if (has_class_mirror_holder()) {
assert(_keep_alive > 0, "Invalid keep alive decrement count");
if (_keep_alive == 1) {
// When the keep_alive counter is 1, the oop handle area is a strong root,
assert(_keep_alive_ref_count > 0, "Invalid keep alive decrement count");
if (_keep_alive_ref_count == 1) {
// When the keep_alive_ref_count counter is 1, the oop handle area is a strong root,
// acting as input to the GC tracing. Such strong roots are part of the
// snapshot-at-the-beginning, and can not just be pulled out from the
// system when concurrent GCs are running at the same time, without
// invoking the right barriers.
demote_strong_roots();
}
_keep_alive--;
_keep_alive_ref_count--;
}
}

Expand Down Expand Up @@ -680,8 +680,8 @@ oop ClassLoaderData::holder_no_keepalive() const {

// Unloading support
bool ClassLoaderData::is_alive() const {
bool alive = keep_alive() // null class loader and incomplete non-strong hidden class.
|| (_holder.peek() != nullptr); // and not cleaned by the GC weak handle processing.
bool alive = (_keep_alive_ref_count > 0) // null class loader and incomplete non-strong hidden class.
|| (_holder.peek() != nullptr); // and not cleaned by the GC weak handle processing.

return alive;
}
Expand Down Expand Up @@ -1009,7 +1009,7 @@ void ClassLoaderData::print_on(outputStream* out) const {
out->print_cr(" - unloading %s", _unloading ? "true" : "false");
out->print_cr(" - class mirror holder %s", _has_class_mirror_holder ? "true" : "false");
out->print_cr(" - modified oops %s", _modified_oops ? "true" : "false");
out->print_cr(" - keep alive %d", _keep_alive);
out->print_cr(" - _keep_alive_ref_count %d", _keep_alive_ref_count);
out->print (" - claim ");
switch(_claim) {
case _claim_none: out->print_cr("none"); break;
Expand Down
Loading

0 comments on commit ed2eb9e

Please sign in to comment.