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:55:42 PDT 2013
On 03/29/2013 01:49 AM, Vitaly Davidovich wrote:
> How's it stateless if it's capturing variables in the caller? Or do you
> mean you encode the recipe somewhere and holder just cooks it up if needed?
> So uncommon trap may start deoptimizing repeatedly and at some point kill
> the optimization entirely - benefits of recipe go away here?
I think that the idea is to make the deopt a little smarter to instead
of just transferng registers value to interpreter data structures,
you add a pass that is able to create lambda proxy
(I don't see how to make that generics for any object).
IMO, it's better to do the create the lambda proxy just before
the uncommon trap exactly like partial escape analysis does.
>
> Anyway, what I find missing in java is "watered down" macros/compiler
> directives ala C# - it hits the common cases well without allowing abuse.
> That's really what I'd want - in a lot of these cases I don't want some
> code to appear in the bytecode at all, nevermind being optimized by JIT.
> All we have in java to emulate this is static final boolean inside
> compilation unit, which is a hack and requires source change to toggle. :)
>
> Thanks
cheers,
Rémi
>
> Sent from my phone
> On Mar 28, 2013 8:19 PM, "John Rose" <john.r.rose at oracle.com> 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.
>>
>> 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.
>>
>> — John
>>
More information about the hotspot-dev
mailing list