Plain Text Paste by wm4
Description: None
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | diff --git a/tango/core/rt/compiler/dmd/rt/lifetime.d b/tango/core/rt/compiler/dmd/rt/lifetime.d index fd89ce7..c73c7da 100644 --- a/tango/core/rt/compiler/dmd/rt/lifetime.d +++ b/tango/core/rt/compiler/dmd/rt/lifetime.d @@ -746,7 +746,11 @@ extern (C) long _d_arrayappendT(TypeInfo ti, Array *px, byte[] y) goto L1; } } - newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr); memcpy(newdata, px.data, length * sizeelem); px.data = newdata; } @@ -847,7 +851,11 @@ extern (C) byte[] _d_arrayappendcT(TypeInfo ti, ref byte[] x, ...) debug(PRINTF) printf("_d_arrayappendcT(length = %d, newlength = %d, cap = %d)\n", length, newlength, info.size); auto newcap = newCapacity(newlength, sizeelem); assert(newcap >= newlength * sizeelem); - newdata = cast(byte *)gc_malloc(newcap + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newcap + 1, attr); memcpy(newdata, x.ptr, length * sizeelem); (cast(void**)(&x))[1] = newdata; } diff --git a/tango/core/rt/compiler/gdc/lifetime.d b/tango/core/rt/compiler/gdc/lifetime.d index 9e3da08..5d1e28e 100644 --- a/tango/core/rt/compiler/gdc/lifetime.d +++ b/tango/core/rt/compiler/gdc/lifetime.d @@ -753,7 +753,11 @@ extern (C) Array _d_arrayappendT(TypeInfo ti, Array *px, byte[] y) goto L1; } } - newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr); memcpy(newdata, px.data, length * sizeelem); px.data = newdata; } @@ -853,7 +857,11 @@ extern (C) byte[] _d_arrayappendcTp(TypeInfo ti, ref byte[] x, void *argp) debug(PRINTF) printf("_d_arrayappendcTp(length = %d, newlength = %d, cap = %d)\n", length, newlength, info.size); auto newcap = newCapacity(newlength, sizeelem); assert(newcap >= newlength * sizeelem); - newdata = cast(byte *)gc_malloc(newcap + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newcap + 1, attr); memcpy(newdata, x.ptr, length * sizeelem); (cast(void**)(&x))[1] = newdata; } diff --git a/tango/core/rt/compiler/ldc/rt/lifetime.d b/tango/core/rt/compiler/ldc/rt/lifetime.d index 592766b..473eeb1 100644 --- a/tango/core/rt/compiler/ldc/rt/lifetime.d +++ b/tango/core/rt/compiler/ldc/rt/lifetime.d @@ -776,7 +776,11 @@ extern (C) long _d_arrayappendT(TypeInfo ti, Array *px, byte[] y) goto L1; } } - newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr); memcpy(newdata, px.data, length * sizeelem); px.data = newdata; } @@ -879,7 +883,11 @@ extern (C) byte[] _d_arrayappendcT(TypeInfo ti, void* array, void* element) debug(PRINTF) printf("_d_arrayappendcT(length = %d, newlength = %d, cap = %d)\n", length, newlength, info.size); auto newcap = newCapacity(newlength, sizeelem); assert(newcap >= newlength * sizeelem); - newdata = cast(byte *)gc_malloc(newcap + 1, info.attr); + uint attr = info.attr; + // If this is the first allocation, set the NO_SCAN attribute appropriately + if (info.base is null && ti.next.flags() == 0) + attr = BlkAttr.NO_SCAN; + newdata = cast(byte *)gc_malloc(newcap + 1, attr); memcpy(newdata, x.ptr, length * sizeelem); (cast(void**)x)[1] = newdata; } |