RFR (S) 8073479: Replace obj.getClass hacks with Objects.requireNonNull

Vitaly Davidovich vitalyd at gmail.com
Fri Feb 20 14:20:08 UTC 2015


I really hope this doesn't require intrinsifying requireNonNull since, as
mentioned before, this is a general issue.  I'm almost tempted to say that
JIT should always treat a null check followed by an explicit NPE as being
an uncommon path, despite what profile may say.

sent from my phone
On Feb 20, 2015 8:18 AM, "Aleksey Shipilev" <aleksey.shipilev at oracle.com>
wrote:

> Hi Peter,
>
> Thanks for additional testing!
>
> On 02/20/2015 03:48 PM, Peter Levart wrote:
> > So we hope for Objects.requireNonNull to be inlined most of the times.
>
> Yes, I think so, otherwise it is a platform bug :) And, as I said in
> reply to Vitaly, the ultimate answer would be to intrinsify
> Objects.requireNonNull to unconditionally bias it towards the non-null
> case and implicit NP checks.
>
> The test is actually specifically crafted to amplify the costs of the
> pollution. The side effect of that method is excessive method calls.
> It's not a surprise CPUs can execute the dense code oblivious of minor
> code differences. (Speculation: CPUs need to re-adjust their pipelines
> after the real call, so non-inlined version would pay some extra)
>
> Thanks,
> -Aleksey
>
>
>



More information about the core-libs-dev mailing list