RFR (S): [MVT] Support lambda form customization in LambdaFormBuilder

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jul 19 20:40:04 UTC 2017



On 19/07/17 19:40, Vladimir Ivanov wrote:
>
> On 7/19/17 9:05 PM, Maurizio Cimadamore wrote:
>> Is there any value in having the 'assert', given that the method 
>> 'checkActualReceiver' always returns true? Taking thing further - do you 
>
> checkActualReceiver() inserts a check on bytecode into compiled 
> lambda. It is deliberately guarded by an assert to generate that only 
> in testing mode.
Ah devious! - I never came across to that pattern before; reminds me of the

if (DEBUG) { ... }

trick (if DEBUG is a static constant, the compiler will generate or omit 
the code depending on the constant value).

Ok - approved.

Maurizio
>
>> need a method at all? Do you expect this to be used in other places?
>
> No, it's not required and shouldn't be used anywhere else. But it's 
> easier to guard the check using assert than 
> Class.desiredAssertionStatus().
>
> Best regards,
> Vladimir Ivanov
>
>> On 19/07/17 18:40, Vladimir Ivanov wrote:
>>> http://cr.openjdk.java.net/~vlivanov/valhalla/8184938/webrev.00/
>>>
>>> Implement lambda form customization in LambdaFormBuilder. 
>>> (Duplicated logic from InvokerBytecodeGenerator.)
>>>
>>> LF customization is crucial for performant MH.invoke() and 
>>> MH.invokeExact() on non-constant method handles. It enables 
>>> JIT-compilers to generate a single nmethod for the whole method 
>>> handle chain.
>>>
>>> Otherwise, the method handle chain scatters into numerous nmethods 
>>> (one for each method handle) which severely affects performance 
>>> (especially for MVT where Q-typed lambda forms can't be compiled as 
>>> a root.)
>>>
>>> Testing: jdk/test/valhalla/mvt/
>>>
>>> Best regards,
>>> Vladimir Ivanov
>>



More information about the valhalla-dev mailing list