develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r34866 - in trunk: include/parrot/atomic src/atomic

From:
infinoid
Date:
January 3, 2009 01:27
Subject:
[svn:parrot] r34866 - in trunk: include/parrot/atomic src/atomic
Message ID:
20090103092714.876E8CB9FA@x12.develooper.com
Author: infinoid
Date: Sat Jan  3 01:27:13 2009
New Revision: 34866

Modified:
   trunk/include/parrot/atomic/gcc_x86.h
   trunk/src/atomic/gcc_x86.c

Log:
In src/atomic/gcc_x86.c, cmpxchg doesn't actually dereference the "expect"
and "update" pointers.  It is conceiveable that you might want to atomically
swap out a NULL pointer for a non-NULL one, or vice versa.  Thus these
arguments should be NULLOK.

Modified: trunk/include/parrot/atomic/gcc_x86.h
==============================================================================
--- trunk/include/parrot/atomic/gcc_x86.h	(original)
+++ trunk/include/parrot/atomic/gcc_x86.h	Sat Jan  3 01:27:13 2009
@@ -22,11 +22,9 @@
 PARROT_CANNOT_RETURN_NULL
 void * parrot_i386_cmpxchg(
     ARGMOD(void *volatile *ptr),
-    ARGIN(void *expect),
-    ARGIN(void *update))
+    ARGIN_NULLOK(void *expect),
+    ARGIN_NULLOK(void *update))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
         FUNC_MODIFIES(*ptr);
 
 PARROT_EXPORT
@@ -34,9 +32,7 @@
         __attribute__nonnull__(1);
 
 #define ASSERT_ARGS_parrot_i386_cmpxchg __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(ptr) \
-    || PARROT_ASSERT_ARG(expect) \
-    || PARROT_ASSERT_ARG(update)
+       PARROT_ASSERT_ARG(ptr)
 #define ASSERT_ARGS_parrot_i386_xadd __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(l)
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: trunk/src/atomic/gcc_x86.c
==============================================================================
--- trunk/src/atomic/gcc_x86.c	(original)
+++ trunk/src/atomic/gcc_x86.c	Sat Jan  3 01:27:13 2009
@@ -48,8 +48,8 @@
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 void *
-parrot_i386_cmpxchg(ARGMOD(void *volatile *ptr), ARGIN(void *expect),
-                                        ARGIN(void *update))
+parrot_i386_cmpxchg(ARGMOD(void *volatile *ptr), ARGIN_NULLOK(void *expect),
+                                        ARGIN_NULLOK(void *update))
 {
     ASSERT_ARGS(parrot_i386_cmpxchg);
 #if defined(PARROT_HAS_X86_64_GCC_CMPXCHG)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About