RFR: 8201179: Regression due loading java.nio.charset.StandardCharsets during bootstrap
Xueming Shen
xueming.shen at oracle.com
Mon Apr 9 20:28:07 UTC 2018
On 4/9/18, 6:45 AM, Claes Redestad wrote:
> Hi,
>
> JDK-8200310 cleaned up java.nio.charset.StandardCharsets to not use
> Charset.forName, but also removed the optimization to have
> unconditionally loaded charsets set up static INSTANCE constants,
> which means that many systems the java.nio.charset.StandardCharsets
> will be initialized in System.initPhase1.
>
> This should be avoided since at this point the VM is just booting up
> and any code executed delays initialization of JIT etc.
>
> Webrev: http://cr.openjdk.java.net/~redestad/8201179/open.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8201179
>
> This patch makes all the constants in j.n.c.StandardCharsets use new
> INSTANCE fields of each respective Charset and adds some comments as
> to why they exist.
this is fine.
>
> I also think we should avoid depending on j.n.c.StandardCharsets
> within java.base as to not accidentally execute more code in
> initPhase1 than absolutely necessary, so I've changed uses in core
> packages (java.lang, java.util, java.zip...) to use the internal
> alternative.
is this really necessary? it appears to introduces in an unnecessary
dependency on the location of
the internal implementation of .UTF_8.
sherman
>
> Thanks!
>
> /Claes
>
More information about the nio-dev
mailing list