From: Gurusamy Sarathy Date: Tue, 23 Jun 1998 06:16:19 +0000 (+0000) Subject: remove atomic.h pending resolution of licensing issues, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=79d59c5fb5157b1d0f6b0f748bbade6eb3de3bb8;p=p5sagit%2Fp5-mst-13.2.git remove atomic.h pending resolution of licensing issues, EMULATE_ATOMIC_REFCOUNTS everywhere p4raw-id: //depot/perl@1202 --- diff --git a/MANIFEST b/MANIFEST index 2ea4890..7cb045d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -37,7 +37,6 @@ Todo The Wishlist Todo.5.005 What needs doing before 5.005 release XSLock.h Include file for extensions built with PERL_OBJECT defined XSUB.h Include file for extension subroutines -atomic.h Atomic refcount handling for multi-threading av.c Array value code av.h Array value header beos/nm.c BeOS port diff --git a/atomic.h b/atomic.h deleted file mode 100644 index 4c44a89..0000000 --- a/atomic.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifdef __GNUC__ - -/* - * These atomic operations copied from the linux kernel and altered - * only slightly. I need to get official permission to distribute - * under the Artistic License. - */ -/* We really need to integrate the atomic typedef with the typedef - * used by sv_refcnt of an SV. It's possible that for CPUs like alpha - * where we'd need to up sv_refcnt from 32 to 64 bits, we may be better - * off sticking with EMULATE_ATOMIC_REFCOUNTS instead. - */ -typedef U32 atomic_t; /* kludge */ - -#ifdef i386 - -# ifdef NO_SMP -# define LOCK "" -# else -# define LOCK "lock ; " -# endif - -# define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x) -static __inline__ void atomic_inc(atomic_t *v) -{ - __asm__ __volatile__( - LOCK "incl %0" - :"=m" (__atomic_fool_gcc(v)) - :"m" (__atomic_fool_gcc(v))); -} - -static __inline__ int atomic_dec_and_test(atomic_t *v) -{ - unsigned char c; - - __asm__ __volatile__( - LOCK "decl %0; sete %1" - :"=m" (__atomic_fool_gcc(v)), "=qm" (c) - :"m" (__atomic_fool_gcc(v))); - return c != 0; -} -# else -/* XXX What symbol does gcc define for sparc64? */ -# ifdef sparc64 -# define __atomic_fool_gcc(x) ((struct { int a[100]; } *)x) -typedef U32 atomic_t; -extern __inline__ void atomic_add(int i, atomic_t *v) -{ - __asm__ __volatile__(" -1: lduw [%1], %%g5 - add %%g5, %0, %%g7 - cas [%1], %%g5, %%g7 - sub %%g5, %%g7, %%g5 - brnz,pn %%g5, 1b - nop" - : /* No outputs */ - : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g5", "g7", "memory"); -} - -extern __inline__ int atomic_sub_return(int i, atomic_t *v) -{ - unsigned long oldval; - __asm__ __volatile__(" -1: lduw [%2], %%g5 - sub %%g5, %1, %%g7 - cas [%2], %%g5, %%g7 - sub %%g5, %%g7, %%g5 - brnz,pn %%g5, 1b - sub %%g7, %1, %0" - : "=&r" (oldval) - : "HIr" (i), "r" (__atomic_fool_gcc(v)) - : "g5", "g7", "memory"); - return (int)oldval; -} - -#define atomic_inc(v) atomic_add(1,(v)) -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) -/* Add further gcc architectures here */ -# else -# define EMULATE_ATOMIC_REFCOUNTS -# endif /* sparc64 */ -#endif /* i386 */ -#else -/* Add non-gcc native atomic operations here */ -# define EMULATE_ATOMIC_REFCOUNTS -#endif diff --git a/perl.h b/perl.h index fb527f6..a2fa03d 100644 --- a/perl.h +++ b/perl.h @@ -1115,6 +1115,10 @@ typedef I32 (*filter_t) _((int, SV *, int)); */ #ifdef USE_THREADS + /* pending resolution of licensing issues, we avoid the erstwhile + * atomic.h everywhere */ +# define EMULATE_ATOMIC_REFCOUNTS + # ifdef FAKE_THREADS # include "fakethr.h" # else diff --git a/sv.h b/sv.h index ca3a2df..6bf7817 100644 --- a/sv.h +++ b/sv.h @@ -74,10 +74,6 @@ struct io { #ifdef USE_THREADS -# ifndef EMULATE_ATOMIC_REFCOUNTS -# include "atomic.h" -# endif - # ifdef EMULATE_ATOMIC_REFCOUNTS # define ATOMIC_INC(count) STMT_START { \ MUTEX_LOCK(&svref_mutex); \