[commit: ghc] master: RTS: Remove unused retainer schemes (cb89ba8)

git at git.haskell.org git at git.haskell.org
Sun Feb 25 21:57:50 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cb89ba88d42ab77f9e20d722ec1ab40ec6f8e703/ghc

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

commit cb89ba88d42ab77f9e20d722ec1ab40ec6f8e703
Author: Simon Jakobi <simon.jakobi at gmail.com>
Date:   Tue Feb 20 13:18:52 2018 -0500

    RTS: Remove unused retainer schemes
    
    Reviewers: bgamari, erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #11777
    
    Differential Revision: https://phabricator.haskell.org/D4427


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

cb89ba88d42ab77f9e20d722ec1ab40ec6f8e703
 rts/RetainerProfile.c |   9 ----
 rts/RetainerSet.c     | 141 --------------------------------------------------
 rts/RetainerSet.h     |  23 +-------
 3 files changed, 1 insertion(+), 172 deletions(-)

diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index 4badbfe..cad3bb4 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -1143,16 +1143,7 @@ getRetainerFrom( StgClosure *c )
 {
     ASSERT(isRetainer(c));
 
-#if defined(RETAINER_SCHEME_INFO)
-    // Retainer scheme 1: retainer = info table
-    return get_itbl(c);
-#elif defined(RETAINER_SCHEME_CCS)
-    // Retainer scheme 2: retainer = cost centre stack
     return c->header.prof.ccs;
-#elif defined(RETAINER_SCHEME_CC)
-    // Retainer scheme 3: retainer = cost centre
-    return c->header.prof.ccs->cc;
-#endif
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/rts/RetainerSet.c b/rts/RetainerSet.c
index 5808097..59103dd 100644
--- a/rts/RetainerSet.c
+++ b/rts/RetainerSet.c
@@ -218,82 +218,17 @@ addElement(retainer r, RetainerSet *rs)
  *  printRetainer() prints the full information on a given retainer,
  *  not a retainer set.
  * -------------------------------------------------------------------------- */
-#if defined(RETAINER_SCHEME_INFO)
-// Retainer scheme 1: retainer = info table
-static void
-printRetainer(FILE *f, retainer itbl)
-{
-    fprintf(f, "%s[%s]", GET_PROF_DESC(itbl), itbl->prof.closure_type);
-}
-#elif defined(RETAINER_SCHEME_CCS)
-// Retainer scheme 2: retainer = cost centre stack
 static void
 printRetainer(FILE *f, retainer ccs)
 {
     fprintCCS(f, ccs);
 }
-#elif defined(RETAINER_SCHEME_CC)
-// Retainer scheme 3: retainer = cost centre
-static void
-printRetainer(FILE *f, retainer cc)
-{
-    fprintf(f,"%s.%s", cc->module, cc->label);
-}
-#endif
 
 /* -----------------------------------------------------------------------------
  *  printRetainerSetShort() should always display the same output for
  *  a given retainer set regardless of the time of invocation.
  * -------------------------------------------------------------------------- */
 #if defined(SECOND_APPROACH)
-#if defined(RETAINER_SCHEME_INFO)
-// Retainer scheme 1: retainer = info table
-void
-printRetainerSetShort(FILE *f, RetainerSet *rs, uint32_t max_length)
-{
-    char tmp[max_length + 1];
-    int size;
-    uint32_t j;
-
-    ASSERT(rs->id < 0);
-
-    tmp[max_length] = '\0';
-
-    // No blank characters are allowed.
-    sprintf(tmp + 0, "(%d)", -(rs->id));
-    size = strlen(tmp);
-    ASSERT(size < max_length);
-
-    for (j = 0; j < rs->num; j++) {
-        if (j < rs->num - 1) {
-            strncpy(tmp + size, GET_PROF_DESC(rs->element[j]), max_length - size);
-            size = strlen(tmp);
-            if (size == max_length)
-                break;
-            strncpy(tmp + size, ",", max_length - size);
-            size = strlen(tmp);
-            if (size == max_length)
-                break;
-        }
-        else {
-            strncpy(tmp + size, GET_PROF_DESC(rs->element[j]), max_length - size);
-            // size = strlen(tmp);
-        }
-    }
-    fprintf(f, tmp);
-}
-#elif defined(RETAINER_SCHEME_CC)
-// Retainer scheme 3: retainer = cost centre
-void
-printRetainerSetShort(FILE *f, RetainerSet *rs, uint32_t max_length)
-{
-    char tmp[max_length + 1];
-    int size;
-    uint32_t j;
-
-}
-#elif defined(RETAINER_SCHEME_CCS)
-// Retainer scheme 2: retainer = cost centre stack
 void
 printRetainerSetShort(FILE *f, RetainerSet *rs, uint32_t max_length)
 {
@@ -328,82 +263,6 @@ printRetainerSetShort(FILE *f, RetainerSet *rs, uint32_t max_length)
     }
     fputs(tmp, f);
 }
