RFR: 8153334: Replace BufferedInputStreams use of AtomicReferenceFieldUpdater with Unsafe

Claes Redestad claes.redestad at oracle.com
Sun Apr 3 12:19:52 UTC 2016


Hi Remi,

On 2016-04-03 13:57, Remi Forax wrote:
> Hi Claes,
> the patch is fine for me with the minor nitpick that the static final containing Unsafe should be called UNSAFE and not just U.

sure, I copied the setup/naming convention from ConcurrentHashMap, but 
UNSAFE does make it stand out better.

>
> do you know why BufferedInputStream is loaded in first place during the startup of the VM ?

given the output of -Xlog:classload I think it's first used by 
java.lang.System for what becomes System.in.

Thanks!

/Claes

>
> regards,
> Rémi
>
> ----- Mail original -----
>> De: "Claes Redestad" <claes.redestad at oracle.com>
>> À: "core-libs-dev Libs" <core-libs-dev at openjdk.java.net>
>> Envoyé: Dimanche 3 Avril 2016 02:51:35
>> Objet: RFR: 8153334: Replace BufferedInputStreams use of	AtomicReferenceFieldUpdater with Unsafe
>>
>> Hi,
>>
>> BufferedInputStream is loaded early, and uses
>> AtomicReferenceFieldUpdater to provide
>> CAS functionality to allow for closing streams asynchronously. Using
>> Unsafe directly instead
>> does the exact same thing in the end, but avoids loading a few (4)
>> classes and thus brings
>> us a small startup improvement.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8153334
>> Webrev: http://cr.openjdk.java.net/~redestad/8153334/webrev.01/
>>
>> Thanks!
>>
>> /Claes
>>




More information about the core-libs-dev mailing list