RFR 8062180: MethodHandleImpl.makeArrays throws and swallows java.lang.NoSuchFieldError in normal flow
Claes Redestad
claes.redestad at oracle.com
Tue Nov 4 20:57:26 UTC 2014
Hi,
please review this minor improvement to the initialization of
MethodHandleImpl$Lazy. Running any code which initializes
MethodHandlesImpl$Lazy will trigger throwing of
java.lang.NoSuchFieldErrors, which has a measurable impact on startup.
Additionally, the current lookup via findCollector in varargsArray is
pointless (and will throw additional java.lang.NoSuchFieldErrors the
first time a varargsArray of arity > 11 is requested) since all static
methods which can be found will have been constructed already.
bug: https://bugs.openjdk.java.net/browse/JDK-8062180
webrev: http://cr.openjdk.java.net/~redestad/8062180/webrev.00/
A simple microbenchmark[1] show a very small (~0.5ms) improvement for
Class.forName("java.lang.invoke.MethodHandleImpl$Lazy")
Benchmark Mode Samples Score Score
error Units
o.s.CLBench.loadMethodHandleImplLazy ss 100 46.364
1.740 ms
o.s.CLBench.loadMethodHandleImplLazy ss 100 45.440
1.515 ms
Thanks!
/Claes
[1] package org.sample;
import org.openjdk.jmh.annotations.*;
import javax.script.*;
@State(Scope.Thread)
public class CLBench {
@Benchmark
public Object loadMethodHandleImplLazy() throws Exception {
return Class.forName("java.lang.invoke.MethodHandleImpl$Lazy");
}
}
More information about the core-libs-dev
mailing list