Ticket #803: changes-free

File changes-free, 5.1 KB (added by guest, 8 years ago)
Line 
1diff -rc src-ref/ghc-6.4.2.20060411/ghc/includes/Stable.h src-with-old-ghc/ghc-6.4.2.20060411/ghc/includes/Stable.h
2*** src-ref/ghc-6.4.2.20060411/ghc/includes/Stable.h Fri Aug 13 09:09:30 2004
3--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/includes/Stable.h Thu May 25 12:06:44 2006
4***************
5*** 55,60 ****
6--- 55,61 ----
7  #endif
8 
9  extern void    initStablePtrTable    ( void );
10+ extern void    exitStablePtrTable    ( void );
11  extern void    enlargeStablePtrTable ( void );
12  extern StgWord lookupStableName      ( StgPtr p );
13 
14***************
15*** 62,66 ****
16--- 63,69 ----
17  extern void    threadStablePtrTable  ( evac_fn evac );
18  extern void    gcStablePtrTable      ( void );
19  extern void    updateStablePtrTable  ( rtsBool full );
20+
21+ extern void    exitHashTable         ( void );
22 
23  #endif
24diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/Hash.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Hash.c
25*** src-ref/ghc-6.4.2.20060411/ghc/rts/Hash.c Sun Sep 12 07:27:14 2004
26--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Hash.c Thu May 25 12:38:35 2006
27***************
28*** 212,226 ****
29--- 212,236 ----
30 
31  static HashList *freeList = NULL;
32 
33+ static struct chunkList {
34+   void *chunk;
35+   struct chunkList *next;
36+ } *chunks;
37+
38  static HashList *
39  allocHashList(void)
40  {
41      HashList *hl, *p;
42+     struct chunkList *cl;
43 
44      if ((hl = freeList) != NULL) {
45        freeList = hl->next;
46      } else {
47          hl = stgMallocBytes(HCHUNK * sizeof(HashList), "allocHashList");
48+       cl = stgMallocBytes(sizeof (*cl), "allocHashList: chunkList");
49+       cl->chunk = hl;
50+       cl->next = chunks;
51+       chunks = cl;
52 
53        freeList = hl + 1;
54        for (p = freeList; p < hl + HCHUNK - 1; p++)
55***************
56*** 372,375 ****
57--- 382,397 ----
58  {
59      return allocHashTable_((HashFunction *)hashStr,
60                           (CompareFunction *)compareStr);
61+ }
62+
63+ void
64+ exitHashTable(void)
65+ {
66+   struct chunkList *cl;
67+
68+   while ((cl = chunks) != NULL) {
69+     chunks = cl->next;
70+     stgFree(cl->chunk);
71+     stgFree(cl);
72+   }
73  }
74diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/RtsStartup.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/RtsStartup.c
75*** src-ref/ghc-6.4.2.20060411/ghc/rts/RtsStartup.c Wed Apr  5 10:59:19 2006
76--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/RtsStartup.c Thu May 25 12:30:09 2006
77***************
78*** 380,385 ****
79--- 383,394 ----
80      // also outputs the stats (+RTS -s) info.
81      exitStorage();
82     
83+     /* initialise the stable pointer table */
84+     exitStablePtrTable();
85+
86+     /* free hash table storage */
87+     exitHashTable();
88+
89  #ifdef RTS_GTK_FRONTPANEL
90      if (RtsFlags.GcFlags.frontpanel) {
91        stopFrontPanel();
92diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/Schedule.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Schedule.c
93*** src-ref/ghc-6.4.2.20060411/ghc/rts/Schedule.c Fri Feb 24 06:07:38 2006
94--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Schedule.c Thu May 25 10:07:19 2006
95***************
96*** 2122,2130 ****
97--- 2122,2139 ----
98  void
99  exitScheduler( void )
100  {
101+   StgMainThread *m;
102+
103  #if defined(RTS_SUPPORTS_THREADS)
104    stopTaskManager();
105  #endif
106+
107+   // Deallocate thread records
108+   while((m = main_threads) != NULL) {
109+     main_threads = m->link;
110+     stgFree(m);
111+   }
112+
113    shutting_down_scheduler = rtsTrue;
114  }
115 
116diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/Stable.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Stable.c
117*** src-ref/ghc-6.4.2.20060411/ghc/rts/Stable.c Fri Jul  8 05:08:41 2005
118--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Stable.c Thu May 25 12:16:37 2006
119***************
120*** 138,143 ****
121--- 138,155 ----
122      // called, and we want the table to persist through multiple inits.
123  }
124 
125+ void
126+ exitStablePtrTable(void)
127+ {
128+   if (addrToStableHash)
129+     freeHashTable(addrToStableHash, NULL);
130+   addrToStableHash = NULL;
131+   if (stable_ptr_table)
132+     stgFree(stable_ptr_table);
133+   stable_ptr_table = NULL;
134+   SPT_size = 0;
135+ }
136+
137  /*
138   * get at the real stuff...remove indirections.
139   *
140diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/Stats.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Stats.c
141*** src-ref/ghc-6.4.2.20060411/ghc/rts/Stats.c Fri Jan 28 07:56:18 2005
142--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Stats.c Thu May 25 12:33:33 2006
143***************
144*** 760,765 ****
145--- 760,768 ----
146        statsFlush();
147        statsClose();
148      }
149+     if (GC_coll_times)
150+       stgFree(GC_coll_times);
151+     GC_coll_times = NULL;
152  }
153 
154  /* -----------------------------------------------------------------------------
155diff -rc src-ref/ghc-6.4.2.20060411/ghc/rts/Storage.c src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Storage.c
156*** src-ref/ghc-6.4.2.20060411/ghc/rts/Storage.c Thu Mar 30 08:45:47 2006
157--- src-with-old-ghc/ghc-6.4.2.20060411/ghc/rts/Storage.c Thu May 25 12:33:49 2006
158***************
159*** 222,227 ****
160--- 222,232 ----
161  void
162  freeStorage (void)
163  {
164+     nat g;
165+
166+     for(g = 0; g < RtsFlags.GcFlags.generations; g++)
167+       stgFree(generations[g].steps);
168+     stgFree(generations);
169      freeAllMBlocks();
170  }
171