X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FEvac.c-inc;fp=rts%2Fsm%2FEvac.c-inc;h=e6514180d5d9ea9cc8b696b3721bc04b19a9c680;hb=4c394999264d602f10e7623cefa7588423c4f68b;hp=752fe92f843fd0d6c3b37bb10382bc2676bb56ce;hpb=938142abe2999ef941ce4998b830fbd7e770fb4e;p=ghc-hetmet.git diff --git a/rts/sm/Evac.c-inc b/rts/sm/Evac.c-inc index 752fe92..e651418 100644 --- a/rts/sm/Evac.c-inc +++ b/rts/sm/Evac.c-inc @@ -217,26 +217,39 @@ loop: switch (info->type) { case THUNK_STATIC: - if (info->srt_bitmap != 0 && - *THUNK_STATIC_LINK((StgClosure *)q) == NULL) { - ACQUIRE_SPIN_LOCK(&static_objects_sync); + if (info->srt_bitmap != 0) { if (*THUNK_STATIC_LINK((StgClosure *)q) == NULL) { - *THUNK_STATIC_LINK((StgClosure *)q) = static_objects; - static_objects = (StgClosure *)q; +#ifndef THREADED_RTS + *THUNK_STATIC_LINK((StgClosure *)q) = gct->static_objects; + gct->static_objects = (StgClosure *)q; +#else + StgPtr link; + link = (StgPtr)cas((StgPtr)THUNK_STATIC_LINK((StgClosure *)q), + (StgWord)NULL, + (StgWord)gct->static_objects); + if (link == NULL) { + gct->static_objects = (StgClosure *)q; + } +#endif } - RELEASE_SPIN_LOCK(&static_objects_sync); } return; - + case FUN_STATIC: if (info->srt_bitmap != 0 && *FUN_STATIC_LINK((StgClosure *)q) == NULL) { - ACQUIRE_SPIN_LOCK(&static_objects_sync); - if (*FUN_STATIC_LINK((StgClosure *)q) == NULL) { - *FUN_STATIC_LINK((StgClosure *)q) = static_objects; - static_objects = (StgClosure *)q; - } - RELEASE_SPIN_LOCK(&static_objects_sync); +#ifndef THREADED_RTS + *FUN_STATIC_LINK((StgClosure *)q) = gct->static_objects; + gct->static_objects = (StgClosure *)q; +#else + StgPtr link; + link = (StgPtr)cas((StgPtr)FUN_STATIC_LINK((StgClosure *)q), + (StgWord)NULL, + (StgWord)gct->static_objects); + if (link == NULL) { + gct->static_objects = (StgClosure *)q; + } +#endif } return; @@ -246,27 +259,40 @@ loop: * scavenge it later). */ if (((StgIndStatic *)q)->saved_info == NULL) { - ACQUIRE_SPIN_LOCK(&static_objects_sync); if (*IND_STATIC_LINK((StgClosure *)q) == NULL) { - *IND_STATIC_LINK((StgClosure *)q) = static_objects; - static_objects = (StgClosure *)q; +#ifndef THREADED_RTS + *IND_STATIC_LINK((StgClosure *)q) = gct->static_objects; + gct->static_objects = (StgClosure *)q; +#else + StgPtr link; + link = (StgPtr)cas((StgPtr)IND_STATIC_LINK((StgClosure *)q), + (StgWord)NULL, + (StgWord)gct->static_objects); + if (link == NULL) { + gct->static_objects = (StgClosure *)q; + } +#endif } - RELEASE_SPIN_LOCK(&static_objects_sync); } return; case CONSTR_STATIC: if (*STATIC_LINK(info,(StgClosure *)q) == NULL) { - ACQUIRE_SPIN_LOCK(&static_objects_sync); - // re-test, after acquiring lock - if (*STATIC_LINK(info,(StgClosure *)q) == NULL) { - *STATIC_LINK(info,(StgClosure *)q) = static_objects; - static_objects = (StgClosure *)q; - } - RELEASE_SPIN_LOCK(&static_objects_sync); - /* I am assuming that static_objects pointers are not - * written to other objects, and thus, no need to retag. */ - } +#ifndef THREADED_RTS + *STATIC_LINK(info,(StgClosure *)q) = gct->static_objects; + gct->static_objects = (StgClosure *)q; +#else + StgPtr link; + link = (StgPtr)cas((StgPtr)STATIC_LINK(info,(StgClosure *)q), + (StgWord)NULL, + (StgWord)gct->static_objects); + if (link == NULL) { + gct->static_objects = (StgClosure *)q; + } +#endif + } + /* I am assuming that static_objects pointers are not + * written to other objects, and thus, no need to retag. */ return; case CONSTR_NOCAF_STATIC: