diff dmd/Type.d @ 174:af724d3510d7

lot os toCBuffer methods implemented moved shared Type.* stuff into Global
author korDen
date Sun, 10 Oct 2010 03:47:23 +0400
parents 96c0fff6897d
children fa9a71a9f5a8
line wrap: on
line diff
--- a/dmd/Type.d	Sun Oct 10 01:55:35 2010 +0400
+++ b/dmd/Type.d	Sun Oct 10 03:47:23 2010 +0400
@@ -79,10 +79,10 @@
  * adjusted for 64 bit code.
  */
 
-int PTRSIZE = 4;
-
-int Tsize_t;
-int Tptrdiff_t;
+__gshared int PTRSIZE = 4;
+
+__gshared int Tsize_t;
+__gshared int Tptrdiff_t;
 
 /* REALSIZE = size a real consumes in memory
  * REALPAD = 'padding' added to the CPU real size to bring it up to REALSIZE
@@ -90,16 +90,16 @@
  */
 version (TARGET_OSX) {
 	extern(C++) __gshared int REALSIZE = 16;
-	int REALPAD = 6;
-	int REALALIGNSIZE = 16;
+	__gshared int REALPAD = 6;
+	__gshared int REALALIGNSIZE = 16;
 } else version (POSIX) { /// TARGET_LINUX || TARGET_FREEBSD || TARGET_SOLARIS
 	extern(C++) __gshared int REALSIZE = 12;
-	int REALPAD = 2;
-	int REALALIGNSIZE = 4;
+	__gshared int REALPAD = 2;
+	__gshared int REALALIGNSIZE = 4;
 } else {
 	extern(C++) __gshared int REALSIZE = 10;
-	int REALPAD = 0;
-	int REALALIGNSIZE = 2;
+	__gshared int REALPAD = 0;
+	__gshared int REALALIGNSIZE = 2;
 }
 
 /****
@@ -110,7 +110,7 @@
 int templateIdentifierLookup(Identifier id, TemplateParameters parameters)
 {
     foreach (size_t i, TemplateParameter tp; parameters)
-    {   
+    {
 		if (tp.ident.equals(id))
 			return i;
     }
@@ -259,32 +259,13 @@
 
     type* ctype;	// for back end
 
-    static ClassDeclaration typeinfo;
-    static ClassDeclaration typeinfoclass;
-    static ClassDeclaration typeinfointerface;
-    static ClassDeclaration typeinfostruct;
-    static ClassDeclaration typeinfotypedef;
-    static ClassDeclaration typeinfopointer;
-    static ClassDeclaration typeinfoarray;
-    static ClassDeclaration typeinfostaticarray;
-    static ClassDeclaration typeinfoassociativearray;
-    static ClassDeclaration typeinfoenum;
-    static ClassDeclaration typeinfofunction;
-    static ClassDeclaration typeinfodelegate;
-    static ClassDeclaration typeinfotypelist;
-    static ClassDeclaration typeinfoconst;
-    static ClassDeclaration typeinfoinvariant;
-    static ClassDeclaration typeinfoshared;
-    static ClassDeclaration typeinfowild;
-
-    static Type basic[TY.TMAX];
-    static ubyte mangleChar[TY.TMAX];
-    static ubyte sizeTy[TY.TMAX];
-    static StringTable stringtable;
+    static __gshared Type basic[TY.TMAX];
+    static __gshared ubyte mangleChar[TY.TMAX];
+    static __gshared ubyte sizeTy[TY.TMAX];
 
     // These tables are for implicit conversion of binary ops;
     // the indices are the type of operand one, followed by operand two.
-    static ubyte impcnvResult[TY.TMAX][TY.TMAX] = [
+    static __gshared ubyte impcnvResult[TY.TMAX][TY.TMAX] = [
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
@@ -330,7 +311,7 @@
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 	];
 
-    static ubyte impcnvType1[TY.TMAX][TY.TMAX] = [
+    static __gshared ubyte impcnvType1[TY.TMAX][TY.TMAX] = [
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
@@ -375,8 +356,8 @@
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 	];
-	
-    static ubyte impcnvType2[TY.TMAX][TY.TMAX] = [
+
+    static __gshared ubyte impcnvType2[TY.TMAX][TY.TMAX] = [
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
 		[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37],
@@ -423,7 +404,7 @@
 	];
 
     // If !=0, give warning on implicit conversion
-    static const(bool) impcnvWarn[TY.TMAX][TY.TMAX] = [
+    static __gshared const(bool) impcnvWarn[TY.TMAX][TY.TMAX] = [
 		[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
 		[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
 		[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
@@ -468,22 +449,12 @@
 		[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
 		[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
 	];
-	
-	static this()
-	{
-		stringtable = new StringTable();
-	}
-	
-	static ~this()
-	{
-		delete stringtable;
-	}
 
     this(TY ty)
 	{
 		this.ty = ty;
 	}
-	
+
     Type syntaxCopy()
 	{
 		assert(false);
@@ -502,7 +473,7 @@
 		//if (deco && t && t.deco) printf("deco = '%s', t.deco = '%s'\n", deco, t.deco);
 		return 0;
 	}
-	
+
     DYNCAST dyncast() { return DYNCAST.DYNCAST_TYPE; } // kludge for template.isType()
 
 	/*******************************
@@ -548,7 +519,7 @@
 				goto Ldistinct;
 
 			for (size_t i = 0; i < dim; i++)
-			{   
+			{
 				auto arg1 = Parameter.getNth(t1.parameters, i);
 				auto arg2 = Parameter.getNth(t2.parameters, i);
 
@@ -662,12 +633,12 @@
 		toCBuffer(buf, null, &hgs);
 		return buf.toChars();
 	}
-	
+
     static char needThisPrefix()
 	{
 		return 'M';		// name mangling prefix for functions needing 'this'
 	}
-	
+
     static void init()
 	{
 		Lexer.initKeywords();
@@ -752,7 +723,7 @@
 		}
 }
 		// Set basic types
-		static TY[] basetab = [
+		enum TY[] basetab = [
 			TY.Tvoid, TY.Tint8, TY.Tuns8, TY.Tint16, TY.Tuns16, TY.Tint32, TY.Tuns32, TY.Tint64, TY.Tuns64,
 			TY.Tfloat32, TY.Tfloat64, TY.Tfloat80,
 			TY.Timaginary32, TY.Timaginary64, TY.Timaginary80,
@@ -798,18 +769,18 @@
 			Tptrdiff_t = TY.Tint32;
 		}
 	}
-	
+
     ulong size()
 	{
 		return size(Loc(0));
 	}
-	
+
     ulong size(Loc loc)
 	{
 		error(loc, "no size for type %s", toChars());
 		return 1;
 	}
-	
+
     uint alignsize()
 	{
 		return cast(uint)size(Loc(0));	///
@@ -819,7 +790,7 @@
 	{
 		return merge();
 	}
-	
+
     Type trySemantic(Loc loc, Scope sc)
 	{
 		uint errors = global.errors;
@@ -847,7 +818,7 @@
 		}
 		buf.writeByte(mangleChar[ty]);
 	}
-	
+
     Type merge()
 	{
 		Type t = this;
@@ -861,7 +832,7 @@
 			//if (next)
 				//next = next.merge();
 			toDecoBuffer(buf);
-			StringValue* sv = stringtable.update(buf.extractString());
+			StringValue* sv = global.type_stringtable.update(buf.extractString());
 			if (sv.ptrvalue)
 			{
 				t = cast(Type) sv.ptrvalue;
@@ -894,9 +865,9 @@
 		if (!t.deco)
 			return t.merge();
 
-		StringValue* sv = stringtable.lookup(t.deco);
+		StringValue* sv = global.type_stringtable.lookup(t.deco);
 		if (sv && sv.ptrvalue)
-		{   
+		{
 			t = cast(Type)sv.ptrvalue;
 			assert(t.deco);
 		}
@@ -919,7 +890,7 @@
     void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod)
 	{
 		if (mod != this.mod)
-		{	
+		{
 			toCBuffer3(buf, hgs, mod);
 			return;
 		}
@@ -971,47 +942,47 @@
 	{
 		return false;
 	}
-	
+
     bool isfloating()	// real, imaginary, or complex
 	{
 		return false;
 	}
-	
+
     bool isreal()
 	{
 		return false;
 	}
-	
+
     bool isimaginary()
 	{
 		return false;
 	}
-	
+
     bool iscomplex()
 	{
 		return false;
 	}
-	
+
     bool isscalar()
 	{
 		return false;
 	}
-	
+
     bool isunsigned()
 	{
 		return false;
 	}
-	
+
     bool isauto()
 	{
 		return false;
 	}
-	
+
     bool isString()
 	{
 		return false;
 	}
-	
+
 	/**************************
 	 * Given:
 	 *	T a, b;
@@ -1023,7 +994,7 @@
 	{
 		return true;
 	}
-	
+
     bool checkBoolean()	// if can be converted to boolean value
 	{
 		return isscalar();
@@ -1048,7 +1019,7 @@
 	int isShared()	{ return mod & MOD.MODshared; }
 
 	int isSharedConst()	{ return mod == (MOD.MODshared | MOD.MODconst); }
-            
+
     int isWild()	{ return mod & MOD.MODwild; }
 
     int isSharedWild()	{ return mod == (MOD.MODshared | MOD.MODwild); }
@@ -1080,7 +1051,7 @@
 	 * Convert to 'immutable'.
 	 */
     Type invariantOf()
