1. 27 Aug, 2001 1 commit
  2. 24 Aug, 2001 8 commits
    • simonmar's avatar
      [project @ 2001-08-24 14:41:09 by simonmar] · 1a1d1118
      simonmar authored
      correct off-by-one error in hGetStringBuffer
      1a1d1118
    • simonpj's avatar
      [project @ 2001-08-24 13:22:25 by simonpj] · 2daf21bb
      simonpj authored
      Make when comparing old and new strictness information,
      we were being a bit too generous with the old case.
      When a function has (say) arity 2, we can't use strictness
      info like SSS, because that only applies if the fn is
      applied to 3 args.  So it's an unfair comparison.
      
      This commit makes the old->new conversion function more
      truthful in this regard, which should eliminate the
      erroneously-claimed "worse" strictness results.
      2daf21bb
    • simonpj's avatar
      [project @ 2001-08-24 13:06:36 by simonpj] · 9c881117
      simonpj authored
      ------------------------------
      	Another demand analyser glitch
      	------------------------------
      
      This fixes, I hope, (in an unsatisfactory way) another demand-analyser
      glitch, that resulted in a runtime "entered absent arg" error.
      
      In DmdAnal.annotateLamIdBndr, we now have:
      
      	-- This gross hack is needed because otherwise we label
      	-- a lambda binder with demand 'B'.  But in terms of calling
      	-- conventions that's Abs, because we don't pass it.  But
      	-- when we do a w/w split we get
      	--	fw x = (\x y:B -> ...) x (error "oops")
      	-- And then the simplifier things the 'B' is a strict demand
      	-- and evaluates the (error "oops").  Sigh
      
      The hack zaps 'B' to 'Abs', just like 'lazify' does.
      
      Need to talk to John about what the principled reasons are.
      9c881117
    • simonpj's avatar
      [project @ 2001-08-24 12:47:04 by simonpj] · 72eec6d6
      simonpj authored
      Improve error message for mis-matched contexts
      72eec6d6
    • simonpj's avatar
      [project @ 2001-08-24 12:45:28 by simonpj] · b55b1f59
      simonpj authored
      Fix an obscure but easy bug in SpecConstr
      b55b1f59
    • rrt's avatar
      [project @ 2001-08-24 09:41:27 by rrt] · 10f01216
      rrt authored
      Remove unused import of DmdType
      10f01216
    • simonpj's avatar
      [project @ 2001-08-24 09:02:39 by simonpj] · c4e2d1f9
      simonpj authored
      Comment only
      c4e2d1f9
    • simonpj's avatar
      [project @ 2001-08-24 07:58:29 by simonpj] · 17985eb4
      simonpj authored
      Improve error message for nullary class
      17985eb4
  3. 23 Aug, 2001 10 commits
    • simonpj's avatar
      [project @ 2001-08-23 16:27:11 by simonpj] · 72126bb9
      simonpj authored
      Fix representation finding for recursive newtypes
      72126bb9
    • simonpj's avatar
      [project @ 2001-08-23 15:06:59 by simonpj] · ae3231c4
      simonpj authored
      remove rnsource.hi-boot-5 (part of prev commit)
      ae3231c4
    • simonpj's avatar
      [project @ 2001-08-23 15:05:52 by simonpj] · f62fd70d
      simonpj authored
      More instance-gate fiddling.  This must be one of the most
      tiremsome bits of the entire compiler, and I appear to be
      incapable of modifying it without getting it wrong at least
      once.
      
      Still, this commit does tidy things up a bit.
      
      * The type renamers (rnHsType, etc) have moved from RnSource
        into a new module RnTypes.
      
      * This breaks a couple of loops, and lets us nuke RnSource.hi-boot.
        Hurrah!
      
      Simon
      f62fd70d
    • rrt's avatar
      [project @ 2001-08-23 12:50:13 by rrt] · b9e2f03d
      rrt authored
      On second thoughts, strip either a backslash or a slash, as if we read
      an environment variable, we may well get a slash in the path; if we
      get a result from GetTempPath, it'll probably have a backslash.
      b9e2f03d
    • rrt's avatar
      [project @ 2001-08-23 12:48:54 by rrt] · 7362ac37
      rrt authored
      Strip a backslash, not a slash.
      7362ac37
    • simonpj's avatar
      [project @ 2001-08-23 09:54:45 by simonpj] · 98bf5734
      simonpj authored
      --------------------------------------------------
      	Be a bit more liberal when slurping instance decls
      	--------------------------------------------------
      
      Functional dependencies have (as usual) made things more complicated
      
      Suppose an interface file contains
      	interface A where
      	  class C a b | a->b where op :: a->b
      	  instance C Foo Baz where ...
      
      Now we are compiling
      	module B where
      	  import A
      	  t = op (v::Foo)
      
      Should we slurp the instance decl, even though Baz is nowhere mentioned
      in module B?  YES!  Because of the fundep, the (C Foo ?) part is enough to
      select this instance decl, and the Baz part follows.
      
      Rather than take fundeps into account "properly", we just slurp
      if C is visible and *any one* of the Names in the types
      This is a slightly brutal approximation, but most instance decls
      are regular H98 ones and it's perfect for them.
      
      Changes:
      
        HscTypes:
      	generalise the types of GatedDecl a bit
      
        RnHiFiles.loadInstDecl, RnHiFiles.loadRule, RnIfaces.selectGated:
      	the meat of the solution
      
        RdrName, OccName etc:
      	some consequential wibbles
      98bf5734
    • simonpj's avatar
      [project @ 2001-08-23 08:43:30 by simonpj] · de568761
      simonpj authored
      -----------------------------------
      	Correct a horrible error in repType
      	-----------------------------------
      
      repType is meant to give the underlying representation of a type.
      But it wasn't taking account of the fact that *recursive* newtypes are
      still represented by a TyConApp.  (Non-recursive ones behave much more
      like type synonyms now.)
      
      As a result, if we have
      
      	newtype F = F (F->F)
      
      then Bad Things happen if we try to seq x::F.  We decide whether to
      push an ordinary return address or a SEQ frame based on the type,
      and repType didn't expose the fact that F is represented by a function type.
      
      Aargh. codeGen/should_run/cg050 now tests for this.
      de568761
    • simonpj's avatar
      [project @ 2001-08-23 08:43:13 by simonpj] · b1045396
      simonpj authored
      Add coment
      b1045396
    • simonpj's avatar
      [project @ 2001-08-23 07:52:32 by simonpj] · 7d474405
      simonpj authored
      Use the unpack strategy!
      7d474405
    • simonpj's avatar
      [project @ 2001-08-23 07:13:16 by simonpj] · 92fbaba6
      simonpj authored
      ------------------------------
      	Improve the demand analyser [case]
      	------------------------------
      
      1. In the Case case of dmdAnal, I dealt with the case binder in a way that
      was both clumsy and pessimistic.  This commit fixes that:
      
      	-- Figure out whether the demand on the case binder is used, and use
      	-- that to set the scrut_dmd.  This is utterly essential.
      	-- Consider	f x = case x of y { (a,b) -> k y a }
      	-- If we just take scrut_demand = U(L,A), then we won't pass x to the
      	-- worker, so the worker will rebuild
      	--	x = (a, absent-error)
      	-- and that'll crash.
      	-- So at one stage I had:
      	--	dead_case_bndr		 = isAbsentDmd (idNewDemandInfo case_bndr')
      	--	keepity | dead_case_bndr = Drop
      	--		| otherwise	 = Keep
      	--
      	-- But then consider
      	--	case x of y { (a,b) -> h y + a }
      	-- where h : U(LL) -> T
      	-- The above code would compute a Keep for x, since y is not Abs, which is silly
      	-- The insight is, of course, that a demand on y is a demand on the
      	-- scrutinee, so we need to `both` it with the scrut demand
      
              scrut_dmd 		 = Seq Drop Now [idNewDemandInfo b | b <- bndrs', isId b]
      				   `both`
      				   idNewDemandInfo case_bndr'
      
      	-- There used to be a special case for when
      	--	ty == TyVarTy tv
      	-- (a not-uncommon case) in which case the substitution was dropped.
      	-- But the type-tidier changes the print-name of a type variable without
      	-- changing the unique, and that led to a bug.   Why?  Pre-tidying, we had
      	-- a type {Foo t}, where Foo is a one-method class.  So Foo is really a newtype.
      	-- And it happened that t was the type variable of the class.  Post-tiding,
      
      
      2. 'defer' can be simplified to 'lub Abs', reducing the number of places
      where things can go wrong.
      
      3. Add comments
      92fbaba6
  4. 22 Aug, 2001 4 commits
  5. 21 Aug, 2001 13 commits
  6. 20 Aug, 2001 4 commits
    • simonpj's avatar
      [project @ 2001-08-20 16:50:13 by simonpj] · 0c190d9e
      simonpj 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
    • simonpj's avatar
      [project @ 2001-08-20 16:48:50 by simonpj] · 01417029
      simonpj authored
      Add assertion
      01417029
    • simonmar's avatar
      [project @ 2001-08-20 16:17:17 by simonmar] · 9035ad45
      simonmar authored
      - be more informative about primitive types: they are identified as
        such, and a declaration is printed out as if the thing was an
        abstract data type (this at least tells you what the arity of the
        tycon is).
      
      - print 'infix 4 elem' as 'infix 4 `elem`'.
      9035ad45
    • simonmar's avatar
      [project @ 2001-08-20 16:15:34 by simonmar] · 5cd52635
      simonmar authored
      Do something vaguely useful in ifaceTyCls when presented with a
      primitive type constructor.  We pretend it's an abstract data type for
      now.
      5cd52635