RFR: 8291555: Replace stack-locking with fast-locking
Robbin Ehn
rehn at openjdk.org
Thu Oct 6 07:47:22 UTC 2022
On Mon, 12 Sep 2022 07:54:48 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> Nice! From your snippets above I am gleaning that your implementation has the actual lock-stack in Java. Is that correct? Is there a particular reason why you need this? Is this for Loom? Would the implementation that I am proposing here also work for your use-case(s)?
>
Yes, the entire implementation is in Java.
void push(Object lockee, long fid) {
if (this != Thread.currentThread()) Monitor.abort("invariant");
if (lockStackPos == lockStack.length) {
grow();
}
frameId[lockStackPos] = fid;
lockStack[lockStackPos++] = lockee;
}
We are starting from the point of let's do everything be in Java.
I want smart people to being able to change the implementation.
So I really don't like the hardcoded assembly in remove_activation which do this check on frame id on the lock stack.
If we can make the changes to e.g. popframe and take a bit different approach to JVMS we may have a total flexible Java implementation.
But a flexible Java implementation means compiler can't have intrinsics, so what will the performance be....
We have more loose-ends than we can handle at the moment.
Your code may be useable for JOM if we lock the implementation to using a lock-stack and we are going to write intrinsics to it.
There is no point of it being in Java if so IMHO.
-------------
PR: https://git.openjdk.org/jdk/pull/9680
More information about the serviceability-dev
mailing list