From 8756d8f68492e7a670806e3370afd0d41e640be1 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 5 Jul 2020 15:32:37 -0700 Subject: [PATCH] remove unused vmcompact API --- lib/vmalloc/vmalloc.h | 3 -- lib/vmalloc/vmbest.c | 69 ------------------------------------------- 2 files changed, 72 deletions(-) diff --git a/lib/vmalloc/vmalloc.h b/lib/vmalloc/vmalloc.h index 5e7dc3c70..eedd1749b 100644 --- a/lib/vmalloc/vmalloc.h +++ b/lib/vmalloc/vmalloc.h @@ -63,7 +63,6 @@ extern "C" { int (*freef) (Vmalloc_t *, void *); long (*addrf) (Vmalloc_t *, void *); long (*sizef) (Vmalloc_t *, void *); - int (*compactf) (Vmalloc_t *); void *(*alignf) (Vmalloc_t *, size_t, size_t); unsigned short meth; }; @@ -113,7 +112,6 @@ extern "C" { extern Vmalloc_t *vmopen(Vmdisc_t *, Vmethod_t *, int); extern int vmclose(Vmalloc_t *); extern int vmclear(Vmalloc_t *); - extern int vmcompact(Vmalloc_t *); extern void *vmalloc(Vmalloc_t *, size_t); extern void *vmalign(Vmalloc_t *, size_t, size_t); @@ -160,7 +158,6 @@ extern "C" { #endif #define vmaddr(vm,addr) (*(_VM_(vm)->meth.addrf))((vm),(void*)(addr)) #define vmsize(vm,addr) (*(_VM_(vm)->meth.sizef))((vm),(void*)(addr)) -#define vmcompact(vm) (*(_VM_(vm)->meth.compactf))((vm)) #define vmoldof(v,p,t,n,x) (t*)vmresize((v), (p), sizeof(t)*(n)+(x), \ (VM_RSMOVE) ) #define vmnewof(v,p,t,n,x) (t*)vmresize((v), (p), sizeof(t)*(n)+(x), \ diff --git a/lib/vmalloc/vmbest.c b/lib/vmalloc/vmbest.c index 840be05d3..bcadc2a48 100644 --- a/lib/vmalloc/vmbest.c +++ b/lib/vmalloc/vmbest.c @@ -924,73 +924,6 @@ static long bestsize(Vmalloc_t * vm, void * addr) return size; } -static int bestcompact(Vmalloc_t * vm) -{ - reg Seg_t *seg, *next; - reg Block_t *bp, *t; - reg size_t size, segsize; - reg Vmdata_t *vd = vm->data; - - if (!(vd->mode & VM_TRUST)) { - if (ISLOCK(vd, 0)) - return -1; - SETLOCK(vd, 0); - } - - bestreclaim(vd, NIL(Block_t *), 0); - /**/ ASSERT(!vd->root || vmchktree(vd->root)); - - for (seg = vd->seg; seg; seg = next) { - next = seg->next; - - bp = BLOCK(seg->baddr); - if (!ISPFREE(SIZE(bp))) - continue; - - bp = LAST(bp); - /**/ ASSERT(!ISBUSY(SIZE(bp)) && vmisfree(vd, bp)); - size = SIZE(bp); - if (bp == vd->wild) - vd->wild = NIL(Block_t *); - else - REMOVE(vd, bp, INDEX(size), t, bestsearch); - CLRPFREE(SIZE(NEXT(bp))); - - if (size < (segsize = seg->size)) - size += sizeof(Head_t); - - if ((*_Vmtruncate) (vm, seg, size, 1) >= 0) { - if (size >= segsize) /* entire segment deleted */ - continue; - - if ((size = - (seg->baddr - ((Vmuchar_t *) bp) - sizeof(Head_t))) > 0) - SIZE(bp) = size - sizeof(Head_t); - else - bp = NIL(Block_t *); - } - /**/ ASSERT(!vd->root || vmchktree(vd->root)); - - if (bp) { - /**/ ASSERT(SIZE(bp) >= TINYSIZE); - /**/ ASSERT(SEGWILD(bp)); - /**/ ASSERT(!vd->root || !vmintree(vd->root, bp)); - SIZE(bp) |= BUSY | JUNK; - LINK(bp) = CACHE(vd)[C_INDEX(SIZE(bp))]; - CACHE(vd)[C_INDEX(SIZE(bp))] = bp; - } - /**/ ASSERT(!vd->root || vmchktree(vd->root)); - } - /**/ ASSERT(!vd->root || vmchktree(vd->root)); - - if (_Vmtrace && (vd->mode & VM_TRACE) && VMETHOD(vd) == VM_MTBEST) - (*_Vmtrace) (vm, (Vmuchar_t *) 0, (Vmuchar_t *) 0, 0, 0); - - CLRLOCK(vd, 0); - - return 0; -} - static void *bestalign(Vmalloc_t * vm, size_t size, size_t align) { reg Vmuchar_t *data; @@ -1148,7 +1081,6 @@ static Vmethod_t _Vmbest = { bestfree, bestaddr, bestsize, - bestcompact, bestalign, VM_MTBEST }; @@ -1169,7 +1101,6 @@ static Vmalloc_t _Vmheap = { bestfree, bestaddr, bestsize, - bestcompact, bestalign, VM_MTBEST}, NIL(char *), /* file */ -- 2.40.0