-	{	
+	{
 		//printf("Type.invariantOf() %p %s\n", this, toChars());
 		if (isImmutable())
 		{
@@ -1103,7 +1074,7 @@
 		//printf("Type.mutableOf() %p, %s\n", this, toChars());
 		Type t = this;
 		if (isConst())
-		{	
+		{
 			if (isShared())
 				t = sto;		// shared const => shared
 			else
@@ -1111,7 +1082,7 @@
 			assert(!t || t.isMutable());
 		}
 		else if (isImmutable())
-		{	
+		{
 			t = ito;
 			assert(!t || (t.isMutable() && !t.isShared()));
 		}
@@ -1219,14 +1190,14 @@
 	        t.swto = null;
 			t.vtinfo = null;
 			t = t.merge();
-	
+
 			t.fixTo(this);
 		}
 		assert(!t.isShared());
 		return t;
 	}
 
-            
+
     /********************************
      * Convert to 'wild'.
      */
@@ -1431,7 +1402,7 @@
 		L5:
 			t.scto = this;
 			break;
-            
+
 	    case X(MOD.MODwild, MOD.MODundefined):
 	        wto = null;
 	        goto L6;
@@ -1490,7 +1461,7 @@
 		t.check();
 		//printf("fixTo: %s, %s\n", toChars(), t.toChars());
 	}
-	
+
 	/***************************
 	 * Look for bugs in constructing types.
 	 */
@@ -1542,7 +1513,7 @@
 	        if (wto) assert(wto.mod == MOD.MODwild);
 	        if (swto) assert(swto.mod == (MOD.MODshared | MOD.MODwild));
 			break;
-            
+
 	    case MOD.MODwild:
 	        if (cto) assert(cto.mod == MOD.MODconst);
 	        if (ito) assert(ito.mod == MOD.MODimmutable);
@@ -1641,7 +1612,7 @@
 		}
 		return t;
 	}
