[commit: ghc] master: Comments only: Trac #14511 (b6428af)

git at git.haskell.org git at git.haskell.org
Wed Nov 29 17:05:58 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b6428af8760737975f9b2959f9536c0404d636ec/ghc

>---------------------------------------------------------------

commit b6428af8760737975f9b2959f9536c0404d636ec
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Nov 28 16:02:18 2017 +0000

    Comments only: Trac #14511


>---------------------------------------------------------------

b6428af8760737975f9b2959f9536c0404d636ec
 compiler/simplCore/FloatIn.hs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/compiler/simplCore/FloatIn.hs b/compiler/simplCore/FloatIn.hs
index af3ad7f..6fae6b9 100644
--- a/compiler/simplCore/FloatIn.hs
+++ b/compiler/simplCore/FloatIn.hs
@@ -415,6 +415,16 @@ But there are wrinkles
   cases like Trac #5658.   This is implemented in sepBindsByJoinPoint;
   if is_case is False we dump all floating cases right here.
 
+* Trac #14511 is another example of why we want to restrict float-in
+  of case-expressions.  Consider
+     case indexArray# a n of (# r #) -> writeArray# ma i (f r)
+  Now, floating that indexing operation into the (f r) thunk will
+  not create any new thunks, but it will keep the array 'a' alive
+  for much longer than the programmer expected.
+
+  So again, not floating a case into a let or argument seems like
+  the Right Thing
+
 For @Case@, the possible drop points for the 'to_drop'
 bindings are:
   (a) inside the scrutinee



More information about the ghc-commits mailing list