[commit: ghc] master: Remove Printer.c:prettyPrintClosure() (47d8173)

git at git.haskell.org git at git.haskell.org
Fri Jun 10 11:10:40 UTC 2016


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

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

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

commit 47d81732022e0327f7a5798898b40d1f1bdbb157
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Fri Jun 10 07:13:47 2016 -0400

    Remove Printer.c:prettyPrintClosure()
    
    It turns out this function was unused and broken for a long time (fixed
    with b0a7664). Removing it as it will probably get broken again in the
    future and it's unused.
    
    Reviewers: austin, erikd, simonmar, nomeata, bgamari
    
    Reviewed By: nomeata, bgamari
    
    Subscribers: Phyx, thomie, nomeata
    
    Differential Revision: https://phabricator.haskell.org/D2322


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

47d81732022e0327f7a5798898b40d1f1bdbb157
 rts/Printer.c | 81 -----------------------------------------------------------
 rts/Printer.h |  1 -
 2 files changed, 82 deletions(-)

diff --git a/rts/Printer.c b/rts/Printer.c
index a6f26c2..1ee1c6c 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -785,87 +785,6 @@ findPtr(P_ p, int follow)
   }
 }
 
-/* prettyPrintClosure() is for printing out a closure using the data constructor
-   names found in the info tables. Closures are printed in a fashion that resembles
-   their Haskell representation. Useful during debugging.
-
-   Todo: support for more closure types, and support for non pointer fields in the
-   payload.
-*/
-
-void prettyPrintClosure_ (const StgClosure *);
-
-void prettyPrintClosure (const StgClosure *obj)
-{
-   prettyPrintClosure_ (obj);
-   debugBelch ("\n");
-}
-
-void prettyPrintClosure_ (const StgClosure *obj)
-{
-    const StgInfoTable *info;
-
-    obj = UNTAG_CONST_CLOSURE(obj);
-
-    /* collapse any indirections */
-    unsigned int type;
-    type = get_itbl(obj)->type;
-
-    while (type == IND ||
-           type == IND_STATIC)
-    {
-      obj = ((StgInd *)obj)->indirectee;
-      type = get_itbl(obj)->type;
-    }
-
-    /* find the info table for this object */
-    info = get_itbl(obj);
-
-    /* determine what kind of object we have */
-    switch (info->type)
-    {
-        /* full applications of data constructors */
-        case CONSTR:
-        case CONSTR_1_0:
-        case CONSTR_0_1:
-        case CONSTR_1_1:
-        case CONSTR_0_2:
-        case CONSTR_2_0:
-        case CONSTR_STATIC:
-        case CONSTR_NOCAF_STATIC:
-        {
-           const StgConInfoTable *con_info;
-           const char *descriptor;
-           uint32_t i;
-
-           /* find the con_info for the constructor */
-           con_info = get_con_itbl (obj);
-
-           /* obtain the name of the constructor */
-           descriptor = GET_CON_DESC(con_info);
-
-           debugBelch ("(%s", descriptor);
-
-           /* process the payload of the closure */
-           /* we don't handle non pointers at the moment */
-           for (i = 0; i < info->layout.payload.ptrs; i++)
-           {
-              debugBelch (" ");
-              prettyPrintClosure_ ((StgClosure *) obj->payload[i]);
-           }
-           debugBelch (")");
-           break;
-        }
-
-        /* if it isn't a constructor then just print the closure type */
-        default:
-        {
-           debugBelch ("<%s>", info_type(obj));
-           break;
-        }
-    }
-}
-
 const char *what_next_strs[] = {
   [0]               = "(unknown)",
   [ThreadRunGHC]    = "ThreadRunGHC",
diff --git a/rts/Printer.h b/rts/Printer.h
index bd2db35..4db7605 100644
--- a/rts/Printer.h
+++ b/rts/Printer.h
@@ -22,7 +22,6 @@ const char  *      info_type_by_ip ( const StgInfoTable *ip );
 const char  *      info_update_frame ( const StgClosure *closure );
 
 #ifdef DEBUG
-extern void        prettyPrintClosure (const StgClosure *obj);
 extern void        printClosure    ( const StgClosure *obj );
 extern void        printStackChunk ( StgPtr sp, StgPtr spLim );
 extern void        printTSO        ( StgTSO *tso );



More information about the ghc-commits mailing list