Skip to content

Commit

Permalink
8256922: ppc, ppcle build broken after JDK-8254231
Browse files Browse the repository at this point in the history
Reviewed-by: shade, lucy, mdoerr
  • Loading branch information
tstuefe committed Nov 24, 2020
1 parent b52f6c0 commit f8d7c5a
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
Expand Up @@ -1339,7 +1339,7 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
__ ld(polling_page, in_bytes(Thread::polling_page_offset()), R16_thread);

// Restore return pc relative to callers' sp.
__ ld(return_pc, _abi(lr), R1_SP);
__ ld(return_pc, _abi0(lr), R1_SP);
// Move return pc to LR.
__ mtlr(return_pc);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp
Expand Up @@ -79,7 +79,7 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_by
assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
generate_stack_overflow_check(bang_size_in_bytes);

std(return_pc, _abi(lr), R1_SP); // SP->lr = return_pc
std(return_pc, _abi0(lr), R1_SP); // SP->lr = return_pc
push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
}

Expand Down
24 changes: 12 additions & 12 deletions src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp
Expand Up @@ -92,7 +92,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result,
if (frame_size() == no_frame_size) {
ShouldNotReachHere(); // We always have a frame size.
//pop_frame(); // pop the stub frame
//ld(R0, _abi(lr), R1_SP);
//ld(R0, _abi0(lr), R1_SP);
//mtlr(R0);
//load_const_optimized(R0, StubRoutines::forward_exception_entry());
//mtctr(R0);
Expand Down Expand Up @@ -185,7 +185,7 @@ static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers
ret_pc = R0;
__ mflr(ret_pc);
}
__ std(ret_pc, _abi(lr), R1_SP); // C code needs pc in C1 method.
__ std(ret_pc, _abi0(lr), R1_SP); // C code needs pc in C1 method.
__ push_frame(frame_size_in_bytes + stack_preserve, R0);

// Record volatile registers as callee-save values in an OopMap so
Expand Down Expand Up @@ -233,7 +233,7 @@ static void restore_live_registers(StubAssembler* sasm, Register result1, Regist
}

__ pop_frame();
__ ld(R0, _abi(lr), R1_SP);
__ ld(R0, _abi0(lr), R1_SP);
__ mtlr(R0);
}

Expand Down Expand Up @@ -485,7 +485,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);

__ mflr(R0);
__ std(R0, _abi(lr), R1_SP);
__ std(R0, _abi0(lr), R1_SP);
__ push_frame(frame::abi_reg_args_size, R0); // Empty dummy frame (no callee-save regs).
sasm->set_frame_size(frame::abi_reg_args_size / BytesPerWord);
OopMap* oop_map = new OopMap(frame::abi_reg_args_size / sizeof(jint), 0);
Expand All @@ -495,7 +495,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
oop_maps->add_gc_map(call_offset, oop_map);

