comparison runtime/internal/lifetime.d @ 715:30b42a283c8e

Removed TypeOpaque from DMD. Changed runtime functions taking opaque[] to void[]. Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[]. Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86. Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing. Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way... Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8. Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 22 Oct 2008 14:55:33 +0200
parents 6aaa3d3c1183
children a26b0c5d5942
comparison
equal deleted inserted replaced
714:1e98c99a87cb 715:30b42a283c8e
1090 1090
1091 1091
1092 /** 1092 /**
1093 * Support for array.dup property. 1093 * Support for array.dup property.
1094 */ 1094 */
1095 struct Array2 1095
1096 { 1096
1097 size_t length; 1097 /**
1098 void* ptr; 1098 *
1099 } 1099 */
1100 1100 extern (C) void[] _adDupT(TypeInfo ti, void[] a)
1101
1102 /**
1103 *
1104 */
1105 extern (C) Array2 _adDupT(TypeInfo ti, Array2 a)
1106 out (result) 1101 out (result)
1107 { 1102 {
1108 auto sizeelem = ti.next.tsize(); // array element size 1103 auto sizeelem = ti.next.tsize(); // array element size
1109 assert(memcmp(result.ptr, a.ptr, a.length * sizeelem) == 0); 1104 assert(memcmp(result.ptr, a.ptr, a.length * sizeelem) == 0);
1110 } 1105 }
1111 body 1106 body
1112 { 1107 {
1113 Array2 r; 1108 void* ptr;
1114 1109
1115 if (a.length) 1110 if (a.length)
1116 { 1111 {
1117 auto sizeelem = ti.next.tsize(); // array element size 1112 auto sizeelem = ti.next.tsize(); // array element size
1118 auto size = a.length * sizeelem; 1113 auto size = a.length * sizeelem;
1119 r.ptr = gc_malloc(size, !(ti.next.flags() & 1) ? BlkAttr.NO_SCAN : 0); 1114 ptr = gc_malloc(size, !(ti.next.flags() & 1) ? BlkAttr.NO_SCAN : 0);
1120 r.length = a.length; 1115 memcpy(ptr, a.ptr, size);
1121 memcpy(r.ptr, a.ptr, size); 1116 }
1122 } 1117 return ptr[0 .. a.length];
1123 return r;
1124 } 1118 }
1125 1119
1126 1120
1127 unittest 1121 unittest
1128 { 1122 {