Request for review (S): JDK-8011009: Use do-while(0) instead of while(0) in EC_TRACE and RC_TRACE* macros
Vitaly Davidovich
vitalyd at gmail.com
Thu Mar 28 17:49:47 PDT 2013
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?
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
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