--- old/src/hotspot/share/code/nmethod.cpp 2017-10-13 18:23:38.520905076 -0400 +++ new/src/hotspot/share/code/nmethod.cpp 2017-10-13 18:23:38.130677275 -0400 @@ -1661,20 +1661,16 @@ // This code must be MP safe, because it is used from parallel GC passes. bool nmethod::test_set_oops_do_mark() { assert(nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called"); - nmethod* observed_mark_link = _oops_do_mark_link; - if (observed_mark_link == NULL) { + if (_oops_do_mark_link == NULL) { // Claim this nmethod for this thread to mark. - observed_mark_link = (nmethod*) - Atomic::cmpxchg_ptr(NMETHOD_SENTINEL, &_oops_do_mark_link, NULL); - if (observed_mark_link == NULL) { - + if (Atomic::cmpxchg(NMETHOD_SENTINEL, &_oops_do_mark_link, (nmethod*)NULL) == NULL) { // Atomically append this nmethod (now claimed) to the head of the list: nmethod* observed_mark_nmethods = _oops_do_mark_nmethods; for (;;) { nmethod* required_mark_nmethods = observed_mark_nmethods; _oops_do_mark_link = required_mark_nmethods; - observed_mark_nmethods = (nmethod*) - Atomic::cmpxchg_ptr(this, &_oops_do_mark_nmethods, required_mark_nmethods); + observed_mark_nmethods = + Atomic::cmpxchg(this, &_oops_do_mark_nmethods, required_mark_nmethods); if (observed_mark_nmethods == required_mark_nmethods) break; } @@ -1690,9 +1686,9 @@ void nmethod::oops_do_marking_prologue() { if (TraceScavenge) { tty->print_cr("[oops_do_marking_prologue"); } assert(_oops_do_mark_nmethods == NULL, "must not call oops_do_marking_prologue twice in a row"); - // We use cmpxchg_ptr instead of regular assignment here because the user + // We use cmpxchg instead of regular assignment here because the user // may fork a bunch of threads, and we need them all to see the same state. - void* observed = Atomic::cmpxchg_ptr(NMETHOD_SENTINEL, &_oops_do_mark_nmethods, NULL); + nmethod* observed = Atomic::cmpxchg(NMETHOD_SENTINEL, &_oops_do_mark_nmethods, (nmethod*)NULL); guarantee(observed == NULL, "no races in this sequential code"); } @@ -1707,8 +1703,8 @@ NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark")); cur = next; } - void* required = _oops_do_mark_nmethods; - void* observed = Atomic::cmpxchg_ptr(NULL, &_oops_do_mark_nmethods, required); + nmethod* required = _oops_do_mark_nmethods; + nmethod* observed = Atomic::cmpxchg((nmethod*)NULL, &_oops_do_mark_nmethods, required); guarantee(observed == required, "no races in this sequential code"); if (TraceScavenge) { tty->print_cr("oops_do_marking_epilogue]"); } }