On Thu Jul 31 16:38:12 2008, [EMAIL PROTECTED] wrote:

> 
> I believe you can safely modify the file and add the line after:
> 
> #CONDITIONED_LINE(i386_has_gcc_cmpxchg):   
$(SRC_DIR)/atomic/gcc_x86$(O) \
> 
> (That's on line 372 for me).
> 

Thanks.  I tried that out.  I applied (in sandbox) the revised version
attached.  'make' completed.

But for my efforts I was rewarded with test failures in the most
relevant file -- a file that had previously been passing consistently. 
See second attachment.

myconfig also attached.  So the patch is not yet ready for prime time.

Thank you very much.

Attachment: myconfig
Description: Binary data

Index: include/parrot/atomic/gcc_pcc.h
===================================================================
--- include/parrot/atomic/gcc_pcc.h     (revision 29917)
+++ include/parrot/atomic/gcc_pcc.h     (working copy)
@@ -23,49 +23,11 @@
 
 #  define PARROT_ATOMIC_PTR_SET(a, b) (a).val = (void *) (b)
 
-inline static void *parrot_ppc_cmpset(void * volatile *ptr,
-                                      void *expect, void *update)
-{
-    void *tmp;
-    /* see http://www-128.ibm.com/developerworks/linux/library/pa-atom/ */
-    __asm__ __volatile__(/*%0 = tmp, %1 = ptr, %2 = old, %3 = new */
-                            "1:  lwarx %0, 0, %1\n"     /* tmp = *ptr, with 
reservation */
-                            "    cmpw %2, %0\n" /* tmp == old ? */
-                            "    bne 2f\n"      /* no, goto flush reservation, 
end */
-                            /* "    sync\n" -- XXX needed on PPC 405, see
-                             * http://www.kegel.com/xgcc3/ppc405erratum77.html 
*/
-                            "    stwcx. %3, 0, %1\n"    /* store new using 
reservation */
-                            "    bne- 1b\n"     /* spin on failure of 
reservation; - is branch prediction hint */
-                            "    b 3f\n" "2:  stwcx. %0, 0, %1\n"       /* 
flush reserveration */
-                            "3:  \n"    /* end label */
-                            :   /* output */
-                            "=&r"(tmp)
-                            :   /* input */
-                            "r"(ptr), "r"(expect), "r"(update)
-                            :   /* clobber */
-                            "memory");
-    return tmp;
-}
+PARROT_INLINE void
+*parrot_ppc_cmpset(void * volatile *ptr, void *expect, void *update);
 
-inline static long parrot_ppc_add(volatile long *val, long what)
-{
-    long tmp;
-    __asm__ __volatile__(/*%0 = tmp, %1 = val, %2 = what */
-                            "1:  lwarx %0, 0, %1\n"     /* tmp = *val, with 
reservation */
-                            "    add %0, %0, %2\n"      /* tmp += what */
-                            /* "    sync\n" -- XXX needed on PPC 405, see
-                             * http://www.kegel.com/xgcc3/ppc405erratum77.html 
*/
-                            "    stwcx. %0, 0, %1\n"    /* *val <- tmp using 
reservation */
-                            "    bne- 1b\n"     /* spin on failure of 
reservation; - is branch prediction hint */
-                            "2:  \n"    /* end label */
-                            :   /* output */
-                            "=&r"(tmp)
-                            :   /* input */
-                            "r"(val), "r"(what)
-                            :   /* clobber */
-                            "memory");
-    return tmp;
-}
+PARROT_INLINE long
+parrot_ppc_add(volatile long *val, long what);
 
 #  define PARROT_ATOMIC_PTR_CAS(result, a, expect, update) \
     do { \
Index: config/gen/makefiles/root.in
===================================================================
--- config/gen/makefiles/root.in        (revision 29917)
+++ config/gen/makefiles/root.in        (working copy)
@@ -370,6 +370,7 @@
     $(OPS_DIR)/core_ops_switch$(O) \
     \
 #CONDITIONED_LINE(i386_has_gcc_cmpxchg):    $(SRC_DIR)/atomic/gcc_x86$(O) \
+    $(SRC_DIR)/atomic/gcc_pcc$(O) \
     $(SRC_DIR)/builtin$(O) \
     $(SRC_DIR)/byteorder$(O) \
     $(SRC_DIR)/charset$(O) \
[gcc_pcc] 532 $ prove -v t/src/atomic.t 
t/src/atomic....
1..4
ok 1 - PARROT_ATOMIC_PTR_GET/SET
ok 2 - PARROT_ATOMIC_INT_GET/SET
not ok 3 - PARROT_ATOMIC_PTR_CAS

#   Failed test 'PARROT_ATOMIC_PTR_CAS'
#   at t/src/atomic.t line 120.
# Exited with error code: [SIGNAL 5]
# Received:
# dyld: lazy symbol binding failed: Symbol not found: _parrot_ppc_cmpset
#   Referenced from: /Users/jimk/work/gcc_pcc/./t/src/atomic_3
#   Expected in: dynamic lookup
# 
# dyld: Symbol not found: _parrot_ppc_cmpset
#   Referenced from: /Users/jimk/work/gcc_pcc/./t/src/atomic_3
#   Expected in: dynamic lookup
# 
# 
# Expected:
# ok 1
# ok 2
# ok 3
# ok 4
# 
not ok 4 - PARROT_ATOMIC_INT_(CAS|INC|DEC)

#   Failed test 'PARROT_ATOMIC_INT_(CAS|INC|DEC)'
#   at t/src/atomic.t line 180.
# Exited with error code: [SIGNAL 5]
# Received:
# dyld: lazy symbol binding failed: Symbol not found: _parrot_ppc_add
#   Referenced from: /Users/jimk/work/gcc_pcc/./t/src/atomic_4
#   Expected in: dynamic lookup
# 
# dyld: Symbol not found: _parrot_ppc_add
#   Referenced from: /Users/jimk/work/gcc_pcc/./t/src/atomic_4
#   Expected in: dynamic lookup
# 
# 
# Expected:
# ok 1
# 
# Looks like you failed 2 tests of 4.
 Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/4 subtests 

Test Summary Report
-------------------
t/src/atomic (Wstat: 512 Tests: 4 Failed: 2)
  Failed tests:  3-4
  Non-zero exit status: 2
Files=1, Tests=4, 40 wallclock secs ( 0.04 usr  0.02 sys +  2.90 cusr  1.76 
csys =  4.72 CPU)
Result: FAIL

Reply via email to