Is there a way to perform a double-width (16-byte) compare-and-swap in Java if the hardware supports it (e.g. using CMPXCHG16B on Intel)?
Asked
Active
Viewed 124 times
0
-
You would have to use a library with a native implementation. – kaya3 Mar 09 '22 at 18:31
1 Answers
0
No.
There is no instruction in the Java Byte code specification that covers that. And there is also nothing in the Java Language specification to work around "deficiency".
So, theoretically, a JVM implementation might compile certain Java byte code sequences in order to use such hardware based instructions. But as said: that would be implementation specific.

GhostCat
- 137,827
- 25
- 176
- 248