-	
+
 	/************************************
 	 * Add MODxxxx bits to existing type.
 	 * We're adding, not replacing, so adding const to
@@ -1684,7 +1655,7 @@
 				case MOD.MODshared | MOD.MODconst:
 					t = sharedConstOf();
 					break;
-                
+
 	            case MOD.MODwild:
 		            if (isConst())
                     {}
@@ -1701,7 +1672,7 @@
 		}
 		return t;
 	}
-	
+
     Type addStorageClass(StorageClass stc)
 	{
 		/* Just translate to MOD bits and let addMod() do the work
@@ -1711,7 +1682,7 @@
 		if (stc & STC.STCimmutable)
 			mod = MOD.MODimmutable;
 		else
-		{	
+		{
 			if (stc & (STC.STCconst | STC.STCin))
 				mod = MOD.MODconst;
 			if (stc & STC.STCshared)
@@ -1722,7 +1693,7 @@
 
 		return addMod(mod);
 	}
-	
+
     Type pointerTo()
 	{
 		if (pto is null)
@@ -1733,7 +1704,7 @@
 
 		return pto;
 	}
-	
+
     Type referenceTo()
 	{
 		assert(false);
@@ -1761,17 +1732,17 @@
 		return cloneTo(new Type(ty));
 	}
 }
-	
+
     Type arrayOf()
 	{
 		if (!arrayof)
-		{	
+		{
 			Type t = new TypeDArray(this);
 			arrayof = t.merge();
 		}
 		return arrayof;
 	}
-	
+
     Type makeConst()
 	{
 		//printf("Type.makeConst() %p, %s\n", this, toChars());
@@ -1780,7 +1751,7 @@
 
 		Type t = clone();
 		t.mod = MOD.MODconst;
-		
+
 		t.deco = null;
 		t.arrayof = null;
 		t.pto = null;
@@ -1792,11 +1763,11 @@
         t.wto = null;
         t.swto = null;
 		t.vtinfo = null;
-		
+
 		//printf("-Type.makeConst() %p, %s\n", t, toChars());
 		return t;
 	}
-	
+
     Type makeInvariant()
 	{
 		if (ito) {
@@ -1820,7 +1791,7 @@
 
 		return t;
 	}
-	
+
     Type makeShared()
 	{
 		if (sto)
@@ -1843,7 +1814,7 @@
 
 		return t;
 	}
-	
+
     Type makeSharedConst()
 	{
 		if (scto)
@@ -1866,12 +1837,12 @@
 
 		return t;
 	}
-	
+
     Type makeWild()
     {
         if (wto)
 	        return wto;
-        
+
         Type t = clone();
         t.mod = MOD.MODwild;
         t.deco = null;
@@ -1892,7 +1863,7 @@
     {
         if (swto)
 	        return swto;
-        
+
         Type t = clone();
         t.mod = MOD.MODshared | MOD.MODwild;
         t.deco = null;
@@ -1926,7 +1897,7 @@
         t.vtinfo = null;
         return t;
     }
-    
+
     Dsymbol toDsymbol(Scope sc)
 	{
 		return null;
@@ -1936,12 +1907,12 @@
 	 * If this is a shell around another type,
 	 * get that other type.
 	 */
