OpenJDK / jdk / jdk
changeset 60117:f1908b344bc4
8248336: AArch64: C2: offset overflow in BoxLockNode::emit
Reviewed-by: adinn
author | aph |
---|---|
date | Thu, 25 Jun 2020 12:24:50 -0400 |
parents | f4f92b3e910a |
children | 8315514d0952 |
files | src/hotspot/cpu/aarch64/aarch64.ad |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/cpu/aarch64/aarch64.ad Thu Jul 09 16:22:23 2020 +0200 +++ b/src/hotspot/cpu/aarch64/aarch64.ad Thu Jun 25 12:24:50 2020 -0400 @@ -1955,16 +1955,20 @@ int offset = ra_->reg2offset(in_RegMask(0).find_first_elem()); int reg = ra_->get_encode(this); - if (Assembler::operand_valid_for_add_sub_immediate(offset)) { - __ add(as_Register(reg), sp, offset); - } else { - ShouldNotReachHere(); - } + // This add will handle any 24-bit signed offset. 24 bits allows an + // 8 megabyte stack frame. + __ add(as_Register(reg), sp, offset); } uint BoxLockNode::size(PhaseRegAlloc *ra_) const { // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_). - return 4; + int offset = ra_->reg2offset(in_RegMask(0).find_first_elem()); + + if (Assembler::operand_valid_for_add_sub_immediate(offset)) { + return NativeInstruction::instruction_size; + } else { + return 2 * NativeInstruction::instruction_size; + } } //=============================================================================