1. 06 Feb, 2002 6 commits
    • sof's avatar
      [project @ 2002-02-06 20:52:51 by sof] · 1084e251
      sof authored
      unbreak stdcall handling (caused by recent change to Outputable instance for CCallConv)
      1084e251
    • simonpj's avatar
      [project @ 2002-02-06 15:54:23 by simonpj] · 979947f5
      simonpj authored
      Eliminate all vestiages of UsageTy, in preparation for
      	Keith's new version.  Hurrah!
      
      	Keith: LBVarInfo and usOnce,usMany are still there,
      	because I know you have eliminated LBVarInfo, and I didn't
      	want to cause unnecessary conflicts.
      979947f5
    • keithw's avatar
      [project @ 2002-02-06 12:12:25 by keithw] · 37a47dd0
      keithw authored
      Merging the following onto the HEAD:
      
      |   1.61.2.1  +2 -4      fptools/ghc/compiler/rename/RnHsSyn.lhs
      |   1.135.2.1 +10 -0     fptools/ghc/compiler/rename/RnSource.lhs
      
      Original comment (keithw):
      
      Remove derivings FVs from tyClDeclFVs, because they aren't needed by
      interface files.  Instead, we return these FVs from
      finishSourceTyClDecl.
      37a47dd0
    • simonmar's avatar
      [project @ 2002-02-06 11:41:01 by simonmar] · c19b2904
      simonmar authored
      Take into account the patchlevel when figuring out if we're
      bootstrapping or not.
      c19b2904
    • sewardj's avatar
      [project @ 2002-02-06 11:13:47 by sewardj] · 70d68b08
      sewardj authored
      Clean up the AbsC -> AbsC translation of array operations.
      
      * MachOps MO_ReadOSBI and MO_WriteOSBI, which previously did
        array indexing, are gone.  We translate now just to plain
        memory references and explicit address computations.  This
        has the happy side effect that all MachOps now return exactly
        one result (previously it was 0 or 1), cleaning up various
        bits of code.
      
        As a result the Abstract C structure now contains an unneccessary
        restriction, which is that the result of a MachOp can only be
        assigned to a temporary.  This made sense when MachOps had variable
        numbers of results (0, 1 or 2, originally), but is no longer needed.
        MachOps applied to args could now be allowed to appear as
        arbitrary nodes in expression trees, but so far they are not.
      
      * Get rid of CAddrMode constructor CMem, since it is a special case of
        CVal with a RegRelative of CIndex.
      
      AbstractC is inconsistent and non-orthogonal.  The StixStmt + StixExpr
      combination expresses a large part of what AbstractC does in a cleaner
      and simpler way, IMO.
      70d68b08
    • simonmar's avatar
      [project @ 2002-02-06 11:00:58 by simonmar] · 49fe2112
      simonmar authored
      Import lookupModuleEnv inside #ifdef GHCI
      49fe2112
  2. 05 Feb, 2002 6 commits
    • keithw's avatar
      [project @ 2002-02-05 16:44:37 by keithw] · 6eaccd1a
      keithw authored
      Generalise types of minusUFM and intersectUFM_C (this was applied long
      ago to FiniteMap, IIRC).
      
      Untested: I haven't got a build tree handy, so please shoot me if this
      2-line change to two type signatures is type-incorrect.  Sorry!
      6eaccd1a
    • simonpj's avatar
      [project @ 2002-02-05 15:42:04 by simonpj] · e6601808
      simonpj authored
      ---------
      		Main.main
      		---------
      
      A bunch of related fixes concerning 'main'
      
      * Arrange that 'main' doesn't need to be defined in module Main;
        it can be imported.
      
      * The typechecker now injects a binding
      	Main.$main = PrelTopHandler.runMain main
      
        So the runtime system now calls Main.$main, not PrelMain.main.
        With z-encoding, this look like
      		Main_zdmain_closure
      
      * The function
        	PrelTopHandler.runMain :: IO a -> IO ()
        wraps the programmer's 'main' in an exception-cacthing wrapper.
      
      * PrelMain.hs and Main.hi-boot are both removed from lib/std, along
        with multiple lines of special case handling in lib/std/Makefile.
        This is a worthwhile cleanup.
      
      * Since we now pick up whatever 'main' is in scope, the ranamer gets
        in on the act (RnRnv.checkMain).  There is a little more info to
        get from the renamer to the typechecker, so I've defined a new type
        Rename.RnResult (c.f. TcModule.TcResult)
      
      * With GHCi, it's now a warning, not an error, to omit the binding
        of main (RnEnv.checkMain)
      
      * It would be easy to add a flag "-main-is foo"; the place to use
        that information is in RnEnv.checkMain.
      
      
      -------
      
      On the way I made a new type,
      	type HscTypes.FixityEnv = NameEnv Fixity
      and used it in various places I'd tripped over
      e6601808
    • simonpj's avatar
      [project @ 2002-02-05 15:02:23 by simonpj] · c43a63d3
      simonpj authored
      Imports only
      c43a63d3
    • simonpj's avatar
      [project @ 2002-02-05 14:46:26 by simonpj] · f50b860a
      simonpj authored
      Imports only
      f50b860a
    • simonpj's avatar
      [project @ 2002-02-05 14:43:35 by simonpj] · 144e841e
      simonpj authored
      Imports and comments only
      144e841e
    • simonpj's avatar
      [project @ 2002-02-05 14:39:24 by simonpj] · c7eeb711
      simonpj authored
      Imports only
      c7eeb711
  3. 04 Feb, 2002 7 commits
    • sewardj's avatar
      [project @ 2002-02-04 17:09:02 by sewardj] · 5316d543
      sewardj authored
      Also implement MO_32U_to_8U for sparc.  sigh.
      5316d543
    • sewardj's avatar
      [project @ 2002-02-04 16:47:47 by sewardj] · 4e408d57
      sewardj authored
      Implement missing MachOp, MO_8U_to_32U, for sparc.  (duh!)
      4e408d57
    • sewardj's avatar
      [project @ 2002-02-04 13:54:53 by sewardj] · 3be6a230
      sewardj authored
      Expand out use of modifyIORef because 4.08.2 doesn't have that.
      3be6a230
    • simonpj's avatar
      [project @ 2002-02-04 11:59:55 by simonpj] · 18dbe364
      simonpj authored
      -----------------------------
      	Improve type validity checking
      	-----------------------------
      
      Two main effects here
      
      a) Type synonyms can be unboxed tuples
      	tupe T = (# Int, Int #)
      
      	f :: Int -> T
      
      b) Hoisting works for implicit parameters
      
      	f :: Int -> (?x::Int) => Int
      18dbe364
    • simonpj's avatar
      [project @ 2002-02-04 11:58:30 by simonpj] · 41aba23a
      simonpj authored
      Correct assertion
      41aba23a
    • simonmar's avatar
      [project @ 2002-02-04 11:49:33 by simonmar] · 1ba0b04c
      simonmar authored
      Tighten up syntax w.r.t. Haskell 98; this is disallowed:
      
      	(a `op` b) = ...
      
      since a parenthesised lhs must be followed by at least one parameter.
      1ba0b04c
    • chak's avatar
      [project @ 2002-02-04 03:40:31 by chak] · 0299e1a1
      chak authored
      Foreign import/export declarations now conform to FFI Addendum Version 1.0
      
      * The old form of foreign declarations is still supported, but generates
        deprecation warnings.
      
      * There are some rather exotic old-style declarations which have become
        invalid as they are interpreted differently under the new scheme and there
        is no (easy) way to determine which style the programmer had in mind (eg,
        importing a C function with the name `wrapper' where the external name is
        explicitly given will not work in some situations - depends on whether an
        `unsafe' was specified and similar things).
      
      * Some "new" old-style forms have been introduced to make parsing a little bit
        easier (ie, avoid shift/reduce conflicts between new-style and old-style
        grammar rules), but they are few, arcane, and don't really hurt (and I won't
        tell what they are, you need to find that out by yourself ;-)
      
      * The FFI Addendum doesn't specify whether a header file that is requested for
        inclusion by multiple foreign declarations should be included only once or
        multiple times.  GHC at the moment includes an header as often as it appears
        in a foreign declaration.  For properly written headers, it doesn't make a
        difference anyway...
      
      * Library object specifications are currently silently ignored.  The feature
        was mainly requested for external calls in .NET (ie, calls which invoke C
        routines when Haskell is compiled to ILX), but those don't seem to be
        supported yet.
      
      * Foreign label declarations are currently broken, but they were already
        broken before I started messing with the stuff.
      
      The code is moderately tested.  All modules in lib/std/ and hslibs/lang/
      (using old-style declarations) still compile fine and I have run a couple of
      tests on the different forms of new-style declarations.
      0299e1a1
  4. 02 Feb, 2002 1 commit
  5. 01 Feb, 2002 2 commits
  6. 31 Jan, 2002 2 commits
    • simonpj's avatar
      [project @ 2002-01-31 17:48:26 by simonpj] · b27560c4
      simonpj authored
      Wibbles to yesterdays changes
      b27560c4
    • simonmar's avatar
      [project @ 2002-01-31 13:42:20 by simonmar] · 95ac9a43
      simonmar authored
      Fix a classic bug: copying a Haskell string with one of the C string
      functions (in this case strncpy()) is wrong when the string contains
      '\0' characters.
      
      The symptom in this case is that Happy parsers created with -ag don't
      work in GHCi, because the state tables are encoded as strings
      containing lots of '\0' elements.
      95ac9a43
  7. 30 Jan, 2002 8 commits
    • simonpj's avatar
      [project @ 2002-01-30 17:16:36 by simonpj] · dd214d28
      simonpj authored
      -----------------------------
      	Tidy up the top level of TcModule
      	-----------------------------
      
      This commit started life as sorting out the TcInstDcls thing that
      we got wrong a few weeks back, but it spiraled out of control.
      
      However, the result is a nice tidy up of TcModule.
      
      typecheckModule/tcModule compiles a module from source code
      typecheckIface/tcIface   compiles a module from its interface file
      typecheckStmt		 compiles a Stmt
      typecheckExpr		 compiles a Expr
      
      tcExtraDecls is used by typecheckStmt/typecheckExpr
      	to compile interface-file decls.
      	It is just a wrapper for:
      
      tcIfaceImports, which is used by tcExtraDecls and tcIface
      	to compile interface file-file decls.
      
      tcImports, is similar to tcIfaceImports, but is used only by tcModule
      
      tcIfaceImports is used when compiling an interface, and can
      	therefore be quite a bit simpler
      dd214d28
    • simonpj's avatar
      [project @ 2002-01-30 17:16:04 by simonpj] · 605fd82f
      simonpj authored
      Improved printing
      605fd82f
    • simonmar's avatar
      [project @ 2002-01-30 16:37:59 by simonmar] · 487968ec
      simonmar authored
      comsetic only: shorten some lines.
      487968ec
    • simonmar's avatar
      [project @ 2002-01-30 16:37:14 by simonmar] · 4aed87eb
      simonmar authored
      Simplify the package story inside the compiler.  The new story is
      this:
      
        The Finder no longer determines a module's package based on its
        filesystem location.  The filesystem location indicates only whether
        a given module is in the current package or not (i.e. found along
        the -i path ==> current package, found along the package path ==>
        other package).
      
        Hence a Module no longer contains a package name.  Instead it just
        contains PackageInfo, which is either ThisPackage or AnotherPackage.
        The compiler uses this information for generating cross-DLL calls
        and omitting certain version information from .hi files.
      
        The interface still contains the package name.  This isn't used for
        anything right now, but in the future (when we have hierarchical
        libraries) we might use it to automatically determine which packages
        a binary should be linked against.  When building a package, you
        should still use -package-name, but it won't be fatal if you don't.
      
      The warning/error about package name mismatches has gone away.
      4aed87eb
    • simonmar's avatar
      [project @ 2002-01-30 14:05:01 by simonmar] · 6682d974
      simonmar authored
      Cleanup sweep, we can now use more of the std fptools build system
      machinery in here.
      6682d974
    • sewardj's avatar
      [project @ 2002-01-30 13:23:25 by sewardj] · f50b4739
      sewardj authored
      Fix debug build.
      f50b4739
    • sewardj's avatar
      [project @ 2002-01-30 10:52:38 by sewardj] · dca430c4
      sewardj authored
      Fix syntax error in printing indirect calls in sparc assembly.
      dca430c4
    • sof's avatar
      [project @ 2002-01-30 01:06:14 by sof] · 17861c1b
      sof authored
      cope with the fact that StgTickyHeader is no more
      17861c1b
  8. 29 Jan, 2002 5 commits
    • sewardj's avatar
      [project @ 2002-01-29 16:54:41 by sewardj] · 975b3c32
      sewardj authored
      x86 only: remove special ccall support for calling PerformGC_wrapper
      using dodgy-looking calling convention.  PerformGC_wrapper was last
      seen alive in GHC 3.X, AFAIK.
      975b3c32
    • sewardj's avatar
      [project @ 2002-01-29 16:52:25 by sewardj] · 383f737f
      sewardj authored
      sparc NCG fixes for f-i-dynamic.
      383f737f
    • sewardj's avatar
      [project @ 2002-01-29 13:22:28 by sewardj] · ec269b12
      sewardj authored
      Teach the NCG how to do f-i-dynamic.  Nothing unexpected.
      sparc-side now needs fixing.
      ec269b12
    • sewardj's avatar
      [project @ 2002-01-29 11:07:26 by sewardj] · 7f42c60a
      sewardj authored
      Allow constructors with non-ptr fields to be allocated in-line.
      7f42c60a
    • simonpj's avatar
      [project @ 2002-01-29 09:58:14 by simonpj] · f2054812
      simonpj authored
      ------------
      	Rule phasing
      	------------
      
      This commit adds a little more control to when rules are enabled.
      
        {-# RULES
             "foo" [2] forall ...
             "baz" [~2] forall ...
        #-}
      
      Rule "foo" is active in phase 2 and later.  The new thing is that the
      "~2" means that Rule "baz" is active in phase 3 and earlier.
      (Remember tha phases decrease towards zero.)
      
      All the machinery was there to implement this, it just needed the syntax.
      
      
      Why do this?  Peter Gammie (at UNSW) found that rules weren't firing
      because of bindings of the form
      
      	M.f = f
      	f = ....
      
      where the rules where on the M.f binding.  It turned out that an old
      hack (which have for some time elicited the harmless "shortMeOut" debug
      warnings) prevented this trivial construction from being correctly
      simplified.  The hack in turn derived from a trick in the way the
      foldr/build rule was implemented....and that hack is no longer necessary
      now we can switch rules *off* as well as *on*.
      
      
      There are consequential changes in the Prelude foldr/build RULE stuff.
      It's a clean-up.... Instead of strange definitions like
      	map = mapList
      which we had before, we have an ordinary recursive defn of map, together
      with rules to convert first to foldr/build form, and then (if nothing
      happens) back again.
      
      There's a fairly long comment about the general plan of attack in
      PrelBase, near the defn of map.
      f2054812
  9. 28 Jan, 2002 3 commits
    • sewardj's avatar
      [project @ 2002-01-28 17:22:45 by sewardj] · 7bf9669c
      sewardj authored
      Generate better code for lets whose RHS is a simple fn or constructor
      application.  Details are in comment in code.
      7bf9669c
    • simonmar's avatar
      [project @ 2002-01-28 17:09:05 by simonmar] · 8de7cb84
      simonmar authored
      Catch up with recent changes in the middle end that changed the
      assumptions about constructor applications: it is not necessarily the
      case any more that constructor applications are always saturated in
      the output from CorePrep.
      
      For a non-saturated constructor application there is always a curried
      worker function that can be called instead.  This change updates the
      byte code generator to use the curried worker when necessary.
      
      Also: a couple of micro-optimisations/cleanups.
      8de7cb84
    • simonpj's avatar
      [project @ 2002-01-28 16:52:37 by simonpj] · 0d62bdb2
      simonpj authored
      ----------------------
      	Zero-constructor types
      	----------------------
      
      If we have
      
      	data T
      	data S = MkS !T
      
      we were getting a crash in the compiler because ctrlRetConvAlg
      didn't know what to do for zero-constructor types.
      
      This fix arbitrarily says that they use a non-vectored return,
      which fixes the crash.  (Since they only have bottom values,
      the return never gets exercised, but GC and exception handling
      should work.)
      
      What is still unclear is how we handle data types that are defined
      with zero constructors in an hi-boot file.  I think that Bad Things
      may well happen if you do a 'seq' on them before we get up to the
      definition.  (e.g. as a result of this fix we'll say "unvectored"
      whereas the truth may be "vectored".)  This obviously doesn't happen
      much (because at present we'd get a compiler crash in ctrlRetConvAlg,
      but we should look into it.
      0d62bdb2