re PR go/78789 (Error: no such instruction: `aesenc %xmm0,%xmm2' when compiling libgo...
[gcc.git] / libgo / runtime / mfixalloc.c
index 6e4f0c6e6071376f4ee66f1590029194bb2a7254..9d0b3bbda7e8f9c7adfe43681464c513d42d2fdb 100644 (file)
 // Initialize f to allocate objects of the given size,
 // using the allocator to obtain chunks of memory.
 void
-runtime_FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr), void (*first)(void*, byte*), void *arg)
+runtime_FixAlloc_Init(FixAlloc *f, uintptr size, void (*first)(void*, byte*), void *arg, uint64 *stat)
 {
        f->size = size;
-       f->alloc = alloc;
        f->first = first;
        f->arg = arg;
        f->list = nil;
        f->chunk = nil;
        f->nchunk = 0;
        f->inuse = 0;
-       f->sys = 0;
+       f->stat = stat;
 }
 
 void*
@@ -43,10 +42,7 @@ runtime_FixAlloc_Alloc(FixAlloc *f)
                return v;
        }
        if(f->nchunk < f->size) {
-               f->sys += FixAllocChunk;
-               f->chunk = f->alloc(FixAllocChunk);
-               if(f->chunk == nil)
-                       runtime_throw("out of memory (FixAlloc)");
+               f->chunk = runtime_persistentalloc(FixAllocChunk, 0, f->stat);
                f->nchunk = FixAllocChunk;
        }
        v = f->chunk;