-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Greetings from Sweden and Chalmers University of Technology!
I may have found something when exploring parallel arrays in Manticore. Here is a piece of code that works perfectly fine:
fun f n = if n <= 0 then 0 else 1 + f (n - 1)
val xs = [ 1, 2, 3 ]
val _ = map f xsHere is a similar program with a parallel array and PArray.map instead of a list and the regular map:
(* f same as before *)
val xs = PArray.fromRope (Rope.tabulateSequential (fn x => x) (1, 3))
val _ = PArray.map (fn x => f x) xsThat code also works. But watch what happens when I eta-reduce the mapped function:
val _ = PArray.map f xsThe code doesn't compile anymore:
$ pmlc eta.pml
***** Bogus CPS in Main after inline *****
** unbound variable f<11431>#4.4
** unbound variable f<11431>#4.4 in Apply
** unbound variable f<11431>#4.4
** unbound variable f<11431>#4.4 in Apply
broken CPS dumped to broken-CPS
The dumped file is 1.7 MB, but I can't really extract any useful information from it.
It also turns out that everything works fine if f is not recursive:
fun f n = if n <= 0 then 0 else 1
val xs = PArray.fromRope (Rope.tabulateSequential (fn x => x) (1, 3))
val _ = PArray.map f xsI'm not an expert, but there seems to be something going on here. What do you think?