8247354: [aarch64] PopFrame causes assert(oopDesc::is_oop(obj)) failed: not an oop

Reviewed-by: adinn
This commit is contained in:
Nick Gasson 2020-08-07 14:10:55 +08:00
parent 35e3226df8
commit 90f0612ada
3 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
@ -136,7 +136,20 @@ void AbstractInterpreter::layout_activation(Method* method,
// interpreter_frame_sender_sp interpreter_frame_sender_sp is // interpreter_frame_sender_sp interpreter_frame_sender_sp is
// the original sp of the caller (the unextended_sp) and // the original sp of the caller (the unextended_sp) and
// sender_sp is fp+8/16 (32bit/64bit) XXX // sender_sp is fp+8/16 (32bit/64bit) XXX
intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1; //
// The interpreted method entry on AArch64 aligns SP to 16 bytes
// before generating the fixed part of the activation frame. So there
// may be a gap between the locals block and the saved sender SP. For
// an interpreted caller we need to recreate this gap and exactly
// align the incoming parameters with the caller's temporary
// expression stack. For other types of caller frame it doesn't
// matter.
intptr_t* locals;
if (caller->is_interpreted_frame()) {
locals = caller->interpreter_frame_last_sp() + caller_actual_parameters - 1;
} else {
locals = interpreter_frame->sender_sp() + max_locals - 1;
}
#ifdef ASSERT #ifdef ASSERT
if (caller->is_interpreted_frame()) { if (caller->is_interpreted_frame()) {

View File

@ -61,6 +61,7 @@
// [last sp ] // [last sp ]
// [oop temp ] (only for native calls) // [oop temp ] (only for native calls)
// [padding ] (to preserve machine SP alignment)
// [locals and parameters ] // [locals and parameters ]
// <- sender sp // <- sender sp
// ------------------------------ Asm interpreter ---------------------------------------- // ------------------------------ Asm interpreter ----------------------------------------

View File

@ -1580,6 +1580,9 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// Make room for locals // Make room for locals
__ sub(rscratch1, esp, r3, ext::uxtx, 3); __ sub(rscratch1, esp, r3, ext::uxtx, 3);
// Padding between locals and fixed part of activation frame to ensure
// SP is always 16-byte aligned.
__ andr(sp, rscratch1, -16); __ andr(sp, rscratch1, -16);
// r3 - # of additional locals // r3 - # of additional locals