diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2015-07-17 14:31:05 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2015-07-17 14:31:05 +0000 |
commit | 860c670848440f791d1b9c68a1ace8fb629da234 (patch) | |
tree | 6b856e6a04cf876221c6740e8df75a8778a3b8b7 /byterun/minor_gc.c | |
parent | 7fdba8f53360d9355dc96953a0d8225e111ab722 (diff) | |
download | ocaml-860c670848440f791d1b9c68a1ace8fb629da234.tar.gz |
merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/minor_gc.c')
-rw-r--r-- | byterun/minor_gc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/byterun/minor_gc.c b/byterun/minor_gc.c index ec468560e1..079e686683 100644 --- a/byterun/minor_gc.c +++ b/byterun/minor_gc.c @@ -227,8 +227,11 @@ void caml_oldify_mopup (void) void caml_empty_minor_heap (void) { value **r; + uintnat prev_alloc_words; if (caml_young_ptr != caml_young_end){ + if (caml_minor_gc_begin_hook != NULL) (*caml_minor_gc_begin_hook) (); + prev_alloc_words = caml_allocated_words; caml_in_minor_collection = 1; caml_gc_message (0x02, "<", 0); caml_oldify_local_roots(); @@ -253,8 +256,13 @@ void caml_empty_minor_heap (void) clear_table (&caml_weak_ref_table); caml_gc_message (0x02, ">", 0); caml_in_minor_collection = 0; + caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; + ++ caml_stat_minor_collections; + caml_final_empty_young (); + if (caml_minor_gc_end_hook != NULL) (*caml_minor_gc_end_hook) (); + }else{ + caml_final_empty_young (); } - caml_final_empty_young (); #ifdef DEBUG { value *p; @@ -272,16 +280,14 @@ void caml_empty_minor_heap (void) */ CAMLexport void caml_minor_collection (void) { - intnat prev_alloc_words = caml_allocated_words; - caml_empty_minor_heap (); - caml_stat_promoted_words += caml_allocated_words - prev_alloc_words; - ++ caml_stat_minor_collections; caml_major_collection_slice (0); caml_force_major_slice = 0; + if (caml_finalise_begin_hook != NULL) (*caml_finalise_begin_hook) (); caml_final_do_calls (); + if (caml_finalise_end_hook != NULL) (*caml_finalise_end_hook) (); caml_empty_minor_heap (); } |