VarHandles on non-int-sized fields and atomic operations
Martin Buchholz
martinrb at google.com
Tue May 24 23:30:44 UTC 2016
On Mon, May 23, 2016 at 7:43 PM, John Rose <john.r.rose at oracle.com> wrote:
> It doesn't scale well if there is unrelated activity on nearby bytes.
> But, for that matter, "nearby" can mean "within 64 bytes",
> which is why we have @Contended for when we really need it.
Because "nearby" means "within 64 bytes", I think it's a non-issue for
small atomic value types.
There is no significant difference between atomic and plain fields.
---
As for the storage for a boolean, 1-bit, 8-bit and 32-bit are all
plausible choices for VMs today. 1-bit storage is most compact of
course, but is rejected as too expensive because modern machines don't
have instructions to modify single bits, and because sequences of
adjacent booleans are rare. But note that we implement BitSet using a
long[] kludge because of the lack of a compact boolean[] with
1-bit/boolean.
More information about the core-libs-dev
mailing list