-		
+
     Type toBasetype()
 	{
 		return this;
 	}
-	
+
 	/**************************
 	 * Return type with the top level of it being mutable.
 	 */
@@ -1952,12 +1923,12 @@
 
 		return mutableOf();
 	}
-	
+
     bool isBaseOf(Type t, int* poffset)
 	{
 		return false;		// assume not
 	}
-	
+
 	/*******************************
 	 * Determine if converting 'this' to 'to' is an identity operation,
 	 * a conversion to const operation, or the types aren't the same.
@@ -1974,7 +1945,7 @@
 			return MATCH.MATCHconst;
 		return MATCH.MATCHnomatch;
 	}
-	
+
 	/********************************
 	 * Determine if 'this' can be implicitly converted
 	 * to type 'to'.
@@ -1991,7 +1962,7 @@
 
 		return MATCHnomatch;
 	}
-	
+
     ClassDeclaration isClassHandle()
 	{
 		return null;
@@ -2032,7 +2003,7 @@
 		else if (ident is Id.mangleof_)
 		{
 			string s;
-			if (!deco) {  
+			if (!deco) {
 				s = toChars();
 				error(loc, "forward reference of type %s.mangleof", s);
 			} else {
@@ -2044,7 +2015,7 @@
 			e = e.semantic(sc);
 		}
 		else if (ident is Id.stringof_)
-		{	
+		{
 			string s = toChars();
 			e = new StringExp(loc, s, 'c');
 			scope Scope sc = new Scope();
@@ -2057,7 +2028,7 @@
 		}
 		return e;
 	}
-	
+
     Expression dotExp(Scope sc, Expression e, Identifier ident)
 	{
 		VarDeclaration v = null;
@@ -2134,18 +2105,18 @@
 			e = getTypeInfo(sc);
 		}
 		else if (ident is Id.stringof_)
-		{		
+		{
 			string s = e.toChars();
 			e = new StringExp(e.loc, s, 'c');
 		}
         else
     	    e = getProperty(e.loc, ident);
-        
+
 Lreturn:
         e = e.semantic(sc);
         return e;
 	}
-	
+
     /***************************************
      * Figures out what to do with an undefined member reference
      * for classes and structs.
@@ -2214,12 +2185,12 @@
 
         return Type.dotExp(sc, e, ident);
     }
-    
+
     uint memalign(uint salign)
 	{
 		return salign;
 	}
-	
+
     Expression defaultInit(Loc loc)
 	{
 		version (LOGDEFAULTINIT) {
@@ -2227,12 +2198,13 @@
 		}
 		return null;
 	}
-	
+
     /***************************************
      * Use when we prefer the default initializer to be a literal,
      * rather than a global immutable variable.
      */
