Skip to content

Commit 4da4927

Browse files
marc-chevalierchhagedorn
authored andcommitted
8367156: [lworld] MacroAssembler::remove_frame hits "Field too big for insn"
Reviewed-by: thartmann, chagedorn
1 parent 04efe5c commit 4da4927

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6136,7 +6136,8 @@ void MacroAssembler::remove_frame(int initial_framesize, bool needs_stack_repair
61366136

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

6139-
ldp(rscratch1, rfp, Address(sp, sp_inc_offset));
6139+
ldr(rscratch1, Address(sp, sp_inc_offset));
6140+
ldr(rfp, Address(sp, sp_inc_offset + wordSize));
61406141
add(sp, sp, rscratch1);
61416142
ldr(lr, Address(sp, wordSize));
61426143
add(sp, sp, 2 * wordSize);
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
package compiler.valhalla.inlinetypes;
25+
26+
import static compiler.valhalla.inlinetypes.InlineTypes.*;
27+
28+
/*
29+
* @test
30+
* @bug 8367156
31+
* @summary On Aarch64, when the frame is very big and we need to repair it after
32+
* scalarization of the arguments, we cannot use ldp to get the stack
33+
* increment and rfp at the same time, since it only has a 7 bit offset.
34+
* We use two ldr with 9-bit offsets instead.
35+
* @library /test/lib /
36+
* @requires (os.simpleArch == "x64" | os.simpleArch == "aarch64")
37+
* @enablePreview
38+
* @modules java.base/jdk.internal.vm.annotation
39+
* @run main/othervm
40+
* -Xcomp
41+
* -XX:CompileCommand=compileonly,compiler.valhalla.inlinetypes.RepairStackWithBigFrame::test
42+
* compiler.valhalla.inlinetypes.RepairStackWithBigFrame
43+
* @run main compiler.valhalla.inlinetypes.RepairStackWithBigFrame
44+
*/
45+
46+
public class RepairStackWithBigFrame {
47+
static final MyValue1 testValue1 = MyValue1.createWithFieldsInline(rI, rL);
48+
49+
public static void main(String[] args) {
50+
new RepairStackWithBigFrame().test(testValue1);
51+
}
52+
53+
long test(MyValue1 arg) {
54+
MyAbstract vt1 = MyValue1.createWithFieldsInline(rI, rL);
55+
MyAbstract vt2 = MyValue1.createWithFieldsDontInline(rI, rL);
56+
MyAbstract vt3 = MyValue1.createWithFieldsInline(rI, rL);
57+
MyAbstract vt4 = arg;
58+
return ((MyValue1)vt1).hash() + ((MyValue1)vt2).hash() +
59+
((MyValue1)vt3).hash() + ((MyValue1)vt4).hash();
60+
}
61+
}

0 commit comments

Comments
 (0)