diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2013-12-15 20:36:45 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-12-15 20:36:45 +0400 |
commit | 32b12154933124a899dae65c1e2a993e814e60c1 (patch) | |
tree | f6c90428733d224351f7ea83fce77e57f7892bb2 /alloc.c | |
parent | fae0f4b8139040c77d54449d976276bc53653990 (diff) | |
download | bdwgc-32b12154933124a899dae65c1e2a993e814e60c1.tar.gz |
Remove 'opp' local variable in GC_malloc_X
(code refactoring)
* alloc.c: Update comment (about free lists).
* fnlz_mlc.c (GC_finalized_malloc): Remove "opp" local variable
(replace *opp with <kind>freelist[lg]).
* gcj_mlc.c (GC_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise.
* malloc.c (GC_malloc_atomic, GC_malloc, GC_malloc_uncollectable):
Likewise.
* mallocx.c (GC_malloc_atomic_uncollectable): Likewise.
* typd_mlc.c (GC_malloc_explicitly_typed,
GC_malloc_explicitly_typed_ignore_off_page,
GC_calloc_explicitly_typed): Likewise.
Diffstat (limited to 'alloc.c')
-rw-r--r-- | alloc.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -32,12 +32,15 @@ * kind k objects of size i points to a non-empty * free list. It returns a pointer to the first entry on the free list. * In a single-threaded world, GC_allocobj may be called to allocate - * an object of (small) size i as follows: + * an object of (small) size lb as follows: * - * opp = &(GC_objfreelist[i]); - * if (*opp == 0) GC_allocobj(i, NORMAL); - * ptr = *opp; - * *opp = obj_link(ptr); + * lg = GC_size_map[lb]; + * op = GC_objfreelist[lg]; + * if (NULL == op) { + * op = GENERAL_MALLOC(lb, NORMAL); + * } else { + * GC_objfreelist[lg] = obj_link(op); + * } * * Note that this is very fast if the free list is non-empty; it should * only involve the execution of 4 or 5 simple instructions. |