RFR(S): 8161379: @CallerSensitive methods should be forcefully inlined to get Reflection.getCallerClass optimization
claes.redestad at oracle.com
Tue Jul 19 12:19:20 UTC 2016
On 2016-07-19 11:16, Paul Sandoz wrote:
>> On 19 Jul 2016, at 01:59, Christian Thalinger <cthalinger at twitter.com
>> <mailto:cthalinger at twitter.com>> wrote:
>> The right way to do this is to add the @ForceInline annotation in the
>> source code.
> That would be my preference.
> According to my IDE it reports 131 usages of @CallerSensitive in
> java.base. Do we really want all such methods to be implicitly
> @ForcedInlined or only a select few?
I think based on performance testing that there'd be little to no harm,
since those that aren't hot enough to be compiled in the first place
will see no difference, while those that are will potentially see an
order of magnitude difference in performance.
That said we could filter out those @CallerSensitive methods where we
don't also do a Reflection.getCallerClass(), or where it's obvious that
the method is only ever used sparingly, e.g., during initialization.
I'll withdraw this and roll a patch to @ForceInline explicitly the
remaining (most) @CallerSensitive methods and send it to core-libs.
More information about the hotspot-compiler-dev