[commit: ghc] wip/gc/nonmoving-nonconcurrent: rts/StableName: Expose FOR_EACH_STABLE_NAME, freeSnEntry, SNT_size (2082c24)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:12:45 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/gc/nonmoving-nonconcurrent
Link       : http://ghc.haskell.org/trac/ghc/changeset/2082c24217e15e985a8f31ba80d8d5291835348f/ghc

>---------------------------------------------------------------

commit 2082c24217e15e985a8f31ba80d8d5291835348f
Author: Ömer Sinan Ağacan <omer at well-typed.com>
Date:   Tue Feb 5 00:40:27 2019 -0500

    rts/StableName: Expose FOR_EACH_STABLE_NAME, freeSnEntry, SNT_size
    
    These will be needed when we implement sweeping in the nonmoving
    collector.


>---------------------------------------------------------------

2082c24217e15e985a8f31ba80d8d5291835348f
 rts/StableName.c | 25 ++-----------------------
 rts/StableName.h | 26 +++++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/rts/StableName.c b/rts/StableName.c
index 757eb59..383d87e 100644
--- a/rts/StableName.c
+++ b/rts/StableName.c
@@ -21,7 +21,7 @@
 
 snEntry *stable_name_table = NULL;
 static snEntry *stable_name_free = NULL;
-static unsigned int SNT_size = 0;
+unsigned int SNT_size = 0;
 #define INIT_SNT_SIZE 64
 
 #if defined(THREADED_RTS)
@@ -128,7 +128,7 @@ exitStableNameTable(void)
 #endif
 }
 
-STATIC_INLINE void
+void
 freeSnEntry(snEntry *sn)
 {
   ASSERT(sn->sn_obj == NULL);
@@ -218,27 +218,6 @@ lookupStableName (StgPtr p)
  * Remember old stable name addresses
  * -------------------------------------------------------------------------- */
 
-#define FOR_EACH_STABLE_NAME(p, CODE)                                   \
-    do {                                                                \
-        snEntry *p;                                                     \
-        snEntry *__end_ptr = &stable_name_table[SNT_size];              \
-        for (p = stable_name_table + 1; p < __end_ptr; p++) {           \
-            /* Internal pointers are free slots.  */                    \
-            /* If p->addr == NULL, it's a */                            \
-            /* stable name where the object has been GC'd, but the */   \
-            /* StableName object (sn_obj) is still alive. */            \
-            if ((p->addr < (P_)stable_name_table ||                     \
-                 p->addr >= (P_)__end_ptr))                             \
-            {                                                           \
-                /* NOTE: There is an ambiguity here if p->addr == NULL */ \
-                /* it is either the last item in the free list or it */ \
-                /* is a stable name whose pointee died. sn_obj == NULL */ \
-                /* disambiguates as last free list item. */             \
-                do { CODE } while(0);                                   \
-            }                                                           \
-        }                                                               \
-    } while(0)
-
 void
 rememberOldStableNameAddresses(void)
 {
diff --git a/rts/StableName.h b/rts/StableName.h
index 6b5e551..e5903bb 100644
--- a/rts/StableName.h
+++ b/rts/StableName.h
@@ -11,7 +11,8 @@
 #include "BeginPrivate.h"
 
 void    initStableNameTable   ( void );
-void    exitStableNameTable      ( void );
+void    freeSnEntry           ( snEntry *sn );
+void    exitStableNameTable   ( void );
 StgWord lookupStableName      ( StgPtr p );
 
 void    rememberOldStableNameAddresses ( void );
@@ -23,6 +24,29 @@ void    updateStableNameTable ( bool full );
 void    stableNameLock            ( void );
 void    stableNameUnlock          ( void );
 
+extern unsigned int SNT_size;
+
+#define FOR_EACH_STABLE_NAME(p, CODE)                                   \
+    do {                                                                \
+        snEntry *p;                                                     \
+        snEntry *__end_ptr = &stable_name_table[SNT_size];              \
+        for (p = stable_name_table + 1; p < __end_ptr; p++) {           \
+            /* Internal pointers are free slots.  */                    \
+            /* If p->addr == NULL, it's a */                            \
+            /* stable name where the object has been GC'd, but the */   \
+            /* StableName object (sn_obj) is still alive. */            \
+            if ((p->addr < (P_)stable_name_table ||                     \
+                 p->addr >= (P_)__end_ptr))                             \
+            {                                                           \
+                /* NOTE: There is an ambiguity here if p->addr == NULL */ \
+                /* it is either the last item in the free list or it */ \
+                /* is a stable name whose pointee died. sn_obj == NULL */ \
+                /* disambiguates as last free list item. */             \
+                do { CODE } while(0);                                   \
+            }                                                           \
+        }                                                               \
+    } while(0)
+
 #if defined(THREADED_RTS)
 // needed by Schedule.c:forkProcess()
 extern Mutex stable_name_mutex;



More information about the ghc-commits mailing list