-#elif defined(RETAINER_SCHEME_CC)
-// Retainer scheme 3: retainer = cost centre
-static void
-printRetainerSetShort(FILE *f, retainerSet *rs, uint32_t max_length)
-{
-    char tmp[max_length + 1];
-    int size;
-    uint32_t j;
-
-    ASSERT(rs->id < 0);
-
-    tmp[max_length] = '\0';
-
-    // No blank characters are allowed.
-    sprintf(tmp + 0, "(%d)", -(rs->id));
-    size = strlen(tmp);
-    ASSERT(size < max_length);
-
-    for (j = 0; j < rs->num; j++) {
-        if (j < rs->num - 1) {
-            strncpy(tmp + size, rs->element[j]->label,
-                    max_length - size);
-            size = strlen(tmp);
-            if (size == max_length)
-                break;
-            strncpy(tmp + size, ",", max_length - size);
-            size = strlen(tmp);
-            if (size == max_length)
-                break;
-        }
-        else {
-            strncpy(tmp + size, rs->element[j]->label,
-                    max_length - size);
-            // size = strlen(tmp);
-        }
-    }
-    fprintf(f, tmp);
-/*
-  #define DOT_NUMBER              3
-  // 1. 32 > max_length + 1 (1 for '\0')
-  // 2. (max_length - DOT_NUMBER ) characters should be enough for
-  //    printing one natural number (plus '(' and ')').
-  char tmp[32];
-  int size, ts;
-  uint32_t j;
-
-  ASSERT(rs->id < 0);
-
-  // No blank characters are allowed.
-  sprintf(tmp + 0, "(%d)", -(rs->id));
-  size = strlen(tmp);
-  ASSERT(size < max_length - DOT_NUMBER);
-
-  for (j = 0; j < rs->num; j++) {
-    ts = strlen(rs->element[j]->label);
-    if (j < rs->num - 1) {
-      if (size + ts + 1 > max_length - DOT_NUMBER) {
-        sprintf(tmp + size, "...");
-        break;
-      }
-      sprintf(tmp + size, "%s,", rs->element[j]->label);
-      size += ts + 1;
-    }
-    else {
-      if (size + ts > max_length - DOT_NUMBER) {
-        sprintf(tmp + size, "...");
-        break;
-      }
-      sprintf(tmp + size, "%s", rs->element[j]->label);
-      size += ts;
-    }
-  }
-  fprintf(f, tmp);
-*/
-}
-#endif /* RETAINER_SCHEME_CC */
 #endif /* SECOND_APPROACH */
 
 /* -----------------------------------------------------------------------------
diff --git a/rts/RetainerSet.h b/rts/RetainerSet.h
index 1b4dec0..2f9aeea 100644
--- a/rts/RetainerSet.h
+++ b/rts/RetainerSet.h
@@ -25,34 +25,13 @@
     its retainer identity because its location may change during garbage
     collections.
     2. Type 'retainer' must come with comparison operations as well as
-    an equality operation. That it, <, >, and == must be supported -
+    an equality operation. That is, <, >, and == must be supported -
     this is necessary to store retainers in a sorted order in retainer sets.
     Therefore, you cannot use a huge structure type as 'retainer', for instance.
-
-  We illustrate three possibilities of defining 'retainer identity'.
-  Choose one of the following three compiler directives:
-
-   Retainer scheme 1 (RETAINER_SCHEME_INFO) : retainer = info table
-   Retainer scheme 2 (RETAINER_SCHEME_CCS)  : retainer = cost centre stack
-   Retainer scheme 3 (RETAINER_SCHEME_CC)   : retainer = cost centre
 */
 
-// #define RETAINER_SCHEME_INFO
-#define RETAINER_SCHEME_CCS
-// #define RETAINER_SCHEME_CC
-
-#if defined(RETAINER_SCHEME_INFO)
-struct _StgInfoTable;
-typedef struct _StgInfoTable *retainer;
-#endif
 
-#if defined(RETAINER_SCHEME_CCS)
 typedef CostCentreStack *retainer;
-#endif
-
-#if defined(RETAINER_SCHEME_CC)
-typedef CostCentre *retainer;
-#endif
 
 /*
   Type 'retainerSet' defines an abstract datatype for sets of retainers.



More information about the ghc-commits mailing list