RFR (M): 8069591: Customize LambdaForms which are invoked using MH.invoke/invokeExact
john.r.rose at oracle.com
Wed Jan 21 19:30:28 UTC 2015
On Jan 21, 2015, at 9:31 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> in Invokers.java, I think that checkCustomized should take an Object and not a MethodHandle
> exactly like getCallSiteTarget takes an Object and not a CallSite.
The use of erased types (any ref => Object) in the MH runtime is an artifact of bootstrapping difficulties, early in the project. I hope it is not necessary any more. That said, I agree that the pattern should be consistent.
Vladimir, would you please file a tracking bug for this cleanup, to change MH library functions to use stronger types instead of Object?
> in MethodHandle.java, customizationCount is declared as a byte and there is no check that
> the CUSTOMIZE_THRESHOLD is not greater than 127.
Yes. Also, the maybeCustomize method has a race condition that could cause the counter to wrap. It shouldn't use "+=1" to increment; it should load the old counter value, test it, increment it (in a local), and then store the updated value. That is also one possible place to deal with jumbo CUSTOMIZE_THRESHOLD values.
More information about the core-libs-dev