apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: apr/test testatomic.c
Date Tue, 19 Feb 2002 23:45:06 GMT
ianh        02/02/19 15:45:06

  Modified:    .        configure.in
               atomic/solaris_sparc apr_atomic_sparc.s
               include  apr_atomic.h
               test     testatomic.c
  Log:
  enable sun-sparc specific code
  
  Revision  Changes    Path
  1.409     +12 -0     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.408
  retrieving revision 1.409
  diff -u -r1.408 -r1.409
  --- configure.in	15 Feb 2002 22:36:40 -0000	1.408
  +++ configure.in	19 Feb 2002 23:45:06 -0000	1.409
  @@ -322,6 +322,18 @@
          enable_threads="no"
          eolstr="\\n"
          ;;
  +   *sun*)
  +       case $host_cpu in
  +        *sparc*)
  +           OSDIR="solaris_sparc"
  +           eolstr="\\n"
  +            ;;
  +        *)
  +            OSDIR="unix"
  +            eolstr="\\n"
  +            ;;
  +       esac
  +       ;;
      *)
          OSDIR="unix"
          eolstr="\\n"
  
  
  
  1.3       +30 -7     apr/atomic/solaris_sparc/apr_atomic_sparc.s
  
  Index: apr_atomic_sparc.s
  ===================================================================
  RCS file: /home/cvs/apr/atomic/solaris_sparc/apr_atomic_sparc.s,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_atomic_sparc.s	17 Feb 2002 20:17:53 -0000	1.2
  +++ apr_atomic_sparc.s	19 Feb 2002 23:45:06 -0000	1.3
  @@ -71,19 +71,20 @@
   !
           ENTRY(apr_atomic_add_sparc)
   
  -        ld 		[%o0], %o2 
  +        ld 		[%o0], %o2                   ! set o2 to current value
   _apr_atomic_add_sparc_loop:
  -        add 	%o2, %o1, %o3
  -        cas 	[%o0], %o2, %o3
  -        cmp 	%o2, %o3
  -        bne,a 	_apr_atomic_add_sparc_loop
  -        ld 		[%o0], %o2
  +        add 	%o2, %o1, %o3                ! o3 = o2 + o1 
  +        cas 	[%o0], %o2, %o3              ! if cur-val==o2 then cur-val=03
  +        cmp 	%o2, %o3                     ! see if the CAS worked
  +        bne,a 	_apr_atomic_add_sparc_loop   ! if not try again
  +        ld 		[%o0], %o2                   ! return the previous value
           retl
           mov 	%o3, %o0
   
           SET_SIZE(apr_atomic_add_sparc)
   !
   !
  +! 
           ENTRY(apr_atomic_sub_sparc)
   
           ld 		[%o0], %o2
  @@ -96,5 +97,27 @@
           retl
           mov 	%o3, %o0
   
  -       SET_SIZE(apr_atomic_sub_sparc)
  +        SET_SIZE(apr_atomic_sub_sparc)
  +!
  +!
  +!       
  +!     %o0  [input]   - the address of the value to compare
  +!     %o1  [input]   - the new value
  +!     %o2  [input]   - value to compare against
  +!     %o0  [output]  - the return value
  +!
  +        ENTRY(apr_atomic_cas_sparc)
  +        ENTRY(apr_atomic_casptr_sparc)
  +
  +        cas 	[%o0], %o2, %o1
  +        cmp     %o1, %o2        ! if o1 == o2 values weren't swapped
  +        bne,a 	_apr_atomic_cas_ne
  +        mov      %o2, %o0
  +        retl
  +        mov      %o2, %o0
  +_apr_atomic_cas_ne:
  +        retl
  +        mov      %o1, %o0
  +        
  +        SET_SIZE(apr_atomic_cas_sparc)
   
  
  
  
  1.8       +1 -1      apr/include/apr_atomic.h
  
  Index: apr_atomic.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_atomic.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_atomic.h	19 Feb 2002 23:15:40 -0000	1.7
  +++ apr_atomic.h	19 Feb 2002 23:45:06 -0000	1.8
  @@ -173,7 +173,7 @@
   
   #define APR_ATOMIC_NEED_CAS_DEFAULT 1
   
  -#elif defined(__sparc__not_yet)
  +#elif defined(__sparc__)
   #define apr_atomic_t apr_uint32_t
   #define apr_atomic_read(p)  *p
   
  
  
  
  1.5       +0 -1      apr/test/testatomic.c
  
  Index: testatomic.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testatomic.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testatomic.c	19 Feb 2002 23:15:39 -0000	1.4
  +++ testatomic.c	19 Feb 2002 23:45:06 -0000	1.5
  @@ -83,7 +83,6 @@
           return APR_EGENERAL;
       }
       printf("OK\n");
  -    printf("debug\n y=%d\n",y);
       printf("%-60s", "testing CAS - match non-null");
       oldval = apr_atomic_cas(&y,23,12);
       if (oldval != 12) {
  
  
  

Mime
View raw message