From b9daf612008be8a05925045c38b161fe2c9f1045 Mon Sep 17 00:00:00 2001 From: sewardj Date: Wed, 12 Apr 2000 09:37:19 +0000 Subject: [PATCH] [project @ 2000-04-12 09:37:19 by sewardj] More infotable cleanups: zap the debugging table of info table names. This can be cleanly done by looking at the .itbl field on Names and Tycons. --- ghc/interpreter/codegen.c | 25 +++---------------------- ghc/interpreter/storage.c | 25 +++++++++++++++++++++++-- ghc/rts/Printer.c | 13 ++----------- 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/ghc/interpreter/codegen.c b/ghc/interpreter/codegen.c index add3364..ef12398 100644 --- a/ghc/interpreter/codegen.c +++ b/ghc/interpreter/codegen.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: codegen.c,v $ - * $Revision: 1.21 $ - * $Date: 2000/04/05 10:25:08 $ + * $Revision: 1.22 $ + * $Date: 2000/04/12 09:37:19 $ * ------------------------------------------------------------------------*/ #include "hugsbasictypes.h" @@ -441,11 +441,6 @@ static Void cgExpr( AsmBCO bco, AsmSp root, StgExpr e ) } } -#define M_ITBLNAMES 35000 - -void* itblNames[M_ITBLNAMES]; -int nItblNames = 0; - /* allocate space for top level variable * any change requires a corresponding change in 'build'. */ @@ -465,20 +460,7 @@ static Void alloc( AsmBCO bco, StgVar v ) pushAtom(bco,hd(args)); setPos(v,asmBox(bco,boxingConRep(con))); } else { - - void* vv = stgConInfo(con); - if (!(nItblNames < (M_ITBLNAMES-2))) - internal("alloc -- M_ITBLNAMES too small"); - if (isName(con)) { - itblNames[nItblNames++] = vv; - itblNames[nItblNames++] = textToStr(name(con).text); - } else - if (isTuple(con)) { - itblNames[nItblNames++] = vv; - itblNames[nItblNames++] = textToStr(ghcTupleText(con)); - } else - assert ( /* cant identify constructor name */ 0 ); - setPos(v,asmAllocCONSTR(bco, vv)); + setPos(v,asmAllocCONSTR(bco,stgConInfo(con))); } break; } @@ -494,7 +476,6 @@ static Void alloc( AsmBCO bco, StgVar v ) } } setPos(v,asmAllocAP(bco,totSizeW)); - //ORIGINALLY:setPos(v,asmAllocAP(bco,length(stgAppArgs(rhs)))); break; } case LAMBDA: /* optimisation */ diff --git a/ghc/interpreter/storage.c b/ghc/interpreter/storage.c index 95627f4..696e117 100644 --- a/ghc/interpreter/storage.c +++ b/ghc/interpreter/storage.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: storage.c,v $ - * $Revision: 1.69 $ - * $Date: 2000/04/11 16:36:53 $ + * $Revision: 1.70 $ + * $Date: 2000/04/12 09:37:19 $ * ------------------------------------------------------------------------*/ #include "hugsbasictypes.h" @@ -3002,6 +3002,27 @@ List args; { * debugging support * ------------------------------------------------------------------------*/ +/* Given the address of an info table, find the constructor/tuple + that it belongs to, and return the name. Only needed for debugging. +*/ +char* lookupHugsItblName ( void* v ) +{ + int i; + for (i = TYCON_BASE_ADDR; + i < TYCON_BASE_ADDR+tabTyconSz; ++i) { + if (tabTycon[i-TYCON_BASE_ADDR].inUse + && tycon(i).itbl == v) + return textToStr(tycon(i).text); + } + for (i = NAME_BASE_ADDR; + i < NAME_BASE_ADDR+tabNameSz; ++i) { + if (tabName[i-NAME_BASE_ADDR].inUse + && name(i).itbl == v) + return textToStr(name(i).text); + } + return NULL; +} + static String maybeModuleStr ( Module m ) { if (isModule(m)) return textToStr(module(m).text); else return "??"; diff --git a/ghc/rts/Printer.c b/ghc/rts/Printer.c index 99c1255..82ce135 100644 --- a/ghc/rts/Printer.c +++ b/ghc/rts/Printer.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Printer.c,v 1.23 2000/03/31 03:09:36 hwloidl Exp $ + * $Id: Printer.c,v 1.24 2000/04/12 09:37:19 sewardj Exp $ * * (c) The GHC Team, 1994-2000. * @@ -43,17 +43,8 @@ static void printZcoded ( const char *raw ); * Printer * ------------------------------------------------------------------------*/ - #ifdef INTERPRETER -extern void* itblNames[]; -extern int nItblNames; -char* lookupHugsItblName ( void* v ) -{ - int i; - for (i = 0; i < nItblNames; i += 2) - if (itblNames[i] == v) return itblNames[i+1]; - return NULL; -} +char* lookupHugsItblName ( void* itbl ); #endif void printPtr( StgPtr p ) -- 1.7.10.4