RFR: 8187227: __m68k_cmpxchg() is not being used correctly

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Tue Nov 21 10:34:53 UTC 2017


Hi Andrew!

On 11/20/2017 12:13 PM, Andrew Haley wrote:
> For avoidance of doubt, this is what GCC does:
> 
> 
> int m68k_sync_compare_and_swap(int newval,
>                            volatile int *ptr,
>                            int oldval) {
>   return __sync_val_compare_and_swap (ptr, oldval, newval);
> }
> 
> m68k_sync_compare_and_swap:
> 	move.l 4(%sp),%d1
> 	move.l 8(%sp),%a0
> 	move.l 12(%sp),%d0
> 	cas.l %d0,%d1,(%a0)
> 	seq %d1
> 	rts
> 
> You could do many things worse than simply using __sync_val_compare_and_swap
> for Zero on 68k.

This sounds like a good idea. I'll look into using that. Might make the
code also more readable. Although I would be a bit worried that this
introduces too many layers of indirection, wouldn't it?

Thanks for the valuable input!

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


More information about the hotspot-dev mailing list