RFR: 8153334: Replace BufferedInputStreams use of AtomicReferenceFieldUpdater with Unsafe
claes.redestad at oracle.com
Tue Apr 5 15:15:14 UTC 2016
On 04/04/2016 05:45 PM, Martin Buchholz wrote:
>> I think this one is going too far.
>> A*FU/VarHandles should are supposed to act like a go-to replacement for
>> Unsafe throughout the class library, and we want to shrink the Unsafe
>> exposure. Also, I don't think removing A*FU in favor of Unsafe here wins
>> us anything: there should be no throughput hit, and we*will* load A*FU
>> down the road anyway, negating the startup wins.
> It is surprising to see new uses of Unsafe when we have an ongoing
> initiative within openjdk (especially from Paul Sandoz) to remove most
> uses. Varhandles are coming and are expected to replace uses of
> Unsafe in the JDK.
This is just a very minor win on hello world/-version style tests, so
I'm happy to withdraw this if other early usages, such as CHM, is moving
to VarHandles anyhow.
OTOH using dangerous, internal APIs like this rather than nice, public
APIs early in the VM bootstrap has other merits, such as not
unintentionally causing bootstrap issues. Say, I don't know if
VarHandles have any dependencies on java.lang.invoke currently...
More information about the core-libs-dev