From 3cd78358444a437cda53fc8a2f5bc9209441c4f8 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 13 Sep 2016 15:33:31 +0100 Subject: [PATCH] Catch-up merge from custom/cet/branch/2016-09-13/job004006 to branch/2016-09-06/job004006. Copied from Perforce Change: 192351 ServerID: perforce.ravenbrook.com --- mps/code/global.c | 6 +++--- mps/code/mpm.h | 1 - mps/code/traceanc.c | 12 ++++-------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/mps/code/global.c b/mps/code/global.c index b6b57ea5f50..69768a6e5d5 100644 --- a/mps/code/global.c +++ b/mps/code/global.c @@ -73,14 +73,14 @@ static void arenaAnnounce(Arena arena) } -/* ArenaDenounce -- remove an arena from the global ring of arenas +/* arenaDenounce -- remove an arena from the global ring of arenas * * After this, no other thread can access the arena through ArenaAccess. * On entry, the arena should be locked. On exit, it will still be, but * the lock has been released and reacquired in the meantime, so callers * should not assume anything about the state of the arena. */ -void ArenaDenounce(Arena arena) +static void arenaDenounce(Arena arena) { Globals arenaGlobals; @@ -403,7 +403,7 @@ void GlobalsPrepareToDestroy(Globals arenaGlobals) arena = GlobalsArena(arenaGlobals); - ArenaDenounce(arena); + arenaDenounce(arena); defaultChain = arenaGlobals->defaultChain; arenaGlobals->defaultChain = NULL; diff --git a/mps/code/mpm.h b/mps/code/mpm.h index cefa9f3e656..e2b99e1fead 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -487,7 +487,6 @@ extern Res ArenaDescribeTracts(Arena arena, mps_lib_FILE *stream, Count depth); extern Bool ArenaAccess(Addr addr, AccessSet mode, MutatorFaultContext context); extern Res ArenaFreeLandInsert(Arena arena, Addr base, Addr limit); extern void ArenaFreeLandDelete(Arena arena, Addr base, Addr limit); -extern void ArenaDenounce(Arena arena); extern Bool GlobalsCheck(Globals arena); extern Res GlobalsInit(Globals arena); diff --git a/mps/code/traceanc.c b/mps/code/traceanc.c index 77054c52d71..a446aa41b67 100644 --- a/mps/code/traceanc.c +++ b/mps/code/traceanc.c @@ -637,21 +637,17 @@ void ArenaPostmortem(Globals globals) LockReleaseRecursive(globals->lock); } - /* Acquire the lock again so that we can call ArenaDenounce. */ - ArenaEnter(arena); - /* Remove the arena from the global arena ring so that it no longer - * handles protection faults. */ - ArenaDenounce(arena); + * handles protection faults. (Don't call arenaDenounce because that + * needs to claim the global ring lock, but that might already be + * held, for example if we are inside ArenaAccess.) */ + RingRemove(&globals->globalRing); /* Clamp the arena so that ArenaPoll does nothing. */ ArenaClamp(globals); /* Remove all protection from mapped pages. */ arenaExpose(arena); - - /* Release the lock finally. */ - ArenaLeave(arena); }