summaryrefslogtreecommitdiff
path: root/includes/RtsAPI.h
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 /includes/RtsAPI.h
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 'includes/RtsAPI.h')
-rw-r--r--includes/RtsAPI.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 0ba16714e9..853a3a5b30 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -60,9 +60,42 @@ typedef enum {
// reason for using a struct is extensibility: we can add more
// fields to this later without breaking existing client code.
typedef struct {
+
+ // Whether to interpret +RTS options on the command line
RtsOptsEnabledEnum rts_opts_enabled;
+
+ // additional RTS options
const char *rts_opts;
+
+ // True if GHC was not passed -no-hs-main
HsBool rts_hs_main;
+
+ // Called before processing command-line flags, so that default
+ // settings for RtsFlags can be provided.
+ void (* defaultsHook) (void);
+
+ // Called just before exiting
+ void (* onExitHook) (void);
+
+ // Called on a stack overflow, before exiting
+ void (* stackOverflowHook) (W_ stack_size);
+
+ // Called on heap overflow, before exiting
+ void (* outOfHeapHook) (W_ request_size, W_ heap_size);
+
+ // Called when malloc() fails, before exiting
+ void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg);
+
+ // Called for every GC
+ void (* gcDoneHook) (unsigned int gen,
+ W_ allocated_bytes, /* since last GC */
+ W_ live_bytes,
+ W_ copied_bytes,
+ W_ max_copied_per_thread_bytes,
+ W_ total_bytes,
+ W_ slop_bytes,
+ W_ sync_elapsed_ns, W_ elapsed_ns, W_ cpu_ns);
+
} RtsConfig;
// Clients should start with defaultRtsConfig and then customise it.