RFR: 8291555: Implement alternative fast-locking scheme [v28]

Thomas Stuefe stuefe at openjdk.org
Fri Mar 17 06:44:37 UTC 2023


On Fri, 17 Mar 2023 06:33:43 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> 



> > > In my last changes I made a stupid mistake and don't set the condition flags correctly to force the slow-path, on aarch64. This is only relevant when we exceed the lock-stack capacity, that is why it's failing so rarely. I don't see a similar problem on x86_64 - have we observed any failures on x86_64? I pushed a fix for aarch64.
> > 
> > 
> > I noticed this too for arm; I used cmp to clear EQ but using tst seems better. I also do it inside fast_lock, to give it a defined exit state wrt EQ|NE, since it saves me from having to think about this on every call site. But at least the fail case may be fiddly without conditional execution.
> 
> Cmp(r,r) would not clear EQ, but set it. Unless you do cmp(r,0) on a non-null register.

Sure. I used cmp with an immediate that I knew was not the value. Clunky, I know. As I wrote, tst seems better.

> Tst is better at least on x86 because it encodes smaller. _shrugs_
> 
> You can do it in the shared fast_lock() but it's really only needed in C2, that's why I'm doing it there. Maybe I'm too perfectionist when it comes to assembly code?

I felt just better having it there, at least for the start. I may still move it outside to C2. Lets see.

-------------

PR: https://git.openjdk.org/jdk/pull/10907


More information about the serviceability-dev mailing list