···11891189- #14287: Bugfix for GC root mishandling in memprof.c
11901190 (Stephen Dolan, review by Leo White)
1191119111921192+- #14368: Bugfix for Simplif substituting under lambda
11931193+ (Stephen Dolan, review by Vincent Laviron
11941194+ and Gabriel Scherer)
11951195+11921196OCaml 5.3.0 (8 January 2025)
11931197----------------------------
11941198
+6-3
lambda/simplif.ml
···417417 end
418418 | _ -> no_opt ()
419419 end
420420- | Lfunction {body} ->
421421- count Ident.Map.empty body
420420+ | Lfunction fn ->
421421+ count_lfunction fn
422422 | Llet(_str, _k, v, Lvar w, l2) when optimize ->
423423 (* v will be replaced by w in l2, so each occurrence of v in l2
424424 increases w's refcount *)
···432432 count bv l1;
433433 count bv l2
434434 | Lletrec(bindings, body) ->
435435- List.iter (fun { def } -> count bv def.body) bindings;
435435+ List.iter (fun { def } -> count_lfunction def) bindings;
436436 count bv body
437437 | Lprim(_p, ll, _) -> List.iter (count bv) ll
438438 | Lswitch(l, sw, _loc) ->
···467467 | Levent(l, _) -> count bv l
468468 | Lifused(v, l) ->
469469 if count_var v > 0 then count bv l
470470+471471+ and count_lfunction fn =
472472+ count Ident.Map.empty fn.body
470473471474 and count_default bv sw = match sw.sw_failaction with
472475 | None -> ()
···11+(* TEST *)
22+33+let f () =
44+ let junk = ref 42 in
55+ Gc.finalise_last (fun () -> print_endline "collected") junk;
66+ let tuple = Sys.opaque_identity (junk, "ok") in
77+ match tuple with
88+ | _, ok ->
99+ let rec loop () =
1010+ print_endline ok;
1111+ if false then loop ()
1212+ in
1313+ loop
1414+1515+let () =
1616+ let fn = f () in
1717+ Gc.full_major ();
1818+ fn ()