Opened 3 years ago

Last modified 2 years ago

#13219 new bug

CSE for join points

Reported by: lukemaurer Owned by: lukemaurer
Priority: normal Milestone:
Component: Compiler Version: 8.1
Keywords: JoinPoints, CSE Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Join points are hazardous for CSE:

join j = e in ... f e ...

The temptation is of course to rewrite to

join j = e in ... f (jump j) ...

which doesn't typecheck because you can't have a jump in an argument.

Similarly:

join j x = e in
let y = (... join j2 x = e in ...) in ...

can't be rewritten to

join j x = e in
let y = (... join j2 x = jump j x ...) in ...

because you can't jump out of a value binding.

This doesn't seem to come up very often (took a long time for me to trip over it). The simple solution is simply to ignore CSE for join points. That's what we do at the moment. But this is saddening in some cases:

join j x = e in
join j2 x = e in ...

can perfectly well become

join j x = e in
join j2 x = jump j x in ...

We just need to track which join points are still currently valid.

Change History (2)

comment:1 Changed 3 years ago by simonpj

We just need to track which join points are still currently valid.

Yes, and that would not be hard. Just keep a join-point reverse map in the CSEnv, alongside the existing cs_map; and discard it when going into non-tail positions.

A relatively easy win, but as you say a modest one.

comment:2 Changed 2 years ago by ezyang

Keywords: CSE added
Note: See TracTickets for help on using tickets.