Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Sep 6, 2024
2 parents 0c25cd3 + 0df10bb commit 2ddc616
Show file tree
Hide file tree
Showing 99 changed files with 1,906 additions and 972 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- target-cpu: riscv64
gnu-arch: riscv64
debian-arch: riscv64
debian-repository: https://httpredir.debian.org/debian/
debian-repository: https://snapshot.debian.org/archive/debian/20240228T034848Z/
debian-version: sid
tolerate-sysroot-errors: true

Expand Down
34 changes: 23 additions & 11 deletions src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,8 @@ void SharedRuntime::generate_deopt_blob() {
pad += 512; // Increase the buffer size when compiling for JVMCI
}
#endif
CodeBuffer buffer("deopt_blob", 2048+pad, 1024);
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
CodeBuffer buffer(name, 2048+pad, 1024);
MacroAssembler* masm = new MacroAssembler(&buffer);
int frame_size_in_words;
OopMap* map = nullptr;
Expand Down Expand Up @@ -2565,20 +2566,23 @@ uint SharedRuntime::out_preserve_stack_slots() {
// Generate a special Compile2Runtime blob that saves all registers,
// and setup oopmap.
//
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
assert(is_polling_page_id(id), "expected a polling page stub id");

ResourceMark rm;
OopMapSet *oop_maps = new OopMapSet();
OopMap* map;

// Allocate space for the code. Setup code generation tools.
CodeBuffer buffer("handler_blob", 2048, 1024);
const char* name = SharedRuntime::stub_name(id);
CodeBuffer buffer(name, 2048, 1024);
MacroAssembler* masm = new MacroAssembler(&buffer);

address start = __ pc();
address call_pc = nullptr;
int frame_size_in_words;
bool cause_return = (poll_type == POLL_AT_RETURN);
RegisterSaver reg_save(poll_type == POLL_AT_VECTOR_LOOP /* save_vectors */);
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
RegisterSaver reg_save(id == SharedStubId::polling_page_vectors_safepoint_handler_id /* save_vectors */);

// When the signal occurred, the LR was either signed and stored on the stack (in which
// case it will be restored from the stack before being used) or unsigned and not stored
Expand Down Expand Up @@ -2690,12 +2694,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
// but since this is generic code we don't know what they are and the caller
// must do any gc of the args.
//
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
assert(is_resolve_id(id), "expected a resolve stub id");

// allocate space for the code
ResourceMark rm;

const char* name = SharedRuntime::stub_name(id);
CodeBuffer buffer(name, 1000, 512);
MacroAssembler* masm = new MacroAssembler(&buffer);

Expand Down Expand Up @@ -2787,7 +2793,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
// otherwise assume that stack unwinding will be initiated, so
// caller saved registers were assumed volatile in the compiler.

RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
assert(is_throw_id(id), "expected a throw stub id");

const char* name = SharedRuntime::stub_name(id);

// Information about frame layout at time of blocking runtime call.
// Note that we only have to preserve callee-saved registers since
// the compilers are responsible for supplying a continuation point
Expand Down Expand Up @@ -2896,7 +2906,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {

int insts_size = 1024;
int locs_size = 64;
CodeBuffer code("jfr_write_checkpoint", insts_size, locs_size);
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
CodeBuffer code(name, insts_size, locs_size);
OopMapSet* oop_maps = new OopMapSet();
MacroAssembler* masm = new MacroAssembler(&code);

Expand All @@ -2915,7 +2926,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
oop_maps->add_gc_map(the_pc - start, map);

RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
RuntimeStub::new_runtime_stub("jfr_write_checkpoint", &code, frame_complete,
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
oop_maps, false);
return stub;
Expand All @@ -2934,7 +2945,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
int insts_size = 1024;
int locs_size = 64;

CodeBuffer code("jfr_return_lease", insts_size, locs_size);
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
CodeBuffer code(name, insts_size, locs_size);
OopMapSet* oop_maps = new OopMapSet();
MacroAssembler* masm = new MacroAssembler(&code);

Expand All @@ -2953,7 +2965,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
oop_maps->add_gc_map(the_pc - start, map);

RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
RuntimeStub::new_runtime_stub("jfr_return_lease", &code, frame_complete,
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
oop_maps, false);
return stub;
Expand Down
31 changes: 21 additions & 10 deletions src/hotspot/cpu/arm/sharedRuntime_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,8 @@ uint SharedRuntime::out_preserve_stack_slots() {
//------------------------------generate_deopt_blob----------------------------
void SharedRuntime::generate_deopt_blob() {
ResourceMark rm;
CodeBuffer buffer("deopt_blob", 1024, 1024);
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
CodeBuffer buffer(name, 1024, 1024);
int frame_size_in_words;
OopMapSet* oop_maps;
int reexecute_offset;
Expand Down Expand Up @@ -1601,15 +1602,17 @@ void SharedRuntime::generate_deopt_blob() {
// setup oopmap, and calls safepoint code to stop the compiled code for
// a safepoint.
//
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
assert(StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
assert(is_polling_page_id(id), "expected a polling page stub id");

ResourceMark rm;
CodeBuffer buffer("handler_blob", 256, 256);
const char* name = SharedRuntime::stub_name(id);
CodeBuffer buffer(name, 256, 256);
int frame_size_words;
OopMapSet* oop_maps;

bool cause_return = (poll_type == POLL_AT_RETURN);
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);

MacroAssembler* masm = new MacroAssembler(&buffer);
address start = __ pc();
Expand Down Expand Up @@ -1671,10 +1674,12 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
return SafepointBlob::create(&buffer, oop_maps, frame_size_words);
}

RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
assert(StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
assert(is_resolve_id(id), "expected a resolve stub id");

ResourceMark rm;
const char* name = SharedRuntime::stub_name(id);
CodeBuffer buffer(name, 1000, 512);
int frame_size_words;
OopMapSet *oop_maps;
Expand Down Expand Up @@ -1733,7 +1738,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
// Continuation point for throwing of implicit exceptions that are not handled in
// the current activation. Fabricates an exception oop and initiates normal
// exception dispatching in this frame.
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
assert(is_throw_id(id), "expected a throw stub id");

const char* name = SharedRuntime::stub_name(id);

int insts_size = 128;
int locs_size = 32;

Expand Down Expand Up @@ -1793,7 +1802,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
framesize // inclusive of return address
};

CodeBuffer code("jfr_write_checkpoint", 512, 64);
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
CodeBuffer code(name, 512, 64);
MacroAssembler* masm = new MacroAssembler(&code);

address start = __ pc();
Expand All @@ -1818,7 +1828,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
oop_maps->add_gc_map(frame_complete, map);

RuntimeStub* stub =
RuntimeStub::new_runtime_stub(code.name(),
RuntimeStub::new_runtime_stub(name,
&code,
frame_complete,
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
Expand All @@ -1836,7 +1846,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
framesize // inclusive of return address
};

CodeBuffer code("jfr_return_lease", 512, 64);
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
CodeBuffer code(name, 512, 64);
MacroAssembler* masm = new MacroAssembler(&code);

address start = __ pc();
Expand All @@ -1858,7 +1869,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
oop_maps->add_gc_map(frame_complete, map);

RuntimeStub* stub =
RuntimeStub::new_runtime_stub(code.name(),
RuntimeStub::new_runtime_stub(name,
&code,
frame_complete,
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ stw(R11_scratch1, simm16_offs, tmp);
}
#endif
__ call_c_with_frame_resize(copyfunc_addr, /*stub does not need resized frame*/ 0);
__ call_c(copyfunc_addr, relocInfo::runtime_call_type);

__ nand(tmp, R3_RET, R3_RET);
__ subf(length, tmp, length);
Expand Down Expand Up @@ -2057,7 +2057,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
int sco_offset = in_bytes(Klass::super_check_offset_offset());
__ lwz(chk_off, sco_offset, super_k);

__ call_c_with_frame_resize(copyfunc_addr, /*stub does not need resized frame*/ 0);
__ call_c(copyfunc_addr, relocInfo::runtime_call_type);

#ifndef PRODUCT
if (PrintC1Statistics) {
Expand Down Expand Up @@ -2181,7 +2181,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {

// Arraycopy stubs takes a length in number of elements, so don't scale it.
__ mr(len, length);
__ call_c_with_frame_resize(entry, /*stub does not need resized frame*/ 0);
__ call_c(entry, relocInfo::runtime_call_type);

if (stub != nullptr) {
__ bind(*stub->continuation());
Expand Down Expand Up @@ -2862,7 +2862,7 @@ void LIR_Assembler::rt_call(LIR_Opr result, address dest,
return;
}

__ call_c_with_frame_resize(dest, /*no resizing*/ 0);
__ call_c(dest, relocInfo::runtime_call_type);
if (info != nullptr) {
add_call_info_here(info);
}
Expand Down
11 changes: 0 additions & 11 deletions src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,3 @@ void C1_MacroAssembler::null_check(Register r, Label* Lnull) {
bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::equal), *Lnull);
}
}

address C1_MacroAssembler::call_c_with_frame_resize(address dest, int frame_resize) {
if (frame_resize) { resize_frame(-frame_resize, R0); }
#if defined(ABI_ELFv2)
address return_pc = call_c(dest, relocInfo::runtime_call_type);
#else
address return_pc = call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, dest), relocInfo::runtime_call_type);
#endif
if (frame_resize) { resize_frame(frame_resize, R0); }
return return_pc;
}
1 change: 0 additions & 1 deletion src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@

void null_check(Register r, Label *Lnull = nullptr);

address call_c_with_frame_resize(address dest, int frame_resize);

#endif // CPU_PPC_C1_MACROASSEMBLER_PPC_HPP
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result,
// ARG1 must hold thread address.
mr(R3_ARG1, R16_thread);

address return_pc = call_c_with_frame_resize(entry_point, /*No resize, we have a C compatible frame.*/0);
address return_pc = call_c(entry_point);

reset_last_Java_frame();

Expand Down
10 changes: 1 addition & 9 deletions src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,7 @@ void InterpreterMacroAssembler::check_and_handle_popframe(Register scratch_reg)
// Call the Interpreter::remove_activation_preserving_args_entry()
// func to get the address of the same-named entrypoint in the
// generated interpreter code.
#if defined(ABI_ELFv2)
call_c(CAST_FROM_FN_PTR(address,
Interpreter::remove_activation_preserving_args_entry),
relocInfo::none);
#else
call_c(CAST_FROM_FN_PTR(FunctionDescriptor*,
Interpreter::remove_activation_preserving_args_entry),
relocInfo::none);
#endif
call_c(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry));

// Jump to Interpreter::_remove_activation_preserving_args_entry.
mtctr(R3_RET);
Expand Down
10 changes: 1 addition & 9 deletions src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,11 +1293,7 @@ void MacroAssembler::call_VM_base(Register oop_result,

// ARG1 must hold thread address.
mr(R3_ARG1, R16_thread);
#if defined(ABI_ELFv2)
address return_pc = call_c(entry_point, relocInfo::none);
#else
address return_pc = call_c((FunctionDescriptor*)entry_point, relocInfo::none);
#endif

reset_last_Java_frame();

Expand All @@ -1318,11 +1314,7 @@ void MacroAssembler::call_VM_base(Register oop_result,

void MacroAssembler::call_VM_leaf_base(address entry_point) {
BLOCK_COMMENT("call_VM_leaf {");
#if defined(ABI_ELFv2)
call_c(entry_point, relocInfo::none);
#else
call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::none);
#endif
call_c(entry_point);
BLOCK_COMMENT("} call_VM_leaf");
}

Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/cpu/ppc/macroAssembler_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,17 @@ class MacroAssembler: public Assembler {
address call_c(Register function_entry);
// For tail calls: only branch, don't link, so callee returns to caller of this function.
address call_c_and_return_to_caller(Register function_entry);
address call_c(address function_entry, relocInfo::relocType rt);
address call_c(address function_entry, relocInfo::relocType rt = relocInfo::none);
#else
// Call a C function via a function descriptor and use full C
// calling conventions. Updates and returns _last_calls_return_pc.
address call_c(Register function_descriptor);
// For tail calls: only branch, don't link, so callee returns to caller of this function.
address call_c_and_return_to_caller(Register function_descriptor);
address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt);
address call_c(address function_entry, relocInfo::relocType rt = relocInfo::none) {
return call_c((const FunctionDescriptor*)function_entry, rt);
}
address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt,
Register toc);
#endif
Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/cpu/ppc/runtime_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ void OptoRuntime::generate_exception_blob() {
__ set_last_Java_frame(/*sp=*/R1_SP, noreg);

__ mr(R3_ARG1, R16_thread);
#if defined(ABI_ELFv2)
__ call_c((address) OptoRuntime::handle_exception_C, relocInfo::none);
#else
__ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, OptoRuntime::handle_exception_C),
relocInfo::none);
#endif
__ call_c((address) OptoRuntime::handle_exception_C);
address calls_return_pc = __ last_calls_return_pc();
# ifdef ASSERT
__ cmpdi(CCR0, R3_RET, 0);
Expand Down
Loading

0 comments on commit 2ddc616

Please sign in to comment.