comparison dmd/Global.d @ 178:e3afd1303184

Many small bugs fixed Made all classes derive from TObject to detect memory leaks (functionality is disabled for now) Began work on overriding backend memory allocations (to avoid memory leaks)
author korDen
date Sun, 17 Oct 2010 07:42:00 +0400
parents 1475fd394c9e
children cd48cb899aee
comparison
equal deleted inserted replaced
177:1475fd394c9e 178:e3afd1303184
8 import dmd.StringTable; 8 import dmd.StringTable;
9 import dmd.OutBuffer; 9 import dmd.OutBuffer;
10 import dmd.Token; 10 import dmd.Token;
11 import dmd.Scope; 11 import dmd.Scope;
12 import dmd.Module; 12 import dmd.Module;
13 import dmd.Expression;
14 import dmd.Dsymbol;
13 import dmd.Type; 15 import dmd.Type;
14 import dmd.TypeInfoDeclaration; 16 import dmd.TypeInfoDeclaration;
15 import dmd.Id; 17 import dmd.Id;
16 import dmd.TY; 18 import dmd.TY;
17 import dmd.LINK; 19 import dmd.LINK;
29 import dmd.backend.StringTab; 31 import dmd.backend.StringTab;
30 32
31 import core.stdc.time; 33 import core.stdc.time;
32 import core.stdc.stdio; 34 import core.stdc.stdio;
33 35
34 class Global 36 import dmd.TObject;
37
38 class Global : TObject
35 { 39 {
36 string mars_ext = "d"; 40 string mars_ext = "d";
37 string sym_ext = "d"; 41 string sym_ext = "d";
38 42
39 version (TARGET_WINDOS) { 43 version (TARGET_WINDOS) {
150 Array sarray; 154 Array sarray;
151 Symbol* AArray_s; 155 Symbol* AArray_s;
152 156
153 // Used in TypeDelegate 157 // Used in TypeDelegate
154 Symbol* Delegate_s; 158 Symbol* Delegate_s;
155 159
156 // Used in TypeInfoStructDeclaration 160 // Used in TypeInfoStructDeclaration
157 TypeFunction tftohash; 161 TypeFunction tftohash;
158 TypeFunction tftostring; 162 TypeFunction tftostring;
159 163
160 // Used in backend.glue 164 // Used in backend.glue
161 Array obj_symbols_towrite; 165 Array obj_symbols_towrite;
162 Outbuffer objbuf; 166 Outbuffer objbuf;
163 string lastmname; 167 string lastmname;
164 int count; 168 int count;
165 169
166 // Used in backend.iasm 170 // Used in backend.iasm
167 ASM_STATE asmstate; 171 ASM_STATE asmstate;
168 Token* asmtok; 172 Token* asmtok;
169 TOK tok_value; 173 TOK tok_value;
170 174
171 // Used in backend.StringTab 175 // Used in backend.StringTab
172 StringTab[STSIZE] stringTab; 176 StringTab[STSIZE] stringTab;
173 size_t stidx; 177 size_t stidx;
174 178
175 // Used in backend.Util 179 // Used in backend.Util
176 elem* eictor; 180 elem* eictor;
177 Symbol* ictorlocalgot; 181 Symbol* ictorlocalgot;
178 elem* ector; 182 elem* ector;
179 Array ectorgates; 183 Array ectorgates;
180 elem* edtor; 184 elem* edtor;
181 elem* etest; 185 elem* etest;
182 int dtorcount; 186 int dtorcount;
183 Symbol* localgot; 187 Symbol* localgot;
184 188
189 Dsymbol sdummy;
190 Expression edummy;
191
185 this() 192 this()
186 { 193 {
187 params.versionids = new Array(); 194 register();
195
196 params.versionids = new Vector!(string)();
188 params.imppath = new Array(); 197 params.imppath = new Array();
189 198
190 st = new DsymbolTable(); 199 st = new DsymbolTable();
191 stringtable = new StringTable();
192 stringbuffer = new OutBuffer(); 200 stringbuffer = new OutBuffer();
193 201
194 modules = new DsymbolTable(); 202 modules = new DsymbolTable();
195 amodules = new Array(); 203 amodules = new Array();
196 deferred = new Array(); 204 deferred = new Array();
197 205
198 type_stringtable = new StringTable();
199
200 arrayfuncs = new StringTable();
201
202 sarray = new Array(); 206 sarray = new Array();
203 207
204 obj_symbols_towrite = new Array(); 208 obj_symbols_towrite = new Array();
205 209
206 ectorgates = new Array(); 210 ectorgates = new Array();
207 211
212 sdummy = new Dsymbol();
213 edummy = new Expression(Loc(0), TOK.init, 0);
214
208 init_time(); 215 init_time();
209 } 216 }
210 217
211 void initClasssym() 218 void initClasssym()
212 { 219 {
213 scc = fake_classsym(Id.ClassInfo); 220 scc = fake_classsym(Id.ClassInfo);
214 221
215 scope Scope sc = new Scope(); 222 scope Scope sc = new Scope();
216 223
217 tftohash = new TypeFunction(null, Type.thash_t, 0, LINK.LINKd); 224 tftohash = new TypeFunction(null, Type.thash_t, 0, LINK.LINKd);
218 tftohash.mod = MOD.MODconst; 225 tftohash.mod = MOD.MODconst;
219 tftohash = cast(TypeFunction)tftohash.semantic(Loc(0), sc); 226 tftohash = cast(TypeFunction)tftohash.semantic(Loc(0), sc);