RFR: 8221477: Inject os/cpu-specific constants into Unsafe from JVM

Andrew Dinn adinn at redhat.com
Thu Mar 28 10:44:17 UTC 2019

Could I please have reviews for this patch which changes the
initialization of four os/cpu-specific static final constants used by
class Unsafe. The patch injects values during JVM startup (along similar
lines to how String field COMPACT_STRINGS is initialized) rather than
retrieving them via native method calls. This localizes the computation
of the assigned values in one place, relocates the constants into a
separate final, static-only Java class and avoids the need to maintain
four separate native methods.

A further motive for making this change is to pave the way for adding
the writeback cache line size/address mask as Unsafe constants for use
by the JEP proposed in JDK-8207851.

JIRA:   https://bugs.openjdk.java.net/browse/JDK-8221477
Webrev: http://cr.openjdk.java.net/~adinn/8221477/webrev.01

submit repo tests passed


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the core-libs-dev mailing list