openjdk-1.8.0/8248336.patch

47 lines
1.6 KiB
Diff

From 0fc0d41f2af723a0abdb3c73100137f847b1d820 Mon Sep 17 00:00:00 2001
Date: Fri, 22 Jan 2021 16:40:43 +0800
Subject: 8248336: AArch64: C2: offset overflow in
BoxLockNode::emit
Summary: <C2>: offset overflow in BoxLockNode::emit
LLT: jtreg
Bug url: https://bugs.openjdk.java.net/browse/JDK-8248336
---
hotspot/src/cpu/aarch64/vm/aarch64.ad | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad
index 38de0098b..accce6720 100644
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad
@@ -1828,16 +1828,20 @@ void BoxLockNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
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;
+ }
}
//=============================================================================
--
2.19.0