Commit 71dbee04 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Fix constant pools for tail calls.

Constant pool must be marked as unavailable for use after the caller's pointer has been restored ahead of the tail call.

R=joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, ishell@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1641743002

Cr-Commit-Position: refs/heads/master@{#33563}
parent dadb3a5b
......@@ -651,13 +651,7 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
frame_access_state()->IncreaseSPDelta(-sp_slot_delta);
}
if (frame()->needs_frame()) {
if (FLAG_enable_embedded_constant_pool) {
__ LoadP(kConstantPoolRegister,
MemOperand(fp, StandardFrameConstants::kConstantPoolOffset));
}
__ LoadP(r0, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
__ LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ mtlr(r0);
__ RestoreFrameStateForTailCall();
}
frame_access_state()->SetFrameAccessToSP();
}
......
......@@ -2077,13 +2077,7 @@ void PrepareForTailCall(MacroAssembler* masm, Register args_reg,
// Restore caller's frame pointer and return address now as they will be
// overwritten by the copying loop.
if (FLAG_enable_embedded_constant_pool) {
__ LoadP(kConstantPoolRegister,
MemOperand(fp, StandardFrameConstants::kConstantPoolOffset));
}
__ LoadP(r0, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
__ LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ mtlr(r0);
__ RestoreFrameStateForTailCall();
// Now copy callee arguments to the caller frame going backwards to avoid
// callee arguments corruption (source and destination areas could overlap).
......
......@@ -564,6 +564,16 @@ void MacroAssembler::PopFixedFrame(Register marker_reg) {
mtlr(r0);
}
void MacroAssembler::RestoreFrameStateForTailCall() {
if (FLAG_enable_embedded_constant_pool) {
LoadP(kConstantPoolRegister,
MemOperand(fp, StandardFrameConstants::kConstantPoolOffset));
set_constant_pool_available(false);
}
LoadP(r0, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
mtlr(r0);
}
const RegList MacroAssembler::kSafepointSavedRegisters = Register::kAllocatable;
const int MacroAssembler::kNumSafepointSavedRegisters =
......
......@@ -342,6 +342,10 @@ class MacroAssembler : public Assembler {
void PushFixedFrame(Register marker_reg = no_reg);
void PopFixedFrame(Register marker_reg = no_reg);
// Restore caller's frame pointer and return address prior to being
// overwritten by tail call stack preparation.
void RestoreFrameStateForTailCall();
// Push and pop the registers that can hold pointers, as defined by the
// RegList constant kSafepointSavedRegisters.
void PushSafepointRegisters();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment