Atomic::cmpxchg_ptr code duplication

John Coomes John.Coomes at sun.com
Thu Apr 2 14:01:37 PDT 2009


Christian Thalinger (Christian.Thalinger at Sun.COM) wrote:
> On Thu, 2009-04-02 at 08:23 +0200, Christian Thalinger wrote:
> > > 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?
> > 
> > I don't see a reason for the duplication.  Maybe it's another historic
> > artifact?
> 
> I prepared a patch which removes the unnecessary cmpxchg_ptr and
> xchg_ptr functions:
> 
> http://cr.openjdk.java.net/~twisti/cmpxchg_ptr/webrev.00/
> 
> A JPRT run with that changes was successful.

Cool.  FWIW, I had planned to fix it and filed bug

	6824520 Atomic - remove duplication and improve unsigned type support

But I'll happily let you have it if you want :-).  Let me know.

It might make sense to split up the "remove duplication" part from the
"unsigned type" part, which I included because I'm tired of casting
size_t (widely used in gc code) to intptr_t.

-John




More information about the hotspot-dev mailing list