summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-10-21 23:21:01 +0000
committerBen Gamari <ben@smart-cactus.org>2019-10-22 12:13:36 -0400
commit06d51c4ef776ee1bf66e3603b4c6e4e2acf8ba3c (patch)
treedec20251f027a9aba915f706c077c20c6fe5b062
parent17e5a032a66bc043b453727706d4fa95a7951202 (diff)
downloadhaskell-wip/gc/nonmoving-concurrent.tar.gz
Fix unregisterised buildwip/gc/nonmoving-concurrent
This required some fiddling around with the location of forward declarations since the C sources generated by GHC's C backend only includes Stg.h.
-rw-r--r--includes/Stg.h17
-rw-r--r--includes/rts/NonMoving.h27
-rw-r--r--includes/rts/storage/Closures.h2
-rw-r--r--includes/stg/MiscClosures.h8
-rw-r--r--includes/stg/Types.h7
-rw-r--r--rts/sm/NonMovingMark.c2
-rw-r--r--rts/sm/NonMovingMark.h1
7 files changed, 41 insertions, 23 deletions
diff --git a/includes/Stg.h b/includes/Stg.h
index 8f0abdbf6d..46f71c0241 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -598,20 +598,3 @@ typedef union {
})
#endif
-/* -----------------------------------------------------------------------------
- Nonmoving GC write barrier
- -------------------------------------------------------------------------- */
-
-// Note that RTS code should not condition on this directly by rather
-// use the IF_NONMOVING_WRITE_BARRIER_ENABLED macro to ensure that
-// the barrier is eliminated in the non-threaded RTS.
-extern StgWord DLL_IMPORT_DATA_VAR(nonmoving_write_barrier_enabled);
-
-// A similar macro is defined in includes/Cmm.h for C-- code.
-#if defined(THREADED_RTS)
-#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
- if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
-#else
-#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
- if (0)
-#endif
diff --git a/includes/rts/NonMoving.h b/includes/rts/NonMoving.h
index f64769e8a9..314c582a1e 100644
--- a/includes/rts/NonMoving.h
+++ b/includes/rts/NonMoving.h
@@ -13,10 +13,31 @@
#pragma once
+// Forward declaration for Stg.h
+struct StgClosure_;
+struct StgThunk_;
+struct Capability_;
+
/* This is called by the code generator */
extern DLL_IMPORT_RTS
-void updateRemembSetPushClosure_(StgRegTable *reg, StgClosure *p);
+void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p);
+
+extern DLL_IMPORT_RTS
+void updateRemembSetPushThunk_(StgRegTable *reg, struct StgThunk_ *p);
+
+// Forward declaration for unregisterised backend.
+EF_(stg_copyArray_barrier);
-void updateRemembSetPushClosure(Capability *cap, StgClosure *p);
+// Note that RTS code should not condition on this directly by rather
+// use the IF_NONMOVING_WRITE_BARRIER_ENABLED macro to ensure that
+// the barrier is eliminated in the non-threaded RTS.
+extern StgWord DLL_IMPORT_DATA_VAR(nonmoving_write_barrier_enabled);
-void updateRemembSetPushThunk_(StgRegTable *reg, StgThunk *p);
+// A similar macro is defined in includes/Cmm.h for C-- code.
+#if defined(THREADED_RTS)
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
+ if (RTS_UNLIKELY(nonmoving_write_barrier_enabled))
+#else
+#define IF_NONMOVING_WRITE_BARRIER_ENABLED \
+ if (0)
+#endif
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index 6088fc8a10..b2b5eda407 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -94,7 +94,7 @@ typedef struct StgClosure_ {
struct StgClosure_ *payload[];
} *StgClosurePtr; // StgClosure defined in rts/Types.h
-typedef struct {
+typedef struct StgThunk_ {
StgThunkHeader header;
struct StgClosure_ *payload[];
} StgThunk;
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index f4ae2245d2..7a2ac2ef51 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -542,6 +542,12 @@ void * pushCostCentre (void *ccs, void *cc);
// Capability.c
extern unsigned int n_capabilities;
-extern void updateRemembSetPushThunk_(void *reg, void *p1);
+
+/* -----------------------------------------------------------------------------
+ Nonmoving GC write barrier
+ -------------------------------------------------------------------------- */
+
+#include <rts/NonMoving.h>
+
#endif
diff --git a/includes/stg/Types.h b/includes/stg/Types.h
index f270686ebc..7558d1f420 100644
--- a/includes/stg/Types.h
+++ b/includes/stg/Types.h
@@ -185,3 +185,10 @@ typedef StgWord8* StgByteArray;
typedef void *(*(*StgFunPtr)(void))(void);
typedef StgFunPtr StgFun(void);
+
+// Forward declarations for the unregisterised backend, which
+// only depends upon Stg.h and not the entirety of Rts.h, which
+// is where these are defined.
+struct StgClosure_;
+struct StgThunk_;
+struct Capability_;
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index 9d046ce068..72a3ca69cb 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -536,7 +536,7 @@ inline void updateRemembSetPushClosure(Capability *cap, StgClosure *p)
push_closure(queue, p, NULL);
}
-void updateRemembSetPushClosure_(StgRegTable *reg, StgClosure *p)
+void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p)
{
updateRemembSetPushClosure(regTableToCapability(reg), p);
}
diff --git a/rts/sm/NonMovingMark.h b/rts/sm/NonMovingMark.h
index 54baa936db..84b6642d6c 100644
--- a/rts/sm/NonMovingMark.h
+++ b/rts/sm/NonMovingMark.h
@@ -120,6 +120,7 @@ void nonmovingMarkInitUpdRemSet(void);
void init_upd_rem_set(UpdRemSet *rset);
void reset_upd_rem_set(UpdRemSet *rset);
+void updateRemembSetPushClosure(Capability *cap, StgClosure *p);
void updateRemembSetPushThunk(Capability *cap, StgThunk *p);
void updateRemembSetPushTSO(Capability *cap, StgTSO *tso);
void updateRemembSetPushStack(Capability *cap, StgStack *stack);