--- a/src/hotspot/share/code/nmethod.cpp Wed Jan 03 17:29:20 2018 +0000
+++ b/src/hotspot/share/code/nmethod.cpp Thu Jan 04 18:18:18 2018 -0500
@@ -1625,7 +1625,7 @@
assert(nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
if (_oops_do_mark_link == NULL) {
// Claim this nmethod for this thread to mark.
- if (Atomic::cmpxchg(NMETHOD_SENTINEL, &_oops_do_mark_link, (nmethod*)NULL) == NULL) {
+ if (Atomic::replace_if_null(NMETHOD_SENTINEL, &_oops_do_mark_link)) {
// Atomically append this nmethod (now claimed) to the head of the list:
nmethod* observed_mark_nmethods = _oops_do_mark_nmethods;
for (;;) {