News for hackers. Stuff that matters.
Re:Using JDK 9 Memory Order Modes by _old_dude_ on Thursday March 16, 2017 @05:31AM (#13883670)
It can be one mov + cmp + je in assembly, but it's not always the case.

It's an instanceof check, if the class of the field is final (or can be proven to be effectively final by CHA) then it's a null check follow by a pointer check. Theoretically, the null check can proved to be unnecessary, be fused with another or be transformed to an implicitly nullcheck but in specific the case of an AtomicReferenceFieldUpdater, null is usually a valid value (by example, null is used as tombstone in many concurrent data structure implementations) so it's usually more than just a getClass() and a pointer check.

Re:Using JDK 9 Memory Order Modes by sreque on Thursday March 16, 2017 @06:38PM (#13889813)
From what I've read, until recently this wasn't actually the case for the field updater classes. Instead, Java does things like not trusting your fields' finality and not treating anything as constant. Let me see if I can find the blog post.

Here we go: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&e...