RFR (S): CR 8005926: (thread) Merge ThreadLocalRandom state into java.lang.Thread

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Jan 14 22:51:47 UTC 2013


On 01/15/2013 02:36 AM, Dr Heinz M. Kabutz wrote:
> The padded fields are interesting, as in Java 7 they would quite
> possibly be optimized away or at least rearranged, no?

At my level of HotSpot knowledge I find this very unlikely. Once the
class is loaded, it's layout is finalized. That pretty much means the
padding is with you forever (this is a nice side-effect current
implementation of @Contended is relying on).

>  My own tests
> certainly suggested this.  Probably a case for @Contended?  Also, do
> you intend on moving the padding fields over to Thread too?

Doug insists there is no reason to pad Threads. I suspect there is the
reason. This is the tie needing the empirical study. Preliminary data
(in this thread) suggests we don't need to pad. At this point we can
just wait for dust to settle in, make a do-over for perf experiments and
decide whether to stick @Contended on Thread or not.

-Aleksey.




More information about the core-libs-dev mailing list