Integrated: 8255883: Avoid duplicated GeneratedMethodAccessor when reflect method invoked from different threads
Hui Shi
hshi at openjdk.java.net
Mon Nov 16 11:37:57 UTC 2020
On Thu, 5 Nov 2020 02:52:05 GMT, Hui Shi <hshi at openjdk.org> wrote:
> …AccessorImpl object
>
> We met real problem when using protobuf with option optimized for code size, detail in JBS https://bugs.openjdk.java.net/browse/JDK-8255883
>
> Optimize solution is adding a new boolean field to detect concurrent method accessor generation in same NativeMethodAccessorImpl object, only one thread is allowed to generate accessor, other threads still invoke in jni way until parent's delegator is updated from NativeMethodAccessorImpl to generated accessor.
>
> In common case, extra overhead is an atomic operation, compared with method accessor generate, this cost is trivial.
This pull request has now been integrated.
Changeset: 8eeb36f1
Author: Hui Shi <hshi at openjdk.org>
Committer: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/8eeb36f1
Stats: 46 lines in 2 files changed: 28 ins; 0 del; 18 mod
8255883: Avoid duplicated GeneratedMethodAccessor when reflect method invoked from different threads
Reviewed-by: shade, alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/1070
More information about the core-libs-dev
mailing list