Loop optimisation with identical counters
marlowsd at gmail.com
Wed Nov 10 11:43:05 EST 2010
On 08/11/2010 15:44, Max Bolingbroke wrote:
> On 6 November 2010 04:47, David Peixotto<dmp at rice.edu> wrote:
>>> Are you sure about R1 aliasing Sp? AFAIK, R1 points to a closure on the heap, not to a stack location. That is, it can alias pointers on the stack or Hp but it can't alias the Sp itself. I don't think Sp can be aliased by anything outside of the garbage collector.
>>> Perhaps we shouldn't mark Hp as noalias, though.
>> Well, I'm not sure about R1 aliasing with Sp. I thought that there could be some cases where closures are allocated on the stack, but I could be wrong. I think the stack should still be reachable by the garbage collector though. Can someone more familiar with GHC internals say whether R1 could point to the stack as well as the heap?
> GHC marks some closures as "let-no-escapes" which means that they get
> stack allocated. So AFAIK R1 may alias pointers based on SP.
There isn't really a "stack allocated closure" for a let-no-escape, we
just explain it like that because it is notionally what is going on.
The implementation actually treats them more like case continuations
where the free variables have been saved on the stack.
R1 is used as an argument register for let-no-escapes, in fact.
So I think the original conclusion was right - R1 doesn't alias with the
More information about the Glasgow-haskell-users