[Mono-bugs] [Bug 74639][Nor] Changed - instruction sync needed for atomic.h on ppc

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 18 Apr 2005 19:54:14 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74639

--- shadow/74639	2005-04-16 18:34:00.000000000 -0400
+++ shadow/74639.tmp.16242	2005-04-18 19:54:14.000000000 -0400
@@ -35,6 +35,33 @@
 ------- Additional Comments From mass@akuma.org  2005-04-16 18:34 -------
 Comments on patch from Wednesday
 * InterlockedIncrement, InterlockedDecrement: use one fewer register,
 avoid initialization and remove extra addition/subtraction at the end
 * InterlockedExchange: remove tmp initialization, rename tmp to result
 to be consistant with other methods
+
+------- Additional Comments From miguel@ximian.com  2005-04-18 19:54 -------
+While trying out this patch, I got:
+
+collection.c: In function `_wapi_handle_collect':
+../../mono/io-layer/atomic.h:425: error: invalid `asm': operand number
+out of range
+../../mono/io-layer/atomic.h:425: error: invalid `asm': operand number
+out of range
+
+This is in this asm statement:
+
+static inline gint32 InterlockedIncrement(volatile gint32 *val)
+{
+        gint32 result;
+
+        __asm__ __volatile__ ("\n1:\n\t"
+                              "lwarx  %0, 0, %2\n\t"
+                              "addi   %0, %0, 1\n\t"
+                              "stwcx. %0, 0, %2\n\t"
+                              "bne-   1b\n\t"
+                              "isync\n\t"
+                              : "=&r" (result): "r" (val): "cc",
+"memory");
+        return result;
+}
+