The compilation scheme for Volatile accesses in the OpenJDK 9 HotSpot Java Virtual Machine has a major problem that persists despite a recent bug report and a long discussion. One of the suggested fixes is to let Java compile Volatile accesses in the same way as C/C++11. However, we show that this approach is invalid for Java. Indeed, we show a set of optimizations that is valid for C/C++11 but invalid for Java, while the compilation scheme is similar. We prove the correctness of the compilation scheme to Power and x86 and a suite of valid optimizations in Java. Our proofs are based on a language model that we validate by proving key properties such as the DRF-SC theorem and by running litmus tests via our implementation of Java in Herd7.
@InProceedings{liu_et_al:LIPIcs.ECOOP.2022.6, author = {Liu, Shuyang and Bender, John and Palsberg, Jens}, title = {{Compiling Volatile Correctly in Java}}, booktitle = {36th European Conference on Object-Oriented Programming (ECOOP 2022)}, pages = {6:1--6:26}, series = {Leibniz International Proceedings in Informatics (LIPIcs)}, ISBN = {978-3-95977-225-9}, ISSN = {1868-8969}, year = {2022}, volume = {222}, editor = {Ali, Karim and Vitek, Jan}, publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik}, address = {Dagstuhl, Germany}, URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ECOOP.2022.6}, URN = {urn:nbn:de:0030-drops-162346}, doi = {10.4230/LIPIcs.ECOOP.2022.6}, annote = {Keywords: formal semantics, concurrency, compilation} }
Feedback for Dagstuhl Publishing