diff dmd/TypeAArray.d @ 176:fa9a71a9f5a8

Moved all the mutable globals to Global
author korDen
date Sun, 10 Oct 2010 05:22:45 +0400
parents af724d3510d7
children e3afd1303184
line wrap: on
line diff
--- a/dmd/TypeAArray.d	Sun Oct 10 03:48:06 2010 +0400
+++ b/dmd/TypeAArray.d	Sun Oct 10 05:22:45 2010 +0400
@@ -414,13 +414,6 @@
 		assert(false);
 	}
 }
-	// Dumb linear symbol table - should use associative array!
-	static __gshared Array sarray;
-	
-	shared static this()
-	{
-		sarray = new Array();
-	}
 
     // Back end
 	/********************************************
@@ -473,9 +466,9 @@
 	}
 
 		// See if symbol is already in sarray
-		for (i = 0; i < sarray.dim; i++)
+		for (i = 0; i < global.sarray.dim; i++)
 		{   
-			s = cast(Symbol*)sarray.data[i];
+			s = cast(Symbol*)global.sarray.data[i];
 			if (strcmp(id, s.Sident.ptr) == 0)
 				return s;			// use existing Symbol
 		}
@@ -497,11 +490,9 @@
 		t.Tcount++;
 		s.Stype = t;
 
-		sarray.push(s);			// remember it
+		global.sarray.push(s);			// remember it
 		return s;
     }
-	
-	static __gshared Symbol* s;
 
     override type* toCtype()
 	{
@@ -516,9 +507,10 @@
 			 *	struct AArray { size_t length; void* ptr; }
 			 */
 
+			auto s = global.AArray_s;
 			if (!s)
 			{
-				s = symbol_calloc("_AArray");
+				global.AArray_s = s = symbol_calloc("_AArray");
 				s.Sclass = SCstruct;
 				s.Sstruct = struct_calloc();
 				s.Sstruct.Sflags |= 0;
@@ -530,7 +522,7 @@
 				Symbol* s1 = symbol_name("length", SCmember, Type.tsize_t.toCtype());
 				list_append(&s.Sstruct.Sfldlst, s1);
 
-				Symbol* s2 = symbol_name("data", SCmember, Type.tvoidptr.toCtype());
+				Symbol* s2 = symbol_name("data", SCmember, global.tvoidptr.toCtype());
 				s2.Smemoff = cast(uint)Type.tsize_t.size();
 				list_append(&s.Sstruct.Sfldlst, s2);
 			}