__ pop_frame();
__ ld(R0, _abi(lr), R1_SP);
__ ld(R0, _abi0(lr), R1_SP);
__ mtlr(R0);
__ blr();
}
Expand Down Expand Up @@ -554,11 +554,11 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ ld(Rcaller_sp, 0, R1_SP);
__ push_frame_reg_args(0, R0); // dummy frame for C call
__ mr(Rexception_save, Rexception); // save over C call
__ ld(Rexception_pc, _abi(lr), Rcaller_sp); // return pc
__ ld(Rexception_pc, _abi0(lr), Rcaller_sp); // return pc
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), R16_thread, Rexception_pc);
__ verify_not_null_oop(Rexception_save);
__ mtctr(R3_RET);
__ ld(Rexception_pc, _abi(lr), Rcaller_sp); // return pc
__ ld(Rexception_pc, _abi0(lr), Rcaller_sp); // return pc
__ mr(R1_SP, Rcaller_sp); // Pop both frames at once.
__ mr(Rexception, Rexception_save); // restore
__ mtlr(Rexception_pc);
Expand Down Expand Up @@ -730,7 +730,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
{
__ set_info("unimplemented entry", dont_gc_arguments);
__ mflr(R0);
__ std(R0, _abi(lr), R1_SP);
__ std(R0, _abi0(lr), R1_SP);
__ push_frame(frame::abi_reg_args_size, R0); // empty dummy frame
sasm->set_frame_size(frame::abi_reg_args_size / BytesPerWord);
OopMap* oop_map = new OopMap(frame::abi_reg_args_size / sizeof(jint), 0);
Expand Down Expand Up @@ -766,12 +766,12 @@ OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
// exception handler.
oop_map = generate_oop_map(sasm, true);
// Transfer the pending exception to the exception_oop.
// Also load the PC which is typically at SP + frame_size_in_bytes + _abi(lr),
// Also load the PC which is typically at SP + frame_size_in_bytes +_abi0(lr),
// but we support additional slots in the frame for parameter passing.
__ ld(Rexception_pc, 0, R1_SP);
__ ld(Rexception, in_bytes(JavaThread::pending_exception_offset()), R16_thread);
__ li(R0, 0);
__ ld(Rexception_pc, _abi(lr), Rexception_pc);
__ ld(Rexception_pc, _abi0(lr), Rexception_pc);
__ std(R0, in_bytes(JavaThread::pending_exception_offset()), R16_thread);
break;
case handle_exception_nofpu_id:
Expand All @@ -783,7 +783,7 @@ OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
// At this point all registers except exception oop and exception pc are dead.
oop_map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
__ std(Rexception_pc, _abi(lr), R1_SP);
__ std(Rexception_pc, _abi0(lr), R1_SP);
__ push_frame(frame_size_in_bytes, R0);
break;
default: ShouldNotReachHere();
Expand Down Expand Up @@ -826,7 +826,7 @@ OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
break;
case handle_exception_from_callee_id: {
__ pop_frame();
__ ld(Rexception_pc, _abi(lr), R1_SP);
__ ld(Rexception_pc, _abi0(lr), R1_SP);
__ mtlr(Rexception_pc);
__ bctr();
break;
Expand Down
38 changes: 38 additions & 0 deletions src/hotspot/cpu/ppc/foreign_globals_ppc.cpp
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2020 SAP SE. All rights reserved.
* Copyright (c) 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#include "precompiled.hpp"
#include "prims/foreign_globals.hpp"
#include "utilities/debug.hpp"

// Stubbed out, implement later
const ABIDescriptor ForeignGlobals::parse_abi_descriptor_impl(jobject jabi) const {
Unimplemented();
return {};
}

const BufferLayout ForeignGlobals::parse_buffer_layout_impl(jobject jlayout) const {
Unimplemented();
return {};
}
31 changes: 31 additions & 0 deletions src/hotspot/cpu/ppc/foreign_globals_ppc.hpp
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2020 SAP SE. All rights reserved.
* Copyright (c) 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

#ifndef CPU_PPC_VM_FOREIGN_GLOBALS_PPC_HPP
#define CPU_PPC_VM_FOREIGN_GLOBALS_PPC_HPP

class BufferLayout {};
class ABIDescriptor {};

#endif // CPU_PPC_VM_FOREIGN_GLOBALS_PPC_HPP
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/frame_ppc.hpp
Expand Up @@ -118,7 +118,7 @@
abi_reg_args_size = sizeof(abi_reg_args)
};

#define _abi(_component) \
#define _abi0(_component) \
(offset_of(frame::abi_reg_args, _component))

struct abi_reg_args_spill : abi_reg_args {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp
Expand Up @@ -457,11 +457,11 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
__ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
__ mflr(R0);
__ std(R0, _abi(lr), R1_SP);
__ std(R0, _abi0(lr), R1_SP);
__ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1SATBMarkQueueSet::handle_zero_index_for_thread), R16_thread);
__ pop_frame();
__ ld(R0, _abi(lr), R1_SP);
__ ld(R0, _abi0(lr), R1_SP);
__ mtlr(R0);
__ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
__ b(restart);
Expand Down Expand Up @@ -537,11 +537,11 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
__ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
__ mflr(R0);
__ std(R0, _abi(lr), R1_SP);
__ std(R0, _abi0(lr), R1_SP);
__ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1DirtyCardQueueSet::handle_zero_index_for_thread), R16_thread);
__ pop_frame();
__ ld(R0, _abi(lr), R1_SP);
__ ld(R0, _abi0(lr), R1_SP);
__ mtlr(R0);
__ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
__ b(restart);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
Expand Up @@ -772,7 +772,7 @@ void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register retur
ld(Rsender_sp, _ijava_state_neg(sender_sp), Rscratch1); // top_frame_sp
ld(Rscratch2, 0, Rscratch1); // **SP
if (return_pc!=noreg) {
ld(return_pc, _abi(lr), Rscratch1); // LR
ld(return_pc, _abi0(lr), Rscratch1); // LR
}

// Merge top frames.
Expand Down Expand Up @@ -849,7 +849,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state,
// call could have a smaller SP, so that this compare succeeds for an
// inner call of the method annotated with ReservedStack.
ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
ld_ptr(R11_scratch1, _abi(callers_sp), R1_SP); // Load frame pointer.
ld_ptr(R11_scratch1, _abi0(callers_sp), R1_SP); // Load frame pointer.
cmpld(CCR0, R11_scratch1, R0);
blt_predict_taken(CCR0, no_reserved_zone_enabling);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/interpreterRT_ppc.cpp
Expand Up @@ -42,7 +42,7 @@
// The first Java argument is at index -1.
#define locals_j_arg_at(index) (Interpreter::local_offset_in_bytes(index)), R18_locals
// The first C argument is at index 0.
#define sp_c_arg_at(index) ((index)*wordSize + _abi(carg_1)), R1_SP
#define sp_c_arg_at(index) ((index)*wordSize + _abi0(carg_1)), R1_SP

