summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-04-18 07:03:05 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-29 13:12:47 -0400
commit296ed7395c9a45352cf2e03ef9ff0b3b1f5a1a80 (patch)
tree3e8e88cb824add473bca6c9f56bcccd5c305eddf
parentde2629304aa2df1783f099e1da2cd04ce0423790 (diff)
downloadhaskell-296ed7395c9a45352cf2e03ef9ff0b3b1f5a1a80.tar.gz
rts: Allow building with ASSERTs on in non-DEBUG way
We have a couple of places where the conditions in asserts depend on code ifdefed out when DEBUG is off. I'd like to allow compiling assertions into non-DEBUG RTSen so that won't do. Currently if we remove the conditional around the definition of ASSERT() the build will not actually work due to a deadlock caused by initMutex not initializing mutexes with PTHREAD_MUTEX_ERRORCHECK because DEBUG is off.
-rw-r--r--rts/Interpreter.c5
-rw-r--r--rts/Schedule.c2
-rw-r--r--rts/Task.c3
3 files changed, 2 insertions, 8 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index 8c90678bb7..a5705f8fb2 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -1013,10 +1013,7 @@ run_BCO:
register StgWord16* instrs = (StgWord16*)(bco->instrs->payload);
register StgWord* literals = (StgWord*)(&bco->literals->payload[0]);
register StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]);
-#if defined(DEBUG)
- int bcoSize;
- bcoSize = bco->instrs->bytes / sizeof(StgWord16);
-#endif
+ int bcoSize = bco->instrs->bytes / sizeof(StgWord16);
IF_DEBUG(interpreter,debugBelch("bcoSize = %d\n", bcoSize));
#if defined(INTERP_STATS)
diff --git a/rts/Schedule.c b/rts/Schedule.c
index c5a5041587..85d66ab030 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1736,9 +1736,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
stat_startGCSync(gc_threads[cap->no]);
-#if defined(DEBUG)
unsigned int old_n_capabilities = n_capabilities;
-#endif
interruptAllCapabilities();
diff --git a/rts/Task.c b/rts/Task.c
index 2bd32359cc..28a1f2c314 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -388,8 +388,7 @@ discardTasksExcept (Task *keep)
void
workerTaskStop (Task *task)
{
- DEBUG_ONLY( OSThreadId id );
- DEBUG_ONLY( id = osThreadId() );
+ OSThreadId id = osThreadId();
ASSERT(task->id == id);
ASSERT(myTask() == task);