# HG changeset patch # User dsamersoff # Date 1528624718 -10800 # Node ID 65e65d5905bcb3ba994c8a6d20dd2b61deb6f12d # Parent 6c12c0bf0962204d9ff39d847f3b25bcc6fc4eb6 8202705: ARM32 build crashes on long JavaThread offsets Summary: Account extra bytes at the beginning of JavaThread Reviewed-by: shade, roland, dsamersoff Contributed-by: boris.ulasevich@bell-sw.com diff -r 6c12c0bf0962 -r 65e65d5905bc src/hotspot/cpu/arm/macroAssembler_arm.cpp --- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp Sat Jun 09 20:57:43 2018 -0700 +++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp Sun Jun 10 12:58:38 2018 +0300 @@ -1367,9 +1367,12 @@ // Bump total bytes allocated by this thread Label done; - ldr(tmp, Address(Rthread, in_bytes(JavaThread::allocated_bytes_offset()))); + // Borrow the Rthread for alloc counter + Register Ralloc = Rthread; + add(Ralloc, Ralloc, in_bytes(JavaThread::allocated_bytes_offset())); + ldr(tmp, Address(Ralloc)); adds(tmp, tmp, size_in_bytes); - str(tmp, Address(Rthread, in_bytes(JavaThread::allocated_bytes_offset())), cc); + str(tmp, Address(Ralloc), cc); b(done, cc); // Increment the high word and store single-copy atomically (that is an unlikely scenario on typical embedded systems as it means >4GB has been allocated) @@ -1387,14 +1390,17 @@ } push(RegisterSet(low, high)); - ldrd(low, Address(Rthread, in_bytes(JavaThread::allocated_bytes_offset()))); + ldrd(low, Address(Ralloc)); adds(low, low, size_in_bytes); adc(high, high, 0); - strd(low, Address(Rthread, in_bytes(JavaThread::allocated_bytes_offset()))); + strd(low, Address(Ralloc)); pop(RegisterSet(low, high)); bind(done); + + // Unborrow the Rthread + sub(Rthread, Ralloc, in_bytes(JavaThread::allocated_bytes_offset())); #endif // AARCH64 }