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.
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.
A bit smarter ref_to_var pass could get rid of the block allocations in:
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.