summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2013-12-15 20:36:45 +0400
committerIvan Maidanski <ivmai@mail.ru>2013-12-15 20:36:45 +0400
commit32b12154933124a899dae65c1e2a993e814e60c1 (patch)
treef6c90428733d224351f7ea83fce77e57f7892bb2 /alloc.c
parentfae0f4b8139040c77d54449d976276bc53653990 (diff)
downloadbdwgc-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.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/alloc.c b/alloc.c
index b9039e09..f0b1c11f 100644
--- a/alloc.c
+++ b/alloc.c
@@ -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.