…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. ------------- Commit messages: - 8255883: Avoid multiple GeneratedMethodAccessor for same NativeMethodAccessorImpl object Changes: https://git.openjdk.java.net/jdk/pull/1070/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1070&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8255883 Stats: 34 lines in 1 file changed: 24 ins; 0 del; 10 mod Patch: https://git.openjdk.java.net/jdk/pull/1070.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/1070/head:pull/1070 PR: https://git.openjdk.java.net/jdk/pull/1070