Questions about CompareAndSwap
Aleksey Shipilev
aleksey.shipilev at oracle.com
Fri Nov 20 21:35:19 UTC 2015
Hi Roman,
On 11/20/2015 06:31 PM, Roman Kennke wrote:
> 2. Would it be possible to also get the actual old-value out of
> CompareAndSwapP, in addition to the flags? My idea is that
> CompareAndSwapP would be a MultiNode producing two outputs. Would that
> be possible? Would there be any disadvantages (i.e. loss of performance
> due to messed up optimizations, or such?)
Actually, VarHandles add new compareAndExchange methods, that are
intrinsified with the new C1/C2 code. Those methods return old value on
success, and expected value on failure (actually, they leave accumulator
untouched on failure) -- pretty much what you expect from x86-style lock
cmpxchg.
We already did prototypal x86_*.ad changes for them. See:
https://bugs.openjdk.java.net/browse/JDK-8136761
We are planning to sweep the implementation, and hit the review soon.
Thanks,
-Aleksey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20151121/aa42b933/signature-0001.asc>
More information about the hotspot-compiler-dev
mailing list