// Implementation of SignatureHandlerGenerator

Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
Expand Up @@ -857,17 +857,17 @@ void MacroAssembler::restore_volatile_gprs(Register src, int offset) {

void MacroAssembler::save_LR_CR(Register tmp) {
mfcr(tmp);
std(tmp, _abi(cr), R1_SP);
std(tmp, _abi0(cr), R1_SP);
mflr(tmp);
std(tmp, _abi(lr), R1_SP);
std(tmp, _abi0(lr), R1_SP);
// Tmp must contain lr on exit! (see return_addr and prolog in ppc64.ad)
}

void MacroAssembler::restore_LR_CR(Register tmp) {
assert(tmp != R1_SP, "must be distinct");
ld(tmp, _abi(lr), R1_SP);
ld(tmp, _abi0(lr), R1_SP);
mtlr(tmp);
ld(tmp, _abi(cr), R1_SP);
ld(tmp, _abi0(cr), R1_SP);
mtcr(tmp);
}

Expand All @@ -888,7 +888,7 @@ void MacroAssembler::resize_frame(Register offset, Register tmp) {
#endif

// tmp <- *(SP)
ld(tmp, _abi(callers_sp), R1_SP);
ld(tmp, _abi0(callers_sp), R1_SP);
// addr <- SP + offset;
// *(addr) <- tmp;
// SP <- addr
Expand All @@ -900,7 +900,7 @@ void MacroAssembler::resize_frame(int offset, Register tmp) {
assert_different_registers(tmp, R1_SP);
assert((offset & (frame::alignment_in_bytes-1))==0, "resize_frame: unaligned");
// tmp <- *(SP)
ld(tmp, _abi(callers_sp), R1_SP);
ld(tmp, _abi0(callers_sp), R1_SP);
// addr <- SP + offset;
// *(addr) <- tmp;
// SP <- addr
Expand Down Expand Up @@ -954,7 +954,7 @@ void MacroAssembler::push_frame_reg_args_nonvolatiles(unsigned int bytes,

// Pop current C frame.
void MacroAssembler::pop_frame() {
ld(R1_SP, _abi(callers_sp), R1_SP);
ld(R1_SP, _abi0(callers_sp), R1_SP);
}

#if defined(ABI_ELFv2)
Expand Down
11 changes: 8 additions & 3 deletions src/hotspot/cpu/ppc/ppc.ad
Expand Up @@ -1122,6 +1122,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
#endif
}

int MachCallNativeNode::ret_addr_offset() {
Unimplemented();
return -1;
}

//=============================================================================

// condition code conversions
Expand Down Expand Up @@ -1515,7 +1520,7 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
#endif
if (!method_is_frameless) {
// Save return pc.
__ std(return_pc, _abi(lr), callers_sp);
__ std(return_pc, _abi0(lr), callers_sp);
}

C->output()->set_frame_complete(cbuf.insts_size());
Expand Down Expand Up @@ -1561,7 +1566,7 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {

if (!method_is_frameless) {
// Restore return pc relative to callers' sp.
__ ld(return_pc, ((int)framesize) + _abi(lr), R1_SP);
__ ld(return_pc, ((int)framesize) + _abi0(lr), R1_SP);
}

if (method_needs_polling) {
Expand Down Expand Up @@ -14495,7 +14500,7 @@ instruct tailjmpInd(iRegPdstNoScratch jump_target, rarg1RegP ex_oop) %{
"BCTR \t// TailJump, exception oop: $ex_oop" %}
size(12);
ins_encode %{
__ ld(R4_ARG2/* issuing pc */, _abi(lr), R1_SP);
__ ld(R4_ARG2/* issuing pc */, _abi0(lr), R1_SP);
__ mtctr($jump_target$$Register);
__ bctr();
%}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/runtime_ppc.cpp
Expand Up @@ -81,7 +81,7 @@ void OptoRuntime::generate_exception_blob() {
OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);

// Exception pc is 'return address' for stack walker.
__ std(R4_ARG2/*exception pc*/, _abi(lr), R1_SP);
__ std(R4_ARG2/*exception pc*/, _abi0(lr), R1_SP);

// Store the exception in the Thread object.
__ std(R3_ARG1/*exception oop*/, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
Expand Down

0 comments on commit f8d7c5a

Please sign in to comment.