summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-06-09 09:18:12 +0100
committerSimon Marlow <marlowsd@gmail.com>2015-04-07 09:57:49 +0100
commita7ab161602aa0b5833d22c66e64eebb1d9275235 (patch)
tree22db09216cbd2165359d8add08b5cf4cdbf5041f /rts/RtsUtils.c
parent72092904e0ac1725c05c0447e1efe7ab541faa95 (diff)
downloadhaskell-a7ab161602aa0b5833d22c66e64eebb1d9275235.tar.gz
Replace hooks by callbacks in RtsConfig (#8785)
Summary: Hooks rely on static linking semantics, and are broken by -Bsymbolic which we need when using dynamic linking. Test Plan: Built it Reviewers: austin, hvr, tibbe Differential Revision: https://phabricator.haskell.org/D8
Diffstat (limited to 'rts/RtsUtils.c')
-rw-r--r--rts/RtsUtils.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index fff87178a1..ddf5a1fef2 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -13,6 +13,7 @@
#include "RtsUtils.h"
#include "Ticky.h"
#include "Schedule.h"
+#include "RtsFlags.h"
#ifdef HAVE_TIME_H
#include <time.h>
@@ -64,7 +65,7 @@ stgMallocBytes (int n, char *msg)
n2 = (size_t) n;
if ((space = (char *) malloc(n2)) == NULL) {
/* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- MallocFailHook((W_) n, msg); /*msg*/
+ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/
stg_exit(EXIT_INTERNAL_ERROR);
}
return space;
@@ -79,7 +80,7 @@ stgReallocBytes (void *p, int n, char *msg)
n2 = (size_t) n;
if ((space = (char *) realloc(p, (size_t) n2)) == NULL) {
/* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- MallocFailHook((W_) n, msg); /*msg*/
+ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/
stg_exit(EXIT_INTERNAL_ERROR);
}
return space;
@@ -92,7 +93,7 @@ stgCallocBytes (int n, int m, char *msg)
if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) {
/* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- MallocFailHook((W_) n*m, msg); /*msg*/
+ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/
stg_exit(EXIT_INTERNAL_ERROR);
}
return space;
@@ -116,7 +117,7 @@ stgFree(void* p)
void
stackOverflow(StgTSO* tso)
{
- StackOverflowHook(tso->tot_stack_size * sizeof(W_));
+ rtsConfig.stackOverflowHook(tso->tot_stack_size * sizeof(W_));
#if defined(TICKY_TICKY)
if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
@@ -129,8 +130,8 @@ heapOverflow(void)
if (!heap_overflow)
{
/* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- OutOfHeapHook(0/*unknown request size*/,
- (W_)RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
+ rtsConfig.outOfHeapHook(0/*unknown request size*/,
+ (W_)RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
heap_overflow = rtsTrue;
}