From b19bcfd953fdb10059753c1270ac1e4631da0f53 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 29 Jun 2006 12:05:26 +0000 Subject: [PATCH] use the new "prim %write_barrier()" in .cmm instead of calls to wb() --- includes/SMP.h | 6 +++--- rts/RaiseAsync.c | 4 ++-- rts/Updates.h | 46 +++++++++++++++++++++++----------------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/includes/SMP.h b/includes/SMP.h index d985576..68f1690 100644 --- a/includes/SMP.h +++ b/includes/SMP.h @@ -96,7 +96,7 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) * that require it (not x86 or x86_64). */ INLINE_HEADER void -wb(void) { +write_barrier(void) { #if i386_HOST_ARCH || x86_64_HOST_ARCH __asm__ __volatile__ ("" : : : "memory"); #elif powerpc_HOST_ARCH @@ -136,7 +136,7 @@ unlockClosure(StgClosure *p, StgInfoTable *info) { #if i386_HOST_ARCH || x86_64_HOST_ARCH || powerpc_HOST_ARCH // This is a strictly ordered write, so we need a wb(): - wb(); + write_barrier(); p->header.info = info; #else RELEASE_SM_LOCK; @@ -145,7 +145,7 @@ unlockClosure(StgClosure *p, StgInfoTable *info) #else /* !THREADED_RTS */ -#define wb() /* nothing */ +#define write_barrier() /* nothing */ INLINE_HEADER StgWord xchg(StgPtr p, StgWord w) diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c index b0c7064..f9ec318 100644 --- a/rts/RaiseAsync.c +++ b/rts/RaiseAsync.c @@ -240,7 +240,7 @@ check_target: { Capability *target_cap; - wb(); + write_barrier(); target_cap = target->cap; if (target_cap == cap && (target->flags & TSO_BLOCKEX) == 0) { // It's on our run queue and not blocking exceptions @@ -464,7 +464,7 @@ blockedThrowTo (StgTSO *source, StgTSO *target) dirtyTSO(target); // we modified the blocked_exceptions queue source->block_info.tso = target; - wb(); // throwTo_exception *must* be visible if BlockedOnException is. + write_barrier(); // throwTo_exception *must* be visible if BlockedOnException is. source->why_blocked = BlockedOnException; } diff --git a/rts/Updates.h b/rts/Updates.h index f20b088..c8c75b1 100644 --- a/rts/Updates.h +++ b/rts/Updates.h @@ -277,7 +277,7 @@ FILL_SLOP(StgClosure *p) DEBUG_FILL_SLOP(p1); \ LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ StgInd_indirectee(p1) = p2; \ - foreign "C" wb() []; \ + prim %write_barrier() []; \ bd = Bdescr(p1); \ if (bdescr_gen_no(bd) != 0 :: CInt) { \ foreign "C" recordMutableCap(p1 "ptr", \ @@ -294,28 +294,28 @@ FILL_SLOP(StgClosure *p) and_then; \ } #else -#define updateWithIndirection(ind_info, p1, p2, and_then) \ - { \ - bdescr *bd; \ - \ - /* cas(p1, 0, &stg_WHITEHOLE_info); */ \ - ASSERT( (P_)p1 != (P_)p2 && !closure_IND(p1) ); \ - DEBUG_FILL_SLOP(p1); \ - LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ - ((StgInd *)p1)->indirectee = p2; \ - wb(); \ - bd = Bdescr((P_)p1); \ - if (bd->gen_no != 0) { \ - recordMutableGenLock(p1, &generations[bd->gen_no]); \ - SET_INFO(p1, &stg_IND_OLDGEN_info); \ - TICK_UPD_OLD_IND(); \ - and_then; \ - } else { \ - SET_INFO(p1, ind_info); \ - LDV_RECORD_CREATE(p1); \ - TICK_UPD_NEW_IND(); \ - and_then; \ - } \ +#define updateWithIndirection(ind_info, p1, p2, and_then) \ + { \ + bdescr *bd; \ + \ + /* cas(p1, 0, &stg_WHITEHOLE_info); */ \ + ASSERT( (P_)p1 != (P_)p2 && !closure_IND(p1) ); \ + DEBUG_FILL_SLOP(p1); \ + LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ + ((StgInd *)p1)->indirectee = p2; \ + write_barrier(); \ + bd = Bdescr((P_)p1); \ + if (bd->gen_no != 0) { \ + recordMutableGenLock(p1, &generations[bd->gen_no]); \ + SET_INFO(p1, &stg_IND_OLDGEN_info); \ + TICK_UPD_OLD_IND(); \ + and_then; \ + } else { \ + SET_INFO(p1, ind_info); \ + LDV_RECORD_CREATE(p1); \ + TICK_UPD_NEW_IND(); \ + and_then; \ + } \ } #endif -- 1.7.10.4