The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use Strict bindings when simplifying Lstaticraise (#8559)

Alias bindings were used before, but as #8558 shows this can be incorrect,
as the argument to `Lstaticraise` may be impure.

Adds a regression test.

Closes: #8558

authored by

Alain Frisch and committed by
Xavier Leroy
e350ebd7 c7534721

+11 -2
+1 -1
Changes
··· 536 536 - #1917: comballoc: ensure object allocation order is preserved 537 537 (Stephen Dolan) 538 538 539 - - #6242, #2143: optimize some local functions 539 + - #6242, #2143, #8558, #8559: optimize some local functions 540 540 (Alain Frisch, review by Gabriel Scherer) 541 541 542 542 - #2082: New options [-insn-sched] and [-no-insn-sched] to control
+1 -1
bytecomp/simplif.ml
··· 282 282 xs ys Ident.Map.empty 283 283 in 284 284 List.fold_right2 285 - (fun (y, kind) l r -> Llet (Alias, kind, y, l, r)) 285 + (fun (y, kind) l r -> Llet (Strict, kind, y, l, r)) 286 286 ys ls (Lambda.rename env handler) 287 287 with 288 288 | Not_found -> Lstaticraise (i,ls)
+9
testsuite/tests/basic/localfunction.ml
··· 21 21 Printf.printf "%i\n%!" !r; 22 22 assert(x1 -. x0 = x2 -. x1) 23 23 (* check that we did not allocated anything between x1 and x2 *) 24 + 25 + 26 + let () = 27 + (* #8558 *) 28 + let f () = () in 29 + let r = ref 0 in 30 + let g () = f (incr r) in 31 + g (); 32 + assert (!r = 1)