Accelerating Sequential Consistency for Java with Speculative Compilation
A memory consistency model (or simply a memory model) specifies the granularity and the order in which memory accesses by one thread become visible to other threads in the program.
We previously proposed the volatile-by-default (VBD) memory model as a natural form of sequential consistency (SC) for Java. VBD is significantly stronger than the Java memory model (JMM) and incurs relatively modest overheads in a modified HotSpot JVM running on Intel x86 hardware. However, the x86 memory model is already quite close to SC. It is expected that the cost of VBD will be much higher on the other widely used hardware platform today, namely ARM, whose memory model is very weak.
In this paper, we quantify this expectation by building and evaluating a baseline volatile-by-default JVM for ARM called VBDA-HotSpot, using the same technique previously used for x86. Through this baseline we report, to the best of our knowledge, the first comprehensive study of the cost of providing language-level SC for a production compiler on ARM. VBDA-HotSpot indeed incurs a considerable performance penalty on ARM, with average overheads on the DaCapo benchmarks on two ARM servers of 57% and 73% respectively.
Motivated by these experimental results, we then present a novel speculative technique to optimize language-level SC. While several prior works have shown how to optimize SC in the context of an offline, whole-program compiler, to our knowledge this is the first optimization approach that is compatible with modern implementation technology, including dynamic class loading and just-in-time (JIT) compilation.
The basic idea is to modify the JIT compiler to treat each object as thread-local initially, so accesses to its fields can be compiled without fences. If an object is ever accessed by a second thread, any speculatively compiled code for the object is removed, and future JITed code for the object will include the necessary fences in order to ensure SC. We demonstrate that this technique is effective, reducing the overhead of enforcing VBD by one-third on average, and additional experiments validate the thread-locality hypothesis that underlies the approach.
Mon 24 Jun
|08:45 - 09:05|
Christopher PulteUniversity of Cambridge, Jean Pichon-PharabodUniversity of Cambridge, Jeehoon KangKAIST, Sung-Hwan LeeSeoul National University, South Korea, Chung-Kil HurSeoul National UniversityMedia Attached
|09:05 - 09:25|
Lun LiuUniversity of California at Los Angeles, USA, Todd MillsteinUniversity of California, Los Angeles, Madan MusuvathiMicrosoft ResearchDOI Pre-print Media Attached
|09:25 - 09:45|
Aleksandar ProkopecOracle Labs, Andrea RosàUniversity of Lugano, Switzerland, David LeopoldsederJohannes Kepler University Linz, Gilles DuboscqOracle Labs, Petr TumaCharles University, Martin StudenerJKU Linz, Austria, Lubomír BulejCharles University, Yudi ZhengOracle Labs, Alex VillazónUniversidad Privada Boliviana, Bolivia, Doug SimonOracle Labs, Thomas WuerthingerOracle Labs, Walter BinderUniversity of Lugano, Switzerland