From 0e0562655cf363e995f8827b3fb9d95cdd61de99 Mon Sep 17 00:00:00 2001 From: Reka Kovacs Date: Tue, 24 Aug 2021 12:38:42 +0000 Subject: [PATCH] 8261072: AArch64: Fix MacroAssembler::get_thread convention Co-authored-by: Monica Beckwith Backport-of: b670efd896a2905b6842b8199261aa2f3d7c12b9 --- src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 19cbfe8ffdd6..f829a5d09325 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5811,10 +5811,14 @@ void MacroAssembler::char_array_compress(Register src, Register dst, Register le // by the call to JavaThread::aarch64_get_thread_helper() or, indeed, // the call setup code. // -// aarch64_get_thread_helper() clobbers only r0, r1, and flags. +// On Linux, aarch64_get_thread_helper() clobbers only r0, r1, and flags. +// On other systems, the helper is a usual C function. // void MacroAssembler::get_thread(Register dst) { - RegSet saved_regs = RegSet::range(r0, r1) + BSD_ONLY(RegSet::range(r2, r17)) + lr - dst; + RegSet saved_regs = + LINUX_ONLY(RegSet::range(r0, r1) + lr - dst) + NOT_LINUX (RegSet::range(r0, r17) + lr - dst); + push(saved_regs, sp); mov(lr, CAST_FROM_FN_PTR(address, JavaThread::aarch64_get_thread_helper));