Fix unregisterised build wip/gc/nonmoving-concurrent
authorBen Gamari <ben@smart-cactus.org>
Mon, 21 Oct 2019 23:21:01 +0000 (23:21 +0000)
committerBen Gamari <ben@smart-cactus.org>
Tue, 22 Oct 2019 16:13:36 +0000 (12:13 -0400)
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.

includes/Stg.h
includes/rts/NonMoving.h
includes/rts/storage/Closures.h
includes/stg/MiscClosures.h
includes/stg/Types.h
rts/sm/NonMovingMark.c
rts/sm/NonMovingMark.h

index 8f0abdb..46f71c0 100644 (file)
@@ -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
index f64769e..314c582 100644 (file)
 
 #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
index 6088fc8..b2b5eda 100644 (file)
@@ -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;
index f4ae224..7a2ac2e 100644 (file)
@@ -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
index f270686..7558d1f 100644 (file)
@@ -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_;
index 9d046ce..72a3ca6 100644 (file)
@@ -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);
 }
index 54baa93..84b6642 100644 (file)
@@ -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);