diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2020-07-18 11:28:26 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2020-07-18 11:28:26 +0300 |
commit | 4feb966ab9a0767aa7e613a8ffa1f8acc9b01dbf (patch) | |
tree | eebf3002ac92733885bef45088ef370011bb394d /typd_mlc.c | |
parent | 036a3d31935e42b1d1b74785700261b0d39a3456 (diff) | |
download | bdwgc-4feb966ab9a0767aa7e613a8ffa1f8acc9b01dbf.tar.gz |
Remove GC_eobjfreelist variable in typd_mlc.c
(code refactoring)
* typd_mlc.c (GC_eobjfreelist): Remove static variable.
* typd_mlc.c (GC_init_explicit_typing): Do not set GC_eobjfreelist.
* typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page): Define opp
local variable; use GC_obj_kinds[GC_explicit_kind].ok_freelist instead
of GC_eobjfreelist.
Diffstat (limited to 'typd_mlc.c')
-rw-r--r-- | typd_mlc.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -324,8 +324,6 @@ GC_make_sequence_descriptor(complex_descriptor *first, return((complex_descriptor *)result); } -STATIC ptr_t * GC_eobjfreelist = NULL; - STATIC mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env); @@ -338,9 +336,7 @@ STATIC void GC_init_explicit_typing(void) GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0); /* Set up object kind with simple indirect descriptor. */ - GC_eobjfreelist = (ptr_t *)GC_new_free_list_inner(); - GC_explicit_kind = GC_new_kind_inner( - (void **)GC_eobjfreelist, + GC_explicit_kind = GC_new_kind_inner(GC_new_free_list_inner(), (WORDS_TO_BYTES((word)-1) | GC_DS_PER_OBJECT), TRUE, TRUE); /* Descriptors are in the last word of the object. */ @@ -617,10 +613,13 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_ASSERT(GC_explicit_typing_initialized); lb = SIZET_SAT_ADD(lb, TYPD_EXTRA_BYTES); if (SMALL_OBJ(lb)) { + void **opp; + GC_DBG_COLLECT_AT_MALLOC(lb); LOCK(); lg = GC_size_map[lb]; - op = GC_eobjfreelist[lg]; + opp = &GC_obj_kinds[GC_explicit_kind].ok_freelist[lg]; + op = (ptr_t)(*opp); if (EXPECT(0 == op, FALSE)) { UNLOCK(); op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_explicit_kind); @@ -628,7 +627,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL /* See the comment in GC_malloc_explicitly_typed. */ lg = BYTES_TO_GRANULES(GC_size(op)); } else { - GC_eobjfreelist[lg] = (ptr_t)obj_link(op); + *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES((word)lg); UNLOCK(); |