Atomic::cmpxchg_ptr code duplication
John Coomes
John.Coomes at sun.com
Mon Mar 30 15:38:40 PDT 2009
The Atomic class has both
intptr_t cmpxchg_ptr(intptr_t, volatile intptr_t*, intptr_t);
void* cmpxchg_ptr(void*, volatile void*, void*);
The latter could be implemented as a simple inline which calls the
former:
void* cmpxchg_ptr(void* exchange_value, volatile void* dest,
void* compare_value) {
return (intptr_t)cmpxchg_ptr((intptr_t)exchange_value,
(volatile intptr_t*)dest,
(intptr_t)compare_value
}
However, both the intptr_t and void* variants have bodies defined in
each of the various platform-specific headers (e.g.,
atomic_windows_x86.inline.hpp, atomic_solaris_x86.inline.hpp, ...).
So there are 10 places where the cmpxchg_ptr(void*...) variant is
defined, instead of one. Is there a reason for the duplication?
-John
More information about the hotspot-dev
mailing list