summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2018-08-29 16:34:21 -0400
committerDavid Feuer <David.Feuer@gmail.com>2018-08-29 16:34:22 -0400
commitf48e276a5ba68d8b6fcb4a558022581fb30f9326 (patch)
tree8ea324b84d137d59cda566d6a559016d2c7437ea /rts/Schedule.c
parent65eec9cfd4410c0e30b0ed06116c15f8ce3de49d (diff)
downloadhaskell-f48e276a5ba68d8b6fcb4a558022581fb30f9326.tar.gz
Finish stable split
Long ago, the stable name table and stable pointer tables were one. Now, they are separate, and have significantly different implementations. I believe the time has come to finish the split that began in #7674. * Divide `rts/Stable` into `rts/StableName` and `rts/StablePtr`. * Give each table its own mutex. * Add FFI functions `hs_lock_stable_ptr_table` and `hs_unlock_stable_ptr_table` and document them. These are intended to replace the previously undocumented `hs_lock_stable_tables` and `hs_lock_stable_tables`, which are now documented as deprecated synonyms. * Make `eqStableName#` use pointer equality instead of unnecessarily comparing stable name table indices. Reviewers: simonmar, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15555 Differential Revision: https://phabricator.haskell.org/D5084
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index cf975b51dd..0444f0ca15 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -41,7 +41,8 @@
#include "Timer.h"
#include "ThreadPaused.h"
#include "Messages.h"
-#include "Stable.h"
+#include "StablePtr.h"
+#include "StableName.h"
#include "TopHandler.h"
#if defined(HAVE_SYS_TYPES_H)
@@ -1964,7 +1965,8 @@ forkProcess(HsStablePtr *entry
// inconsistent state in the child. See also #1391.
ACQUIRE_LOCK(&sched_mutex);
ACQUIRE_LOCK(&sm_mutex);
- ACQUIRE_LOCK(&stable_mutex);
+ ACQUIRE_LOCK(&stable_ptr_mutex);
+ ACQUIRE_LOCK(&stable_name_mutex);
ACQUIRE_LOCK(&task->lock);
for (i=0; i < n_capabilities; i++) {
@@ -1989,7 +1991,8 @@ forkProcess(HsStablePtr *entry
RELEASE_LOCK(&sched_mutex);
RELEASE_LOCK(&sm_mutex);
- RELEASE_LOCK(&stable_mutex);
+ RELEASE_LOCK(&stable_ptr_mutex);
+ RELEASE_LOCK(&stable_name_mutex);
RELEASE_LOCK(&task->lock);
#if defined(THREADED_RTS)
@@ -2012,7 +2015,8 @@ forkProcess(HsStablePtr *entry
#if defined(THREADED_RTS)
initMutex(&sched_mutex);
initMutex(&sm_mutex);
- initMutex(&stable_mutex);
+ initMutex(&stable_ptr_mutex);
+ initMutex(&stable_name_mutex);
initMutex(&task->lock);
for (i=0; i < n_capabilities; i++) {