Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2001-08-20 16:50:13 by simonpj] · 0c190d9e
    Simon Peyton Jones authored
    -------------------------------------
    	Make NOINLINE zap the strictness info
    	-------------------------------------
    
    Make a NOINLINE pragma zap strictness information.
    Reasons given in the WorkWrap comment:
    
    	-- Furthermore, zap the strictess info in the Id.  Why?  Because
    	-- the NOINLINE says "don't expose any of the inner workings at the call
    	-- site" and the strictness is certainly an inner working.
    	--
    	-- More concretely, the demand analyser discovers the following strictness
    	-- for unsafePerformIO:  C(U(AV))
    	-- But then consider
    	--	unsafePerformIO (\s -> let r = f x in
    	--			       case writeIORef v r s of (# s1, _ #) ->
    	--			       (# s1, r #)
    	-- The strictness analyser will find that the binding for r is strict,
    	-- (becuase of uPIO's strictness sig), and so it'll evaluate it before
    	-- doing the writeIORef.  This actually makes tests/lib/should_run/memo002
    	-- get a deadlock!
    	--
    	-- Solution: don't expose the strictness of unsafePerformIO.
    
    This fixes the memo002 deadlock.
    0c190d9e