Mercurial > projects > ddmd
comparison dmd/Type.d @ 2:7427ded8caf7
Removed unreferenced modules
First step at fixing GC issues - now calling GC.malloc instead of malloc (ditto calloc and realloc), get rid of free
author | korDen |
---|---|
date | Sun, 25 Oct 2009 03:20:59 +0300 |
parents | 10317f0c89a5 |
children | d706d958e4e8 |
comparison
equal
deleted
inserted
replaced
1:5a2059196104 | 2:7427ded8caf7 |
---|---|
61 import dmd.backend.TYM; | 61 import dmd.backend.TYM; |
62 import dmd.backend.mTY; | 62 import dmd.backend.mTY; |
63 | 63 |
64 import core.stdc.stdio; | 64 import core.stdc.stdio; |
65 | 65 |
66 import dmd.Memory; | |
67 | |
66 /* These have default values for 32 bit code, they get | 68 /* These have default values for 32 bit code, they get |
67 * adjusted for 64 bit code. | 69 * adjusted for 64 bit code. |
68 */ | 70 */ |
69 | 71 |
70 int PTRSIZE = 4; | 72 int PTRSIZE = 4; |
1035 assert(!t || t.isMutable()); | 1037 assert(!t || t.isMutable()); |
1036 } | 1038 } |
1037 if (!t) | 1039 if (!t) |
1038 { | 1040 { |
1039 uint sz = this.classinfo.init.length; | 1041 uint sz = this.classinfo.init.length; |
1040 t = cast(Type)malloc(sz); | 1042 t = cast(Type)GC.malloc(sz); |
1041 memcpy(cast(void*)t, cast(void*)this, sz); | 1043 memcpy(cast(void*)t, cast(void*)this, sz); |
1042 t.mod = 0; | 1044 t.mod = 0; |
1043 t.deco = null; | 1045 t.deco = null; |
1044 t.arrayof = null; | 1046 t.arrayof = null; |
1045 t.pto = null; | 1047 t.pto = null; |
1086 assert(!t || (t.isMutable() && !t.isShared())); | 1088 assert(!t || (t.isMutable() && !t.isShared())); |
1087 } | 1089 } |
1088 if (!t) | 1090 if (!t) |
1089 { | 1091 { |
1090 uint sz = this.classinfo.init.length; | 1092 uint sz = this.classinfo.init.length; |
1091 t = cast(Type)malloc(sz); | 1093 t = cast(Type)GC.malloc(sz); |
1092 memcpy(cast(void*)t, cast(void*)this, sz); | 1094 memcpy(cast(void*)t, cast(void*)this, sz); |
1093 t.mod = MODundefined; | 1095 t.mod = MODundefined; |
1094 t.deco = null; | 1096 t.deco = null; |
1095 t.arrayof = null; | 1097 t.arrayof = null; |
1096 t.pto = null; | 1098 t.pto = null; |
1457 | 1459 |
1458 version (DumbClone) { | 1460 version (DumbClone) { |
1459 final Type clone() | 1461 final Type clone() |
1460 { | 1462 { |
1461 auto size = this.classinfo.init.length; | 1463 auto size = this.classinfo.init.length; |
1462 auto ptr = malloc(size); | 1464 auto ptr = GC.malloc(size); |
1463 memcpy(ptr, cast(void*)this, size); | 1465 memcpy(ptr, cast(void*)this, size); |
1464 | 1466 |
1465 return cast(Type)ptr; | 1467 return cast(Type)ptr; |
1466 } | 1468 } |
1467 } else { | 1469 } else { |