JDK 8 code review request for 6838776 Defer initialization of static fields in java.math.BigInteger (original) (raw)

David Holmes David.Holmes at oracle.com
Sat Sep 3 09:09:08 UTC 2011


On 3/09/2011 5:11 PM, Sebastian Sickelmann wrote:

Looks good to me. Nice pattern to use static initialization on first usage of UnsafeHolder instead of using lazy initialization code with double-check-ideom for synchronizing in the two accessing methods. It should works for all vm i have workes with (sun/oracle,ibm) , but is it garanted by vm spec that it is not initialized while initializing Big{Integer,Decimal}?

If I understand your question correctly, class initialization is precisely defined as to when it can and must occur. While the VM has some latitude in loading and linking, initialization can only occur when certain actions take place (JVMS 5.5).

David

-- Sebastian

Am 03.09.2011 02:44, schrieb joe.darcy at oracle.com: Hello.

Please review this change to only instantiated an Unsafe object in BigInteger and BigDecimal if serialization is done: 6838776 Defer initialization of static fields in java.math.BigInteger http://cr.openjdk.java.net/~darcy/6838776.0/ Thanks, -Joe



More information about the core-libs-dev mailing list