RFR: 8255883: Avoid multiple GeneratedMethodAccessor for same NativeMethod… [v2]

Hui Shi hshi at openjdk.java.net
Sun Nov 8 05:24:59 UTC 2020


On Thu, 5 Nov 2020 14:59:56 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I do wonder if it makes sense to handle triple-state `int` here: "not yet generated", "generated", "in error"? So that we don't try to generate the accessor over and over again when it is in error?
>
> If we are changing NativeMethodAccessorImpl.invoke then we should probably do NativeConstructorAccessorImpl.newInstance at the same time. Also wondering if we should, while in the area, add "return acc.invoke(obj, args)" after setting the delegate so that it invokes the newly generated accessor.
> 
> Are there resource or other cases that you have observed where generateMethod fails and then succeeds in a subsequent call?
> 
> @cl4es Do you know of any startup tests that might be sensitive to the eager creating of a VarHandle?
> 
> I agree with @shipilev to test before the CAS.

@AlanBateman @shipilev  commit is updated, please help reivew it again

1.  add same change in NativeConstructorAccessorImpl
2.  eager creating of a VarHandle in both NativeConstructorAccessorImpl and NativeMethodAccessorImpl will cause error. [http://cr.openjdk.java.net/~hshi/8255883/cyclic_clinit_dependency.txt](url).  Use unsafe API here. 
3.  add test before compareAndSet and remove "succ" variable.

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

PR: https://git.openjdk.java.net/jdk/pull/1070


More information about the core-libs-dev mailing list