Hi,

please review this fix to various performance regressions observed
as the security model has evolved over the years.

Bug: https://bugs.openjdk.java.net/browse/JDK-8037325
Webrev: http://cr.openjdk.java.net/~redestad/8037325/webrev.01

- For cases where a SecurityManager is not installed, this improves
performance by avoiding calls to Reflection.getCallerClass, which
can be very expensive when not inlined. Regrettably this adds some
boilerplate.

- For cases where a SecurityManager is installed, this improves
performance slightly by avoiding repeated calls to System.getSecurityManager (which does volatile read).

- Use of Class.getPackageName when appropriate reduce the
number of allocations done.

- Places where doPrivileged calls were used to bypass access checking when calling methods on Class can safely be replaced by calling
corresponding private methods directly if care is taken to copy the
end result as appropriate.

- Finally, by using the recently used ReflectionFactory.getExecutableSharedParameterTypes we also get rid of
some unnecessary copying.

Thanks!

/Claes

Reply via email to