Skip to content

Commit bf509d2

Browse files
committed
Don't make finaliser updates dependent on work being available.
1 parent 17d14fa commit bf509d2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

runtime/major_gc.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,8 +1985,15 @@ static void major_collection_slice(intnat howmuch,
19851985

19861986
if (mode != Slice_opportunistic && caml_marking_started()) {
19871987
/* Finalisers */
1988+
1989+
/* TODO: various improvement work here:
1990+
* - updating finalisers should be made incremental;
1991+
* - we should measure and account for the work of it against our work meters.
1992+
* - but until it is made incremental we can't gate it on having work available
1993+
* because we have to do it (and therefore advance the phase) even in domains
1994+
* which don't allocate. */
1995+
19881996
if (caml_gc_phase == Phase_mark_final &&
1989-
get_major_slice_work(mode) > 0 &&
19901997
caml_final_update_first(domain_state)) {
19911998
/* This domain has updated finalise first values */
19921999
(void)caml_atomic_counter_decr(&num_domains_to_final_update_first);
@@ -1995,8 +2002,9 @@ static void major_collection_slice(intnat howmuch,
19952002
goto mark_again;
19962003
}
19972004

2005+
/* TODO finaliser improvement work as listed above. */
2006+
19982007
if (caml_gc_phase == Phase_sweep_ephe &&
1999-
get_major_slice_work(mode) > 0 &&
20002008
caml_final_update_last(domain_state)) {
20012009
/* This domain has updated finalise last values */
20022010
(void)caml_atomic_counter_decr(&num_domains_to_final_update_last);
@@ -2092,6 +2100,9 @@ static void major_collection_slice(intnat howmuch,
20922100
}
20932101

20942102
/* Complete GC phase */
2103+
2104+
/* TODO: move this outside the containing if so that it's possible
2105+
* in opportunistic slices? */
20952106
if (is_complete_phase_sweep_and_mark_main() ||
20962107
is_complete_phase_mark_final ()) {
20972108
CAMLassert (caml_gc_phase != Phase_sweep_ephe);

0 commit comments

Comments
 (0)