Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1971: arrayappend.patch

File arrayappend.patch, 4.6 kB (added by llucax, 9 years ago)

Patch agains Tango 0.99.9

  • a/tango/core/rt/compiler/dmd/rt/lifetime.d

    old new  
    779779        version (D_HavePointerMap) { 
    780780            pm = ti.next.pointermap(); 
    781781        } 
    782         newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr, pm); 
     782        uint attr = info.attr; 
     783        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     784        if (info.base is null && ti.next.flags() == 0) 
     785            attr = BlkAttr.NO_SCAN; 
     786        newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr, pm); 
    783787        memcpy(newdata, px.data, length * sizeelem); 
    784788        px.data = newdata; 
    785789    } 
     
    884888        version (D_HavePointerMap) { 
    885889            pm = ti.next.pointermap(); 
    886890        } 
    887         newdata = cast(byte *)gc_malloc(newcap + 1, info.attr, pm); 
     891        uint attr = info.attr; 
     892        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     893        if (info.base is null && ti.next.flags() == 0) 
     894            attr = BlkAttr.NO_SCAN; 
     895        newdata = cast(byte *)gc_malloc(newcap + 1, attr, pm); 
    888896        memcpy(newdata, x.ptr, length * sizeelem); 
    889897        (cast(void**)(&x))[1] = newdata; 
    890898    } 
  • a/tango/core/rt/compiler/gdc/lifetime.d

    old new  
    753753                goto L1; 
    754754            } 
    755755        } 
    756         newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr); 
     756        uint attr = info.attr; 
     757        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     758        if (info.base is null && ti.next.flags() == 0) 
     759            attr = BlkAttr.NO_SCAN; 
     760        newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr); 
    757761        memcpy(newdata, px.data, length * sizeelem); 
    758762        px.data = newdata; 
    759763    } 
     
    853857        debug(PRINTF) printf("_d_arrayappendcTp(length = %d, newlength = %d, cap = %d)\n", length, newlength, info.size); 
    854858        auto newcap = newCapacity(newlength, sizeelem); 
    855859        assert(newcap >= newlength * sizeelem); 
    856         newdata = cast(byte *)gc_malloc(newcap + 1, info.attr); 
     860        uint attr = info.attr; 
     861        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     862        if (info.base is null && ti.next.flags() == 0) 
     863            attr = BlkAttr.NO_SCAN; 
     864        newdata = cast(byte *)gc_malloc(newcap + 1, attr); 
    857865        memcpy(newdata, x.ptr, length * sizeelem); 
    858866        (cast(void**)(&x))[1] = newdata; 
    859867    } 
  • a/tango/core/rt/compiler/ldc/rt/lifetime.d

    old new  
    776776                goto L1; 
    777777            } 
    778778        } 
    779         newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, info.attr); 
     779        uint attr = info.attr; 
     780        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     781        if (info.base is null && ti.next.flags() == 0) 
     782            attr = BlkAttr.NO_SCAN; 
     783        newdata = cast(byte *)gc_malloc(newCapacity(newlength, sizeelem) + 1, attr); 
    780784        memcpy(newdata, px.data, length * sizeelem); 
    781785        px.data = newdata; 
    782786    } 
     
    877881        debug(PRINTF) printf("_d_arrayappendcT(length = %d, newlength = %d, cap = %d)\n", length, newlength, info.size); 
    878882        auto newcap = newCapacity(newlength, sizeelem); 
    879883        assert(newcap >= newlength * sizeelem); 
    880         newdata = cast(byte *)gc_malloc(newcap + 1, info.attr); 
     884        uint attr = info.attr; 
     885        // If this is the first allocation, set the NO_SCAN attribute appropriately 
     886        if (info.base is null && ti.next.flags() == 0) 
     887            attr = BlkAttr.NO_SCAN; 
     888        newdata = cast(byte *)gc_malloc(newcap + 1, attr); 
    881889        memcpy(newdata, x.ptr, length * sizeelem); 
    882890        (cast(void**)(&x))[1] = newdata; 
    883891    }