1. 01 Mar, 2001 11 commits
    • simonmar's avatar
      [project @ 2001-03-01 15:36:35 by simonmar] · 60cc861b
      simonmar authored
      forgot one file.
      60cc861b
    • simonmar's avatar
      [project @ 2001-03-01 15:36:20 by simonmar] · b3834c59
      simonmar authored
      The beginnings of a GHCi test suite.
      b3834c59
    • simonpj's avatar
      [project @ 2001-03-01 15:35:29 by simonpj] · 907ab722
      simonpj authored
      Fix interface-file syntax wibble (when printing both rules and deprecations)
      907ab722
    • simonpj's avatar
      [project @ 2001-03-01 15:06:52 by simonpj] · f4ed011b
      simonpj authored
      Improve rule matching even more
      
      Manuel discovered that given
      
        {-# RULES "fst over sndSnd" forall v. fst (sndSnd v) = fst v #-}
      
        sndSnd :: (a, (b, c)) -> (a, c)
        sndSnd (x, (y, z)) = (x, z)
      
      the rule gets a type, which is too specialised, namely
      
        {-## __R "fst over sndSnd" __forall {@ a1 v :: (a1, ((), ()))}
      	   fst @ a1 @ () (sndSnd @ a1 @ () @ () v) = fst @ a1 @ ((), ()) v ;
      
      This was because TcRules wasn't quantifying over enough type variables.
      
      This commit fixes the problem.
      The test is in tests/simplCore/should_run/simplrun002
      f4ed011b
    • simonmar's avatar
      [project @ 2001-03-01 14:27:22 by simonmar] · 6934a650
      simonmar authored
      don't needlessly duplicate a binder.
      6934a650
    • simonmar's avatar
      [project @ 2001-03-01 14:26:44 by simonmar] · f89457ed
      simonmar authored
      define the "$Interactive" module.
      f89457ed
    • simonmar's avatar
      [project @ 2001-03-01 14:26:00 by simonmar] · 18b24e64
      simonmar authored
      GHCi fixes:
      
        - expressions are now compiled in a pseudo-module "$Interactive",
          which avoids some problems with storage of demand-loaded declarations.
      
        - compilation manager now detects when it needs to read the interace
          for a module, even if it is already compiled.  GHCi never demand-loads
          interfaces now.
      
        - (from Simon PJ) fix a problem with the recompilation checker, which
          meant that modules were sometimes not recompiled when they should
          have been.
      
        - ByteCodeGen/Link: move linker related stuff into ByteCodeLink.
      18b24e64
    • simonmar's avatar
      [project @ 2001-03-01 13:44:33 by simonmar] · 6ae3188b
      simonmar authored
      fix an ASSERT: the isDeadBinder predicate can't be used here, because
      all the Ids have been cloned with empty IdInfo.
      6ae3188b
    • simonmar's avatar
      [project @ 2001-03-01 13:06:54 by simonmar] · 09c9b6a7
      simonmar authored
      fix a couple of foreign imports
      09c9b6a7
    • rrt's avatar
      [project @ 2001-03-01 12:25:32 by rrt] · ae2fa137
      rrt authored
      Apply stat fix for mingw. It's ugly, it's implausible, but it seems to work.
      Unlike Cygwin...(missing no. 3).
      ae2fa137
    • qrczak's avatar
      [project @ 2001-03-01 09:23:40 by qrczak] · f0c9e560
      qrczak authored
      Uncomment {-# SPECIALISE instance Eq  [Char] #-}
                {-# SPECIALISE instance Ord [Char] #-}
      Remove explicit (<), (<=), (>), (>=) in instance Ord [a].
      eqString is defined as (==) instead of vice versa.
      
      ghc generates good specialized code for these automatically.
      f0c9e560
  2. 28 Feb, 2001 14 commits
    • simonmar's avatar
      [project @ 2001-02-28 17:57:52 by simonmar] · 85c61e76
      simonmar authored
      Compiling a module outside of a running GHCi and expecting GHCi to
      pick it up when you do ':r' ain't gonna work.
      
      We thought it would, but there's a problem with module versions and
      the recompilation machinery, namely that the outside compiler doesn't
      know about the versions being used internally in the running GHCi.
      
      The "right" solution is to implement a ':compile' command in GHCi, but
      we aren't going to do that before the release.
      
      This commit disables the picking up of newly compiled modules, until
      you do a full load (i.e. :load).
      85c61e76
    • simonpj's avatar
      [project @ 2001-02-28 17:17:55 by simonpj] · 56d75e0b
      simonpj authored
      Improve rule matching
      
      When doing constraint simplification on the LHS of a rule,
      we *don't* want to do superclass commoning up.  Consider
      
      	fromIntegral :: (Integral a, Num b) => a -> b
      	{-# RULES "foo"  fromIntegral = id :: Int -> Int #-}
      
      Here, a=b=Int, and Num Int is a superclass of Integral Int. But we *dont*
      want to get
      
      	forall dIntegralInt.
      	fromIntegral Int Int dIntegralInt (scsel dIntegralInt) = id Int
      
      because the scsel (super class selection) will mess up matching.
      Instead we want
      
      	forall dIntegralInt, dNumInt.
      	fromIntegral Int Int dIntegralInt dNumInt = id Int
      
      
      TcSimplify.tcSimplifyToDicts is the relevant function, but I had
      to generalise the main simplification loop a little (adding the
      type WantSCs).
      56d75e0b
    • sewardj's avatar
      [project @ 2001-02-28 14:24:46 by sewardj] · 8d24d680
      sewardj authored
      Don't do a prototype for tcSetAttr if !HAVE_TERMIOS_H.
      8d24d680
    • sewardj's avatar
      [project @ 2001-02-28 14:23:55 by sewardj] · c7d59431
      sewardj authored
      Correctly #include <windows.h>.
      c7d59431
    • simonmar's avatar
      [project @ 2001-02-28 12:12:43 by simonmar] · 85222f5c
      simonmar authored
      oops, don't export cmTypeOfName when !GHCI.
      85222f5c
    • simonpj's avatar
      [project @ 2001-02-28 11:48:34 by simonpj] · 12e6a9a5
      simonpj authored
      Add most of the code for constructor specialisation.  The comment
      below is reproduced from specialise/SpecConstr.lhs.
      
      It doesn't quite work properly yet, because we need to have 
      rules in scope in a recursive function's own RHS, and that
      entails a bit of fiddling I havn't yet completed.  But SpecConstr
      itself is a nice neat 250 lines of code.
      
      -----------------------------------------------------
      			Game plan
      -----------------------------------------------------
      
      Consider
      	drop n []     = []
      	drop 0 xs     = []
      	drop n (x:xs) = drop (n-1) xs
      
      After the first time round, we could pass n unboxed.  This happens in
      numerical code too.  Here's what it looks like in Core:
      
      	drop n xs = case xs of
      		      []     -> []
      		      (y:ys) -> case n of 
      				  I# n# -> case n# of
      					     0 -> []
      					     _ -> drop (I# (n# -# 1#)) xs
      
      Notice that the recursive call has an explicit constructor as argument.
      Noticing this, we can make a specialised version of drop
      	
      	RULE: drop (I# n#) xs ==> drop' n# xs
      
      	drop' n# xs = let n = I# n# in ...orig RHS...
      
      Now the simplifier will apply the specialisation in the rhs of drop', giving
      
      	drop' n# xs = case xs of
      		      []     -> []
      		      (y:ys) -> case n# of
      				  0 -> []
      				  _ -> drop (n# -# 1#) xs
      
      Much better!  
      
      We'd also like to catch cases where a parameter is carried along unchanged,
      but evaluated each time round the loop:
      
      	f i n = if i>0 || i>n then i else f (i*2) n
      
      Here f isn't strict in n, but we'd like to avoid evaluating it each iteration.
      In Core, by the time we've w/wd (f is strict in i) we get
      
      	f i# n = case i# ># 0 of
      		   False -> I# i#
      		   True  -> case n of n' { I# n# ->
      			    case i# ># n# of
      				False -> I# i#
      				True  -> f (i# *# 2#) n'
      
      At the call to f, we see that the argument, n is know to be (I# n#),
      and n is evaluated elsewhere in the body of f, so we can play the same
      trick as above.  However we don't want to do that if the boxed version
      of n is needed (else we'd avoid the eval but pay more for re-boxing n).
      So in this case we want that the *only* uses of n are in case statements.
      
      
      So we look for
      
      * A self-recursive function.  Ignore mutual recursion for now, 
        because it's less common, and the code is simpler for self-recursion.
      
      * EITHER
      
         a) At a recursive call, one or more parameters is an explicit 
            constructor application
      	AND
            That same parameter is scrutinised by a case somewhere in 
            the RHS of the function
      
        OR
      
          b) At a recursive call, one or more parameters has an unfolding
             that is an explicit constructor application
      	AND
            That same parameter is scrutinised by a case somewhere in 
            the RHS of the function
      	AND
            Those are the only uses of the parameter
      12e6a9a5
    • simonpj's avatar
      [project @ 2001-02-28 11:44:39 by simonpj] · f53c4074
      simonpj authored
      Import/formatting wibbles
      f53c4074
    • simonpj's avatar
      [project @ 2001-02-28 11:42:09 by simonpj] · 3dea9c72
      simonpj authored
      Tidy up in exprIsConApp_maybe
      3dea9c72
    • rrt's avatar
      [project @ 2001-02-28 10:53:30 by rrt] · d501b546
      rrt authored
      Modernize
      d501b546
    • rrt's avatar
      [project @ 2001-02-28 10:46:52 by rrt] · 07609b99
      rrt authored
      The warning messages have changes, so the stderrs have to too.
      07609b99
    • rrt's avatar
      [project @ 2001-02-28 10:45:40 by rrt] · a4835ae2
      rrt authored
      Various bits of modernisation; in particular, in cg026, do the Char test the
      same way as all the others, rather than in a way that fails on Windows.
      a4835ae2
    • rrt's avatar
      [project @ 2001-02-28 10:29:41 by rrt] · dcf5ea1a
      rrt authored
      Add extra results for mingw, and stop printing out the time taken in io012,
      (this was debugging code which was accidentally committed earlier).
      dcf5ea1a
    • sewardj's avatar
      [project @ 2001-02-28 10:03:42 by sewardj] · af3063d6
      sewardj authored
      Yesterday's changes to the runtime linker:
      * Update the PEi386 stuff to compile in the new framework.
        Note!  Certainly will _not_ work properly as-is.
      * A conceptual cleanup for all platforms: only record, in the
        oc.symbols field, the names of symbols which have been put into the
        global symbol table, rather than (name, addr) pairs -- the addr
        is redundant.
      af3063d6
    • qrczak's avatar
      [project @ 2001-02-28 00:01:01 by qrczak] · 871db587
      qrczak authored
      * Add {intToInt,wordToWord}{8,16,32}# primops. WARNING: Not implemented
        in ncg for Alpha and Sparc. But -O -fasm is not going to go far anyway
        because of other omissions.
      
      * Have full repertoire of 8,16,32-bit signed and unsigned MachMisc.Size
        values. Again only x86 is fully supported. They are used for
        {index,read,write}{Int,Word}{8,16,32}{OffAddr,Array}# and
        {intToInt,wordToWord}{8,16,32}# primops.
      
      * Have full repertoire of
        {index,read,write}\
        {Char,WideChar,Int,Word,Addr,Float,Double,StablePtr,\
         {Int,Word}{8,16,32,64}}\
        {OffAddr,Array} primops and appropriate instances.
        There were various omissions in various places.
      
      * Add {plus,minus,times}Word# primops to avoid so many Word# <-> Int#
        coercions.
      
      * Rewrite modules PrelWord and PrelInt almost from scratch.
      
      * Simplify fromInteger and realToFrac rules. For each of
        {Int,Word}{8,16,32} there is just a pair of fromInteger rules
        replacing the source or target type with Int or Word. For
        {Int,Word,Int64,Word64} there are rules from any to any.
        Don't include rules which are derivable from inlining anyway,
        e.g. those mentioning Integer. Old explicit coercions are simply
        defined as appropriately typed fromInteger.
      
      * Various old coercion functions marked as deprecated.
      
      * Add instance Bits Int, and
        instance {Show,Num,Real,Enum,Integral,Bounded,Ix,Read,Bits} Word.
      
      * Coercions to sized integer types consistently behave as cutting the
        right amount of bits from the infinite two-complement representation.
        For example (fromIntegral (-1 :: Int8) :: Word64) == maxBound.
      
      * ghc/tests/numeric/should_run/arith011 tests {Int,Word}64 and instance
        Bits Int, and does not try to use overflowing toEnum. arith011.stdout
        is not updated yet because of a problem I will tell about soon.
      
      * Move fromInteger and realToFrac from Prelude to PrelReal.
        Move fromInt from PrelNum to PrelReal and define as fromInteger.
        Define toInt as fromInteger. fromInteger is the place to write
        integer conversion rules for.
      
      * Remove ArrayBase.newInitialisedArray, use default definition of
        newArray instead.
      
      * Bugs fixed:
        - {quot,rem}Word# primop attributes.
        - integerToInt64# for small negative values.
        - {min,max}Bound::Int on 64-bit platforms.
        - iShiftRL64#.
        - Various Bits instances.
      
      * Polishing:
        - Use 'ppr' instead of 'pprPrimOp' and 'text . showPrimRep'.
        - PrimRep.{primRepString,showPrimRepToUser} removed.
        - MachMisc.sizeOf returns Int instead of Integer.
        - Some eta reduction, parens, spacing, and reordering cleanups -
          sorry, couldn't resist.
      
      * Questions:
        - Should iShiftRL and iShiftRL64 be removed? IMHO they should,
          s/iShiftRA/iShiftR/, s/shiftRL/shiftR/. The behaviour on shifting
          is a property of the signedness of the type, not the operation!
          I haven't done this change.
      871db587
  3. 27 Feb, 2001 12 commits
    • simonmar's avatar
      [project @ 2001-02-27 17:15:53 by simonmar] · 60ac8eb4
      simonmar authored
      Don't blacklist everything in simplifyExpr.  Allow simple inlining to
      happen (actually, this is what exposed the bug I just fixed in
      HscMain.lhs).
      60ac8eb4
    • simonmar's avatar
      [project @ 2001-02-27 17:14:44 by simonmar] · 1aa6eb78
      simonmar authored
      Need to tidy the expression before compiling it, purely in order to
      clone the ids in case of clashes.
      1aa6eb78
    • simonmar's avatar
      [project @ 2001-02-27 15:26:04 by simonmar] · a29fe417
      simonmar authored
      - make flushing and :def work again in the interpreter
      a29fe417
    • simonmar's avatar
      [project @ 2001-02-27 15:25:18 by simonmar] · 8a097699
      simonmar authored
      - clean up recognising of objects on the ghci command line
      - recognise objects on the ghc --make command line, and link them in (untested)
      8a097699
    • rrt's avatar
      [project @ 2001-02-27 14:37:17 by rrt] · d424a4fb
      rrt authored
      Update ffi001.stdout (was simply wrong) and change fed001.hs in line with
      library changes.
      d424a4fb
    • rrt's avatar
      [project @ 2001-02-27 14:34:46 by rrt] · 6900cdd4
      rrt authored
      Merge changes from 4.08 branch.
      6900cdd4
    • simonmar's avatar
      [project @ 2001-02-27 13:38:58 by simonmar] · 42d07019
      simonmar authored
      changes for commandline do-bindings: define failIO.
      42d07019
    • simonmar's avatar
      [project @ 2001-02-27 13:38:15 by simonmar] · 18ca279f
      simonmar authored
      remove PutFullMVar
      18ca279f
    • rrt's avatar
      [project @ 2001-02-27 12:43:45 by rrt] · 6339f4b0
      rrt authored
      mingwin "fixes": getourtimeofday now returns the right units, and awaitEvent
      fudged to use WinSock select(), so that although it doesn't work for file
      handles, at least it doesn't cause nasty crashes; instead it just blocks.
      6339f4b0
    • rrt's avatar
      [project @ 2001-02-27 12:36:36 by rrt] · ec46629d
      rrt authored
      Add ILX support (all #ifdefed on ILX for now) and tidied up some
      indentation. We now support --mk-dll, so remove the comment about adding
      that.
      ec46629d
    • simonpj's avatar
      [project @ 2001-02-27 11:50:05 by simonpj] · 82f63df9
      simonpj authored
      Temporary fix for a nasty black hole
      
      The problem is that the type checker has a big knot for "unf_env".
      This means that we can't look at unfoldings inside the loop, which
      is fair enough.  But setting an unfolding in the IdInfo is strict
      in the unfolding, so we can't look at the IdInfo either.
      
      But isLocalId looks at the IdInfo, and it was being used in an
      assert in TcHsSyn, and in setting the in_scope_vars in TcIfaceSig.
      
      I think the right solution is to take the "flavour" out of IdInfo,
      and put it into VarDetails, but I've done a quick fix for now.
      (Remove the assert, and use a different way in TcIfaceSig.)
      82f63df9
    • rrt's avatar
      [project @ 2001-02-27 10:03:22 by rrt] · 2140976e
      rrt authored
      Avoid types that lickle Windows doesn't understand aaahhhh. Why not just
      avoid this whole file? Well, some of the types are widely used.
      2140976e
  4. 26 Feb, 2001 3 commits