-    Expression defaultInitLiteral(Loc loc = Loc(0))
+    //Expression defaultInitLiteral(Loc loc = Loc(0))
+    Expression defaultInitLiteral(Loc loc)
     {
 version(LOGDEFAULTINIT) {
         printf("Type::defaultInitLiteral() '%s'\n", toChars());
@@ -2245,14 +2217,14 @@
 	{
 		assert(false);
 	}
-	
+
     dt_t** toDt(dt_t** pdt)
 	{
 		//printf("Type.toDt()\n");
 		Expression e = defaultInit(Loc(0));
 		return e.toDt(pdt);
 	}
-	
+
     Identifier getTypeInfoIdent(int internal)
 	{
 		// _init_10TypeInfo_%s
@@ -2262,7 +2234,7 @@
 		int len;
 
 		if (internal)
-		{	
+		{
 			buf.writeByte(mangleChar[ty]);
 			if (ty == TY.Tarray)
 				buf.writeByte(mangleChar[(cast(TypeArray)this).next.ty]);
@@ -2288,7 +2260,7 @@
 		id = Lexer.idPool(name[0..len-1].idup);
 		return id;
 	}
-	
+
 	/* These form the heart of template argument deduction.
 	 * Given 'this' being the type argument to the template instance,
 	 * it is matched against the template declaration parameter specialization
@@ -2353,7 +2325,7 @@
 
 			// 5*5 == 25 cases
 			static pure int X(int U, int T) { return ((U << 4) | T); }
-			
+
 			switch (X(tparam.mod, mod))
 			{
 				case X(0, 0):
@@ -2532,6 +2504,8 @@
 		*ps = null;
 	}
 	
+	static __gshared TypeInfoDeclaration internalTI[TMAX];
+
 	/*******************************************
 	 * Get a canonicalized form of the TypeInfo for use with the internal
 	 * runtime library routines. Canonicalized in that static arrays are
@@ -2544,7 +2518,6 @@
 		TypeInfoDeclaration tid;
 		Expression e;
 		Type t;
-		static TypeInfoDeclaration internalTI[TMAX];
 
 		//printf("Type.getInternalTypeInfo() %s\n", toChars());
 		t = toBasetype();
@@ -2575,7 +2548,7 @@
 			Linternal:
 				tid = internalTI[t.ty];
 				if (!tid)
-				{	
+				{
 					tid = new TypeInfoDeclaration(t, 1);
 					internalTI[t.ty] = tid;
 				}
@@ -2590,7 +2563,7 @@
 		//printf("\tcalling getTypeInfo() %s\n", t.toChars());
 		return t.getTypeInfo(sc);
 	}
-	
+
 	/****************************************************
 	 * Get the exact TypeInfo.
 	 */
@@ -2625,10 +2598,10 @@
 			 * do not generate a COMDAT for it.
 			 */
 			if (!t.builtinTypeInfo())
-			{   
+			{
 				// Generate COMDAT
 				if (sc)			// if in semantic() pass
-				{	
+				{
 					// Find module that will go all the way to an object file
 					Module m = sc.module_.importedFrom;
 					m.members.push(t.vtinfo);
@@ -2644,13 +2617,13 @@
 		e.type = t.vtinfo.type;		// do this so we don't get redundant dereference
 		return e;
 	}
-	
+
     TypeInfoDeclaration getTypeInfoDeclaration()
 	{
 		//printf("Type.getTypeInfoDeclaration() %s\n", toChars());
 		return new TypeInfoDeclaration(this, 0);
 	}
-	
+
 	/* These decide if there's an instance for them already in std.typeinfo,
 	 * because then the compiler doesn't need to build one.
 	 */
@@ -2658,7 +2631,7 @@
 	{
 		return false;
 	}
-	
+
 	/*******************************
 	 * If one of the subtypes of this type is a TypeIdentifier,
 	 * i.e. it's an unresolved type, return that type.
@@ -2667,7 +2640,7 @@
 	{
 		return null;
 	}
-	
+
     /***************************************
      * Return !=0 if the type or any of its subtypes is wild.
      */
@@ -2685,12 +2658,12 @@
     {
         return 0;
     }
-    
+
     Expression toExpression()
 	{
 		assert(false);
 	}
-	
+
 	/***************************************
 	 * Return true if type has pointers that need to
 	 * be scanned by the GC during a collection cycle.
@@ -2699,7 +2672,7 @@
 	{
 		return false;
 	}
-	
+
 	/*************************************
 	 * If this is a type of something, return that something.
 	 */
@@ -2707,7 +2680,7 @@
 	{
 		return null;
 	}
-	
+
 	/****************************************
 	 * Return the mask that an integral type will
 	 * fit into.
@@ -2735,12 +2708,12 @@
 		}
 		return m;
 	}
-	
+
     static void error(T...)(Loc loc, string format, T t)
 	{
 		.error(loc, format, t);
 	}
-	
+
     static void warning(T...)(Loc loc, string format, T t)
 	{
 		assert(false);
@@ -2847,7 +2820,7 @@
 
 		return t;
 	}
-	
+
 	/***************************************
 	 * Convert from D type to C type.
 	 * This is done so C debug info can be generated.
@@ -2861,17 +2834,17 @@
 		}
 		return ctype;
 	}
-	
+
     type* toCParamtype()
 	{
 		return toCtype();
 	}
-	
+
     Symbol* toSymbol()
 	{
 		assert(false);
 	}
-	
+
     // For eliminating dynamic_cast
     TypeBasic isTypeBasic()
 	{
@@ -2992,7 +2965,7 @@
 	{
 		return basic[TY.Tdchar];
 	}
-	
+
 	// Some special types
     static Type tshiftcnt()
 	{
@@ -3004,14 +2977,14 @@
 	{
 		return tbool;		// result of boolean expression
 	}
-	
+
     static Type tindex()
 	{
 		return tint32;		// array/ptr index
 	}
-	
-    static Type tvoidptr;		// void*
-    static Type tstring;		// immutable(char)[]
+
+    static __gshared Type tvoidptr;		// void*
+    static __gshared Type tstring;		// immutable(char)[]
 
 	static Type terror()
 	{
@@ -3022,12 +2995,12 @@
 	{
 		return basic[Tsize_t];		// matches size_t alias
 	}
-	
+
     static Type tptrdiff_t()
 	{
 		return basic[Tptrdiff_t];	// matches ptrdiff_t alias
 	}
-	
+
     static Type thash_t()
 	{
 		return tsize_t;			// matches hash_t alias