Request for review (S): JDK-8011009: Use do-while(0) instead of while(0) in EC_TRACE and RC_TRACE* macros

Remi Forax forax at univ-mlv.fr
Thu Mar 28 17:26:31 PDT 2013


On 03/29/2013 01:19 AM, John Rose wrote:
> On Mar 28, 2013, at 5:01 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
>
>> John, with lambdas that capture variables there's still the issue of allocating the holder class isn't there? So you remove the overhead of deriving the message but you still get GC churn (unless JIT inlines and escape analyzes out the alloc, but I don't think it's very reliable).
> The "holder object" is stateless and can be adjusted by the runtime system, so we can play tricks like you point out.  It is a prime candidate for escape analysis, for example.  The JVM can delay allocation of certain objects by putting a "recipe" for the desired object in the debug info, and only executing it after an uncommon trap.

That means you still need to keep the register that contains 'x' longer 
than you should (if x is not used after the call to maybe_log).

>
> For making such transforms absolutely reliable we need macros or AOT or "assert 2.0" or something like that.  But I hope users can get most of what they want from good-enough optimization of lambda.

or invokedynamic in Java
(correct me if I'm wrong but there is no uncommon trap if the BSM 
returns a no-op).

>
> — John

Rémi



More information about the hotspot-dev mailing list