Re:What if null was an Object in Java?
by kbolino on Monday April 29, 2024 @07:01PM
(#40205181)
This too is thanks to JSR-133. In fact, it seems that, thanks to this part of JSR-133, what I said above about marking shared volatile is actually unnecessary. There must be a memory barrier somewhere, under the hood, though.
[ Parent
| on HN ]
Re:What if null was an Object in Java?
by charleslmunger on Monday April 29, 2024 @11:36PM
(#40206970)
At least on android arm64, looks like a `dmb ishst` is emitted after the constructor, which allows future loads to not need an explicit barrier. Removing `final` from the field causes that barrier to not be emitted.
https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename...