OCamlPro / flambda-task-force

13 stars 1 forks source link

More precise ref_to_var #151

Open chambart opened 8 years ago

chambart commented 8 years ago

A bit smarter ref_to_var pass could get rid of the block allocations in:

let f a b =
  let r = ref (a, b) in
  while true do
    ...
    let (x, y) = !r in
    ...
    r := (x', y')
  done

It may be possible to do some more for non tag 0 blocks, but this involves adding a new primitive for allocating a block with a not statically known tag.

Another way to do that may be to go the CPS way and do the optimisation on that representation.

mshinwell commented 8 years ago

That new primitive might cause problems for Spacetime, if we extend the profinfo space by assuming that blocks with different tags were allocated at different locations.