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

Changeset 2020

Show
Ignore:
Timestamp:
04/11/07 14:41:13 (2 years ago)
Author:
sean
Message:

Merged in DMD 1.011 changes. These are just some minor bugfixes for existing functionality, so these libraries are compatible with DMD 1.010 as well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/compiler/dmd/lifetime.d

    r1971 r2020  
    785785 
    786786    *cast(size_t *)&x = newlength; 
    787     (cast(byte *)x)[length * sizeelem .. newsize] = argp[0 .. sizeelem]; 
     787    x.ptr[length * sizeelem .. newsize] = argp[0 .. sizeelem]; 
    788788    assert((cast(size_t)x.ptr & 15) == 0); 
    789789    assert(gc_sizeOf(x.ptr) > x.length * sizeelem); 
  • trunk/lib/compiler/gdc/lifetime.d

    r1971 r2020  
    786786  L1: 
    787787    *cast(size_t *)&x = newlength; 
    788     (cast(byte *)x)[length * sizeelem .. newsize] = (cast(byte*)argp)[0 .. sizeelem]; 
     788    x.ptr[length * sizeelem .. newsize] = argp[0 .. sizeelem]; 
    789789    assert((cast(size_t)x.ptr & 15) == 0); 
    790790    assert(gc_sizeOf(x.ptr) > x.length * sizeelem); 
  • trunk/lib/gc/basic/gcx.d

    r1971 r2020  
    9494        extern (C) void thread_scanAll( scanFn fn, void* curStackTop = null ); 
    9595    } 
     96 
     97    extern (C) void onOutOfMemoryError(); 
    9698} 
    9799 
     
    148150                { 
    149151                    data = cast(Log *)tango.stdc.stdlib.malloc(allocdim * Log.sizeof); 
     152                    if (!data && allocdim) 
     153                        onOutOfMemoryError(); 
    150154                } 
    151155                else 
     
    153157 
    154158                    newdata = cast(Log *)tango.stdc.stdlib.malloc(allocdim * Log.sizeof); 
    155                     assert(newdata); 
     159                    if (!newdata && allocdim) 
     160                        onOutOfMemoryError(); 
    156161                    memcpy(newdata, data, dim * Log.sizeof); 
    157162                    tango.stdc.stdlib.free(data); 
    158163                    data = newdata; 
    159164                } 
    160                 assert(!allocdim || data); 
    161165            } 
    162166        } 
     
    223227        gcLock = GCLock.classinfo; 
    224228        gcx = cast(Gcx *)tango.stdc.stdlib.calloc(1, Gcx.sizeof); 
     229        if (!gcx) 
     230            onOutOfMemoryError(); 
    225231        gcx.initialize(); 
    226232        setStackBottom(cr_stackBottom()); 
     
    14101416 
    14111417            newroots = cast(void **)tango.stdc.stdlib.malloc(newdim * newroots[0].sizeof); 
    1412             assert(newroots); 
     1418            if (!newroots) 
     1419                onOutOfMemoryError(); 
    14131420            if (roots) 
    14141421            {   memcpy(newroots, roots, nroots * newroots[0].sizeof); 
     
    14541461 
    14551462            newranges = cast(Range *)tango.stdc.stdlib.malloc(newdim * newranges[0].sizeof); 
    1456             assert(newranges); 
     1463            if (!newranges) 
     1464                onOutOfMemoryError(); 
    14571465            if (ranges) 
    14581466            {   memcpy(newranges, ranges, nranges * newranges[0].sizeof); 
     
    17071715        if (npages < POOLSIZE/PAGESIZE) 
    17081716            npages = POOLSIZE/PAGESIZE; 
     1717        else if (npages > POOLSIZE/PAGESIZE) 
     1718        {   // Give us 150% of requested size, so there's room to extend 
     1719            auto n = npages + (npages >> 1); 
     1720            if (n < size_t.max/PAGESIZE) 
     1721                npages = n; 
     1722        } 
    17091723 
    17101724        // Allocate successively larger pools up to 8 megs 
     
    24582472 
    24592473        pagetable = cast(ubyte*)tango.stdc.stdlib.malloc(npages); 
     2474        if (!pagetable) 
     2475            onOutOfMemoryError(); 
    24602476        memset(pagetable, B_UNCOMMITTED, npages); 
    24612477