Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8272760: [lworld] Aarch64 part of JDK-8272753 #539

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1967,7 +1967,7 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
C2_MacroAssembler _masm(&cbuf);
int framesize = C->output()->frame_slots() << LogBytesPerInt;

__ remove_frame(framesize, C->needs_stack_repair(), C->output()->sp_inc_offset());
__ remove_frame(framesize, C->needs_stack_repair());

if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
__ reserved_stack_check();
@@ -457,9 +457,7 @@ int LIR_Assembler::emit_unwind_handler() {

// remove the activation and dispatch to the unwind handler
__ block_comment("remove_frame and dispatch to the unwind handler");
int initial_framesize = initial_frame_size_in_bytes();
int sp_inc_offset = initial_framesize - 3*wordSize; // Below saved FP and LR
__ remove_frame(initial_framesize, needs_stack_repair(), sp_inc_offset);
__ remove_frame(initial_frame_size_in_bytes(), needs_stack_repair());
__ far_jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));

// Emit the slow path assembly
@@ -523,9 +521,7 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
}

// Pop the stack before the safepoint code
int initial_framesize = initial_frame_size_in_bytes();
int sp_inc_offset = initial_framesize - 3*wordSize; // Below saved FP and LR
__ remove_frame(initial_framesize, needs_stack_repair(), sp_inc_offset);
__ remove_frame(initial_frame_size_in_bytes(), needs_stack_repair());

if (StackReservedPages > 0 && compilation()->has_reserved_stack_access()) {
__ reserved_stack_check();
@@ -305,8 +305,7 @@ void C1_MacroAssembler::build_frame_helper(int frame_size_in_bytes, int sp_inc,
MacroAssembler::build_frame(frame_size_in_bytes);

if (needs_stack_repair) {
int sp_inc_offset = frame_size_in_bytes - 3 * wordSize; // Immediately below saved LR and FP
save_stack_increment(sp_inc, frame_size_in_bytes, sp_inc_offset);
save_stack_increment(sp_inc, frame_size_in_bytes);
}
}

@@ -337,11 +336,6 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_by
}
}

void C1_MacroAssembler::remove_frame(int frame_size_in_bytes, bool needs_stack_repair,
int sp_inc_offset) {
MacroAssembler::remove_frame(frame_size_in_bytes, needs_stack_repair, sp_inc_offset);
}

void C1_MacroAssembler::verified_entry() {
// If we have to make this method not-entrant we'll overwrite its
// first instruction with a jump. For this action to be legal we
@@ -110,6 +110,4 @@ using MacroAssembler::null_check;

void load_parameter(int offset_in_words, Register reg);

void remove_frame(int initial_framesize, bool needs_stack_repair, int sp_inc_offset);

#endif // CPU_AARCH64_C1_MACROASSEMBLER_AARCH64_HPP
@@ -4588,7 +4588,7 @@ void MacroAssembler::remove_frame(int framesize) {
}
}

void MacroAssembler::remove_frame(int initial_framesize, bool needs_stack_repair, int sp_inc_offset) {
void MacroAssembler::remove_frame(int initial_framesize, bool needs_stack_repair) {
if (needs_stack_repair) {
// Remove the extension of the caller's frame used for inline type unpacking
//
@@ -4616,6 +4616,8 @@ void MacroAssembler::remove_frame(int initial_framesize, bool needs_stack_repair
// The sp_inc stack slot holds the total size of the frame including the
// extension space minus two words for the saved FP and LR.

int sp_inc_offset = initial_framesize - 3 * wordSize; // Immediately below saved LR and FP

ldr(rscratch1, Address(sp, sp_inc_offset));
add(sp, sp, rscratch1);
ldp(rfp, lr, Address(post(sp, 2 * wordSize)));
@@ -4624,12 +4626,14 @@ void MacroAssembler::remove_frame(int initial_framesize, bool needs_stack_repair
}
}

void MacroAssembler::save_stack_increment(int sp_inc, int frame_size, int sp_inc_offset) {
void MacroAssembler::save_stack_increment(int sp_inc, int frame_size) {
int real_frame_size = frame_size + sp_inc;
assert(sp_inc == 0 || sp_inc > 2*wordSize, "invalid sp_inc value");
assert(real_frame_size >= 2*wordSize, "frame size must include FP/LR space");
assert((real_frame_size & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");

int sp_inc_offset = frame_size - 3 * wordSize; // Immediately below saved LR and FP

// Subtract two words for the saved FP and LR as these will be popped
// separately. See remove_frame above.
mov(rscratch1, real_frame_size - 2*wordSize);
@@ -5483,7 +5487,7 @@ void MacroAssembler::verified_entry(Compile* C, int sp_inc) {
build_frame(framesize);

if (C->needs_stack_repair()) {
save_stack_increment(sp_inc, framesize, C->output()->sp_inc_offset());
save_stack_increment(sp_inc, framesize);
}

if (VerifyStackAtCalls) {
@@ -1253,9 +1253,9 @@ class MacroAssembler: public Assembler {
VMRegPair* from, int from_count, int& from_index, VMReg to,
RegState reg_state[], Register val_array);
int extend_stack_for_inline_args(int args_on_stack);
void remove_frame(int initial_framesize, bool needs_stack_repair, int sp_inc_offset);
void remove_frame(int initial_framesize, bool needs_stack_repair);
VMReg spill_reg_for(VMReg reg);
void save_stack_increment(int sp_inc, int frame_size, int sp_inc_offset);
void save_stack_increment(int sp_inc, int frame_size);

void tableswitch(Register index, jint lowbound, jint highbound,
Label &jumptable, Label &jumptable_end, int stride = 1) {
@@ -311,7 +311,6 @@ PhaseOutput::PhaseOutput()
_orig_pc_slot(0),
_orig_pc_slot_offset_in_bytes(0),
_sp_inc_slot(0),
_sp_inc_slot_offset_in_bytes(0),
_buf_sizes(),
_block(NULL),
_index(0) {
@@ -1315,10 +1314,6 @@ void PhaseOutput::estimate_buffer_size(int& const_req) {
if (C->fixed_slots() != 0) {
_orig_pc_slot_offset_in_bytes = C->regalloc()->reg2offset(OptoReg::stack2reg(_orig_pc_slot));
}
if (C->needs_stack_repair()) {
// Compute the byte offset of the stack increment value
_sp_inc_slot_offset_in_bytes = C->regalloc()->reg2offset(OptoReg::stack2reg(_sp_inc_slot));
}

// Compute prolog code size
_method_size = 0;
@@ -243,8 +243,6 @@ class PhaseOutput : public Phase {

int bang_size_in_bytes() const;

int sp_inc_offset() const { return _sp_inc_slot_offset_in_bytes; }

uint node_bundling_limit();
Bundle* node_bundling_base();
void set_node_bundling_limit(uint n) { _node_bundling_limit = n; }