RFR: 8258838: Remove JVM option UseStackBanging [v4]
Martin Doerr
mdoerr at openjdk.java.net
Mon Jan 11 19:00:59 UTC 2021
On Mon, 11 Jan 2021 18:17:34 GMT, Harold Seigel <hseigel at openjdk.org> wrote:
>> Good.
>
> Thanks for the reviews!
Hi Coleen,
thanks for the pointers. I’d like to investigate, but I don’t have enough time for it at the moment.
> The stack banging code still seems like the most efficient way to test for stack overflow in compiled code
I think it would be interesting to re-evaluate this with recent hotspot on modern CPUs with out-of-order execution.
I’d try something like the following x86_64 code:
cmpq(rsp, Address(r15_thread, JavaThread::stack_overflow_limit_offset()));
jump_cc(Assembler::belowEqual, ExternalAddress(StubRoutines::throw_StackOverflowError_entry()));
The branch can be perfectly predicted (usually never taken) and the CPU can execute the succeeding code speculatively before the checking is completed.
In addition, I guess we do more inlining than at the time when stack banging was introduced. More inlining leads to fewer nmethod prologues executed and hence fewer stack overflow checking overhead. I guess the overhead will be below noise.
Advantage would be no cache pollution by stack banging.
And it’d be great to have no need for protected stack pages anymore!
Best regards,
Martin
From: Coleen Phillimore <notifications at github.com>
Sent: Montag, 11. Januar 2021 15:49
To: openjdk/jdk <jdk at noreply.github.com>
Cc: Doerr, Martin <martin.doerr at sap.com>; Mention <mention at noreply.github.com>
Subject: Re: [openjdk/jdk] 8258838: Remove JVM option UseStackBanging (#1988)
The stack banging code still seems like the most efficient way to test for stack overflow in compiled code, but it may be that a pointer comparison in the interpreter entries (that are very inconsistent right now) would be better for them. There are some cleanup RFEs. eg. https://bugs.openjdk.java.net/browse/JDK-8069196 or even https://bugs.openjdk.java.net/browse/JDK-8072070 if you want them @TheRealMDoerr<https://github.com/TheRealMDoerr> they're all yours.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/openjdk/jdk/pull/1988#issuecomment-757998579>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKR64KG2WIBPUOFEY3YKWWTSZMFT7ANCNFSM4VZOPMHA>.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1988
More information about the hotspot-dev
mailing list