summaryrefslogtreecommitdiff
path: root/typd_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 /typd_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 'typd_mlc.c')
-rw-r--r--typd_mlc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/typd_mlc.c b/typd_mlc.c
index 823447b0..eb40b0e7 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -326,6 +326,8 @@ GC_make_sequence_descriptor(complex_descriptor *first,
result -> sd_first = first;
result -> sd_second = second;
GC_dirty(result);
+ REACHABLE_AFTER_DIRTY(first);
+ REACHABLE_AFTER_DIRTY(second);
}
return((complex_descriptor *)result);
}
@@ -604,6 +606,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_explicitly_typed(size_t lb,
lg = BYTES_TO_GRANULES(GC_size(op));
op[GRANULES_TO_WORDS(lg) - 1] = d;
GC_dirty(op + GRANULES_TO_WORDS(lg) - 1);
+ REACHABLE_AFTER_DIRTY(d);
return op;
}
@@ -645,6 +648,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
}
((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
GC_dirty(op + GRANULES_TO_WORDS(lg) - 1);
+ REACHABLE_AFTER_DIRTY(d);
return op;
}
@@ -699,6 +703,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,
op[lw - 1] = (word)complex_descr;
GC_dirty(op + lw - 1);
+ REACHABLE_AFTER_DIRTY(complex_descr);
+
/* Make sure the descriptor is cleared once there is any danger */
/* it may have been collected. */
if (EXPECT(GC_general_register_disappearing_link(