[committed] Add locking semaphore to sysdep/pa/locks.h

Boehm, Hans hans.boehm@hp.com
Wed Jan 4 01:11:00 GMT 2006


I agree that your patch obeys the correct ordering constraints.

But I looked quickly at some of the other implementations, and it wasn't
really clear to me what the ordering constraints are for plain
compare_and_swap.  I think the ia64 intrinsic that's used
(__sync_bool_compare_and_swap) has full fence semantics, which I think
is more than what the client code usually wants, and presumably adds an
extra memory fence.

The PowerPC version seems to have only "acquire" semantics, which is
probably right, but not suggested by the name.

Hans

> 
> There was some consideration of memory ordering issues in the 
> patch.  Hopefully, the compiler issues are covered by the 
> "memory" constraints in the asms.  From the processor 
> standpoint, ldcw is always strongly ordered.  The reset of 
> the semaphore is also done with an instruction which is 
> strongly ordered in both PA 1.x and 2.0.  It would be 
> interesting to compare results with your double-checked locking.
> 
> There has been some mention of this scheme in the discussions 
> about TLS.
> 
> Dave
> -- 
> J. David Anglin                                  
> dave.anglin@nrc-cnrc.gc.ca
> National Research Council of Canada              (613) 
> 990-0752 (FAX: 952-6602)
> 



More information about the Java mailing list