summaryrefslogtreecommitdiff
path: root/gcj_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-06-23 00:42:30 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-06-23 00:42:30 +0300
commit8eb6f8d93fe7cb922969e47ec343e8dafb5cbb2b (patch)
tree11a28095ff6701fe4d387c726fd9f46daa6f7850 /gcj_mlc.c
parent263ffbbfd303ac0a62e272ff23baa04139f2009b (diff)
downloadbdwgc-8eb6f8d93fe7cb922969e47ec343e8dafb5cbb2b.tar.gz
Add GC_reachable_here after GC_dirty in GC source
(fix of commits 73d30d2b4, e5fb574cf) * README.md (Incremental Collection): Add note about bugs caused by a missing GC_reachable_here call. * doc/gcdescr.md (Generational Collection): Mention GC_reachable_here for MANUAL_VDB mode. * finalize.c (GC_register_disappearing_link_inner, GC_register_finalizer_inner): Move GC_dirty(new_dl) call to be before unlocking (so that to ensure no collection occurs between initialization of new_dl and GC_dirty() call). * finalize.c (GC_finalize): Call GC_dirty() immediately after updating GC_fnlz_roots.fo_head (instead of setting needs_barrier) if GC_object_finalized_proc is set. * gcj_mlc.c (GC_gcj_malloc, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Call REACHABLE_AFTER_DIRTY(ptr_to_struct_containing_descr) after GC_dirty(op). * include/gc.h (GC_end_stubborn_change): Mention GC_reachable_here in comment. * include/gc_inline.h (GC_FAST_MALLOC_GRANS): Call GC_reachable_here(next) after GC_end_stubborn_change(my_fl); remove GC_end_stubborn_change() call when a non-pointer is stored to my_fl; remove GC_end_stubborn_change() after GC_generic_malloc_many() call. * include/gc_inline.h (GC_CONS): Call GC_reachable_here for the stored pointers after GC_end_stubborn_change call. * include/private/gc_priv.h (REACHABLE_AFTER_DIRTY): New macro. * mallocx.c [MANUAL_VDB] (GC_generic_malloc_many): If GC_is_heap_ptr(result) then call GC_dirty(result) and REACHABLE_AFTER_DIRTY(op) after storing op pointer. * typd_mlc.c (GC_make_sequence_descriptor): Call REACHABLE_AFTER_DIRTY for the stored pointers after GC_dirty(result). * typd_mlc.c (GC_malloc_explicitly_typed, GC_malloc_explicitly_typed_ignore_off_page, GC_calloc_explicitly_typed): Call REACHABLE_AFTER_DIRTY(d) after GC_dirty(op). * win32_threads.c (GC_CreateThread, GC_beginthreadex, GC_pthread_create): Call REACHABLE_AFTER_DIRTY for the stored pointer after GC_dirty.
Diffstat (limited to 'gcj_mlc.c')
-rw-r--r--gcj_mlc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcj_mlc.c b/gcj_mlc.c
index 14d3813d..56d940fe 100644
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -194,7 +194,8 @@ static void maybe_finalize(void)
*(void **)op = ptr_to_struct_containing_descr;
UNLOCK();
GC_dirty(op);
- return((void *) op);
+ REACHABLE_AFTER_DIRTY(ptr_to_struct_containing_descr);
+ return (void *)op;
}
/* Similar to GC_gcj_malloc, but add debug info. This is allocated */
@@ -226,6 +227,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_gcj_malloc(size_t lb,
result = GC_store_debug_info_inner(result, (word)lb, s, i);
UNLOCK();
GC_dirty(result);
+ REACHABLE_AFTER_DIRTY(ptr_to_struct_containing_descr);
return result;
}
@@ -268,7 +270,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
*(void **)op = ptr_to_struct_containing_descr;
UNLOCK();
GC_dirty(op);
- return((void *) op);
+ REACHABLE_AFTER_DIRTY(ptr_to_struct_containing_descr);
+ return (void *)op;
}
#endif /* GC_GCJ_SUPPORT */