diff 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
line wrap: on
line diff
--- a/dmd/Global.d	Sun Oct 10 10:38:55 2010 +0400
+++ b/dmd/Global.d	Sun Oct 17 07:42:00 2010 +0400
@@ -10,6 +10,8 @@
 import dmd.Token;
 import dmd.Scope;
 import dmd.Module;
+import dmd.Expression;
+import dmd.Dsymbol;
 import dmd.Type;
 import dmd.TypeInfoDeclaration;
 import dmd.Id;
@@ -31,7 +33,9 @@
 import core.stdc.time;
 import core.stdc.stdio;
 
-class Global
+import dmd.TObject;
+
+class Global : TObject
 {
     string mars_ext = "d";
     string sym_ext	= "d";
@@ -152,26 +156,26 @@
 
 	// Used in TypeDelegate
 	Symbol* Delegate_s;
-	
+
 	// Used in TypeInfoStructDeclaration
 	TypeFunction tftohash;
 	TypeFunction tftostring;
-	
+
 	// Used in backend.glue
 	Array obj_symbols_towrite;
 	Outbuffer objbuf;
 	string lastmname;
 	int count;
-	
+
 	// Used in backend.iasm
 	ASM_STATE asmstate;
 	Token* asmtok;
 	TOK tok_value;
-	
+
 	// Used in backend.StringTab
 	StringTab[STSIZE] stringTab;
 	size_t stidx;
-	
+
 	// Used in backend.Util
 	elem* eictor;
 	Symbol* ictorlocalgot;
@@ -182,36 +186,39 @@
 	int dtorcount;
 	Symbol* localgot;
 
+    Dsymbol sdummy;
+	Expression edummy;
+
 	this()
 	{
-		params.versionids = new Array();
+	    register();
+
+		params.versionids = new Vector!(string)();
 		params.imppath = new Array();
 
 		st = new DsymbolTable();
-		stringtable = new StringTable();
 		stringbuffer = new OutBuffer();
 
 		modules = new DsymbolTable();
 		amodules = new Array();
 		deferred = new Array();
 
-		type_stringtable = new StringTable();
+		sarray = new Array();
 
-		arrayfuncs = new StringTable();
+		obj_symbols_towrite = new Array();
 
-		sarray = new Array();
-		
-		obj_symbols_towrite = new Array();
-		
 		ectorgates = new Array();
-		
+
+		sdummy = new Dsymbol();
+		edummy = new Expression(Loc(0), TOK.init, 0);
+
 		init_time();
 	}
 
 	void initClasssym()
 	{
 		scc = fake_classsym(Id.ClassInfo);
-		
+
 		scope Scope sc = new Scope();
 
 		tftohash = new TypeFunction(null, Type.thash_t, 0, LINK.LINKd);