1. 20 Apr, 2001 1 commit
  2. 28 Feb, 2001 1 commit
    • 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. 04 Dec, 2000 1 commit
  4. 20 Nov, 2000 1 commit
    • sewardj's avatar
      [project @ 2000-11-20 17:42:00 by sewardj] · 96cf57e3
      sewardj authored
      Split HscResult into HscFail | HscNoRecomp | HscRecomp, and clean up
      producers and consumers of such.  In particular, if no recompilation
      happens, the resulting iface is put into the HIT instead of being
      thrown away.
      
      Also (trivial) unify functions *ModuleInThisPackage with *HomeModule.
      96cf57e3
  5. 13 Nov, 2000 1 commit
  6. 06 Nov, 2000 1 commit
  7. 16 Oct, 2000 1 commit
  8. 12 Oct, 2000 1 commit
  9. 02 Aug, 2000 1 commit
    • rrt's avatar
      [project @ 2000-08-02 14:13:26 by rrt] · 567b2505
      rrt authored
      Many fixes to DLLisation. These were previously covered up because code was
      leaking into the import libraries for DLLs, so the fact that some symbols
      were thought of as local rather than in another DLL wasn't a problem.
      
      The main problems addressed by this commit are:
      
      1. Fixes RTS symbols working properly when DLLised. They didn't before.
      2. Uses NULL instead of stg_error_entry, because DLL entry points can't be
         used as static initialisers.
      3. PrelGHC.hi-boot changed to be in package RTS, and export of PrelNum and
         PrelErr moved to PrelBase, so that references to primops & the like
         are cross-DLL as they should be.
      4. Pass imports around as Modules rather than ModuleNames, so that
         ModuleInitLabels can be checked to see if they're in a DLL or not.
      567b2505
  10. 03 Jul, 2000 1 commit
  11. 22 May, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-05-22 17:05:57 by simonmar] · a83ec8c5
      simonmar authored
      Re-instate foreign label and foreign export dynamic support in the NCG
      (which both end up emitting a CLitLit into the abstract C) using a new
      mkForeignLabel interface to CLabel.
      
      This won't work if the foreign label is in a different DLL yet, but
      Julian is on the case.
      a83ec8c5
  12. 18 May, 2000 1 commit
    • sewardj's avatar
      [project @ 2000-05-18 13:55:36 by sewardj] · 963cf411
      sewardj authored
      Teach the NCG about the dereferencing and naming conventions to be
      used when compiling for a DLLised world.  Some cleanups on the way
      too.  The scheme is that
      
      * All CLabels which are in different DLLs from the current module
        will, via the renamer, already be such that labelDynamic returns
        True for them.
      
      * Redo the StixPrim/StixMacro stuff so that all references to symbols
        in the RTS are via CLabels.  That means that the usual labelDynamic
        story can be used.
      
      * When a label is printed in PprMach, labelDynamic is consulted, to
        generate the __imp_ prefix if necessary.
      
      * In MachCode.stmt2Instrs, selectively ask derefDLL to walk trees
        before code generation and insert deferencing code around other-DLL
        symbols.
      
      * When generating Stix for SRTs, add 1 to other-DLL refs.
      
      * When generating static closures, insert a zero word before
        the _closure label.
      963cf411
  13. 15 May, 2000 1 commit
  14. 13 Apr, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-04-13 11:56:35 by simonpj] · 9579283c
      simonpj authored
      Add support for 'packages'.
      
      * A package is a group of modules.
      
      * A package has a name (e.g. std)
      
      * A package is built into a single library (Unix; e.g. libHSstd.a)
                             or a single DLL     (Windows; e.g. HSstd.dll)
      
      * The '-package-name foo' flag tells GHC that the module being compiled
        is destined for package foo.
      
      * The '-package foo' flag tells GHC to make available modules
        from package 'foo'.  It replaces '-syslib foo' which is now deprecated.
      
      * Cross-package references cost an extra indirection in Windows,
        but not Unix
      
      * GHC does not maintain detailed cross-package dependency information.
        It does remember which modules in other packages the current module
        depends on, but not which things within those imported things.
      
      
      All of this tidies up the Prelude enormously.  The Prelude and
      Standard Libraries are built into a singl package called 'std'.  (This
      is a change; the library is now called libHSstd.a instead of libHS.a)
      9579283c
  15. 23 Mar, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-03-23 17:45:17 by simonpj] · 111cee3f
      simonpj authored
      This utterly gigantic commit is what I've been up to in background
      mode in the last couple of months.  Originally the main goal
      was to get rid of Con (staturated constant applications)
      in the CoreExpr type, but one thing led to another, and I kept
      postponing actually committing.   Sorry.
      
      	Simon, 23 March 2000
      
      
      I've tested it pretty thoroughly, but doubtless things will break.
      
      Here are the highlights
      
      * Con is gone; the CoreExpr type is simpler
      * NoRepLits have gone
      * Better usage info in interface files => less recompilation
      * Result type signatures work
      * CCall primop is tidied up
      * Constant folding now done by Rules
      * Lots of hackery in the simplifier
      * Improvements in CPR and strictness analysis
      
      Many bug fixes including
      
      * Sergey's DoCon compiles OK; no loop in the strictness analyser
      * Volker Wysk's programs don't crash the CPR analyser
      
      I have not done much on measuring compilation times and binary sizes;
      they could have got worse.  I think performance has got significantly
      better, though, in most cases.
      
      
      Removing the Con form of Core expressions
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      The big thing is that
      
        For every constructor C there are now *two* Ids:
      
      	C is the constructor's *wrapper*. It evaluates and unboxes arguments
      	before calling $wC.  It has a perfectly ordinary top-level defn
      	in the module defining the data type.
      
      	$wC is the constructor's *worker*.  It is like a primop that simply
      	allocates and builds the constructor value.  Its arguments are the
      	actual representation arguments of the constructor.
      	Its type may be different to C, because:
      		- useless dict args are dropped
      		- strict args may be flattened
      
        For every primop P there is *one* Id, its (curried) Id
      
        Neither contructor worker Id nor the primop Id have a defminition anywhere.
        Instead they are saturated during the core-to-STG pass, and the code generator
        generates code for them directly. The STG language still has saturated
        primops and constructor applications.
      
      * The Const type disappears, along with Const.lhs.  The literal part
        of Const.lhs reappears as Literal.lhs.  Much tidying up in here,
        to bring all the range checking into this one module.
      
      * I got rid of NoRep literals entirely.  They just seem to be too much trouble.
      
      * Because Con's don't exist any more, the funny C { args } syntax
        disappears from inteface files.
      
      
      Parsing
      ~~~~~~~
      * Result type signatures now work
      	f :: Int -> Int = \x -> x
      	-- The Int->Int is the type of f
      
      	g x y :: Int = x+y
      	-- The Int is the type of the result of (g x y)
      
      
      Recompilation checking and make
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * The .hi file for a modules is not touched if it doesn't change.  (It used to
        be touched regardless, forcing a chain of recompilations.)  The penalty for this
        is that we record exported things just as if they were mentioned in the body of
        the module.  And the penalty for that is that we may recompile a module when
        the only things that have changed are the things it is passing on without using.
        But it seems like a good trade.
      
      * -recomp is on by default
      
      Foreign declarations
      ~~~~~~~~~~~~~~~~~~~~
      * If you say
      	foreign export zoo :: Int -> IO Int
        then you get a C produre called 'zoo', not 'zzoo' as before.
        I've also added a check that complains if you export (or import) a C
        procedure whose name isn't legal C.
      
      
      Code generation and labels
      ~~~~~~~~~~~~~~~~~~~~~~~~~~
      * Now that constructor workers and wrappers have distinct names, there's
        no need to have a Foo_static_closure and a Foo_closure for constructor Foo.
        I nuked the entire StaticClosure story.  This has effects in some of
        the RTS headers (i.e. s/static_closure/closure/g)
      
      
      Rules, constant folding
      ~~~~~~~~~~~~~~~~~~~~~~~
      * Constant folding becomes just another rewrite rule, attached to the Id for the
        PrimOp.   To achieve this, there's a new form of Rule, a BuiltinRule (see CoreSyn.lhs).
        The prelude rules are in prelude/PrelRules.lhs, while simplCore/ConFold.lhs has gone.
      
      * Appending of constant strings now works, using fold/build fusion, plus
        the rewrite rule
      	unpack "foo" c (unpack "baz" c n)  =  unpack "foobaz" c n
        Implemented in PrelRules.lhs
      
      * The CCall primop is tidied up quite a bit.  There is now a data type CCall,
        defined in PrimOp, that packages up the info needed for a particular CCall.
        There is a new Id for each new ccall, with an big "occurrence name"
      	{__ccall "foo" gc Int# -> Int#}
        In interface files, this is parsed as a single Id, which is what it is, really.
      
      Miscellaneous
      ~~~~~~~~~~~~~
      * There were numerous places where the host compiler's
        minInt/maxInt was being used as the target machine's minInt/maxInt.
        I nuked all of these; everything is localised to inIntRange and inWordRange,
        in Literal.lhs
      
      * Desugaring record updates was broken: it didn't generate correct matches when
        used withe records with fancy unboxing etc.  It now uses matchWrapper.
      
      * Significant tidying up in codeGen/SMRep.lhs
      
      * Add __word, __word64, __int64 terminals to signal the obvious types
        in interface files.  Add the ability to print word values in hex into
        C code.
      
      * PrimOp.lhs is no longer part of a loop.  Remove PrimOp.hi-boot*
      
      
      Types
      ~~~~~
      * isProductTyCon no longer returns False for recursive products, nor
        for unboxed products; you have to test for these separately.
        There's no reason not to do CPR for recursive product types, for example.
        Ditto splitProductType_maybe.
      
      Simplification
      ~~~~~~~~~~~~~~~
      * New -fno-case-of-case flag for the simplifier.  We use this in the first run
        of the simplifier, where it helps to stop messing up expressions that
        the (subsequent) full laziness pass would otherwise find float out.
        It's much more effective than previous half-baked hacks in inlining.
      
        Actually, it turned out that there were three places in Simplify.lhs that
        needed to know use this flag.
      
      * Make the float-in pass push duplicatable bindings into the branches of
        a case expression, in the hope that we never have to allocate them.
        (see FloatIn.sepBindsByDropPoint)
      
      * Arrange that top-level bottoming Ids get a NOINLINE pragma
        This reduced gratuitous inlining of error messages.
        But arrange that such things still get w/w'd.
      
      * Arrange that a strict argument position is regarded as an 'interesting'
        context, so that if we see
      	foldr k z (g x)
        then we'll be inclined to inline g; this can expose a build.
      
      * There was a missing case in CoreUtils.exprEtaExpandArity that meant
        we were missing some obvious cases for eta expansion
        Also improve the code when handling applications.
      
      * Make record selectors (identifiable by their IdFlavour) into "cheap" operations.
      	  [The change is a 2-liner in CoreUtils.exprIsCheap]
        This means that record selection may be inlined into function bodies, which
        greatly improves the arities of overloaded functions.
      
      * Make a cleaner job of inlining "lone variables".  There was some distributed
        cunning, but I've centralised it all now in SimplUtils.analyseCont, which
        analyses the context of a call to decide whether it is "interesting".
      
      * Don't specialise very small functions in Specialise.specDefn
        It's better to inline it.  Rather like the worker/wrapper case.
      
      * Be just a little more aggressive when floating out of let rhss.
        See comments with Simplify.wantToExpose
        A small change with an occasional big effect.
      
      * Make the inline-size computation think that
      	case x of I# x -> ...
        is *free*.
      
      
      CPR analysis
      ~~~~~~~~~~~~
      * Fix what was essentially a bug in CPR analysis.  Consider
      
      	letrec f x = let g y = let ... in f e1
      		     in
      		     if ... then (a,b) else g x
      
        g has the CPR property if f does; so when generating the final annotated
        RHS for f, we must use an envt in which f is bound to its final abstract
        value.  This wasn't happening.  Instead, f was given the CPR tag but g
        wasn't; but of course the w/w pass gives rotten results in that case!!
        (Because f's CPR-ness relied on g's.)
      
        On they way I tidied up the code in CprAnalyse.  It's quite a bit shorter.
      
        The fact that some data constructors return a constructed product shows
        up in their CPR info (MkId.mkDataConId) not in CprAnalyse.lhs
      
      
      
      Strictness analysis and worker/wrapper
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * BIG THING: pass in the demand to StrictAnal.saExpr.  This affects situations
        like
      	f (let x = e1 in (x,x))
        where f turns out to have strictness u(SS), say.  In this case we can
        mark x as demanded, and use a case expression for it.
      
        The situation before is that we didn't "know" that there is the u(SS)
        demand on the argument, so we simply computed that the body of the let
        expression is lazy in x, and marked x as lazily-demanded.  Then even after
        f was w/w'd we got
      
      	let x = e1 in case (x,x) of (a,b) -> $wf a b
      
        and hence
      
      	let x = e1 in $wf a b
      
        I found a much more complicated situation in spectral/sphere/Main.shade,
        which improved quite a bit with this change.
      
      * Moved the StrictnessInfo type from IdInfo to Demand.  It's the logical
        place for it, and helps avoid module loops
      
      * Do worker/wrapper for coerces even if the arity is zero.  Thus:
      	stdout = coerce Handle (..blurg..)
        ==>
      	wibble = (...blurg...)
      	stdout = coerce Handle wibble
        This is good because I found places where we were saying
      	case coerce t stdout of { MVar a ->
      	...
      	case coerce t stdout of { MVar b ->
      	...
        and the redundant case wasn't getting eliminated because of the coerce.
      111cee3f
  16. 16 Mar, 2000 1 commit
  17. 02 Dec, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-12-02 17:57:13 by simonmar] · 0e9a9af9
      simonmar authored
      Change the convention for cost-centre labels to be <name>_cc and
      cost-centre stacks to be <name>_ccs.  This makes cost-centre labels
      more consistent with our other naming conventions, and fixes some
      problems caused by cost-centre labels being misinterpreted by the
      mangler.
      
      This fixes one cause of profiled programs crashing; if you're seeing
      this symptom then this patch may help.
      0e9a9af9
  18. 02 Nov, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-11-02 15:05:38 by simonmar] · f6692611
      simonmar authored
      This commit adds in the current state of our SMP support.  Notably,
      this allows the new way 's' to be built, providing support for running
      multiple Haskell threads simultaneously on top of any pthreads
      implementation, the idea being to take advantage of commodity SMP
      boxes.
      
      Don't expect to get much of a speedup yet; due to the excessive
      locking required to synchronise access to mutable heap objects, you'll
      see a slowdown in most cases, even on a UP machine.  The best I've
      seen is a 1.6-1.7 speedup on an example that did no locking (two
      optimised nfibs in parallel).
      
      	- new RTS -N flag specifies how many pthreads to start.
      
      	- new driver -smp flag, tells the driver to use way 's'.
      
      	- new compiler -fsmp option (not for user comsumption)
      	  tells the compiler not to generate direct jumps to
      	  thunk entry code.
      
      	- largely rewritten scheduler
      
      	- _ccall_GC is now done by handing back a "token" to the
      	  RTS before executing the ccall; it should now be possible
      	  to execute blocking ccalls in the current thread while
      	  allowing the RTS to continue running Haskell threads as
      	  normal.
      
      	- you can only call thread-safe C libraries from a way 's'
      	  build, of course.
      
      Pthread support is still incomplete, and weird things (including
      deadlocks) are likely to happen.
      f6692611
  19. 13 Oct, 1999 1 commit
    • simonmar's avatar
      [project @ 1999-10-13 16:39:10 by simonmar] · 5c67176d
      simonmar authored
      Crude allocation-counting extension to ticky-ticky profiling.
      
      Allocations are counted against the closest lexically enclosing
      function closure, so you need to map the output back to the STG code.
      5c67176d
  20. 13 May, 1999 1 commit
    • simonm's avatar
      [project @ 1999-05-13 17:30:50 by simonm] · 589b7946
      simonm authored
      Support for "unregisterised" builds.  An unregisterised build doesn't
      use the assembly mangler, doesn't do tail jumping (uses the
      mini-interpreter), and doesn't use global register variables.
      
      Plenty of cleanups and bugfixes in the process.
      
      Add way 'u' to GhcLibWays to get unregisterised libs & RTS.
      
      [ note: not *quite* working fully yet... there's still a bug or two
        lurking ]
      589b7946
  21. 11 May, 1999 1 commit
    • keithw's avatar
      [project @ 1999-05-11 16:44:02 by keithw] · 5c0b6550
      keithw authored
      (this is number 7 of 9 commits to be applied together)
      
        The code generator now incorporates the update avoidance
        optimisation: a thunk of __o type is now made SingleEntry rather
        than Updatable.
      
        We want to verify that SingleEntry thunks are indeed entered at most
        once.  In order to do this, -ticky turns on eager blackholing.
        Ordinary thunks will be dealt with by the RTS, but CAFs are
        blackholed by the code generator.  We blackhole with new blackholes:
        SE_CAF_BLACKHOLE.  We will enter one of these if we attempt to enter
        a SingleEntry thunk twice.
      5c0b6550
  22. 27 Apr, 1999 1 commit
    • simonm's avatar
      [project @ 1999-04-27 12:34:49 by simonm] · 0a4e3ee6
      simonm authored
      - Fix the tagToEnum# support in the code generator
      
      - Make isDeadBinder work on case binders
      
      - Fix compiling of
      
      	case x `op` y of z {
      		True  -> ... z ...
      		False -> ... z ...
      
      - Clean up CgCase a little.
      
      - Don't generate specialised tag2con functions for derived Enum/Ix
        instances; use tagToEnum# instead.
      0a4e3ee6
  23. 02 Mar, 1999 1 commit
  24. 20 Jan, 1999 1 commit
    • simonm's avatar
      [project @ 1999-01-20 16:07:40 by simonm] · 4d2db16b
      simonm authored
      The BLACKHOLEs created when entering a CAF for the first time are now
      CAF_BLACKHOLES, distinguishing them from the blackholes created by
      lazy blackholing.
      
      This enables the lazy blackholing algorithm to be optimised by not
      blackholing a section of stack that has already been traversed.
      4d2db16b
  25. 18 Dec, 1998 1 commit
    • simonpj's avatar
      [project @ 1998-12-18 17:40:31 by simonpj] · 7e602b0a
      simonpj authored
      Another big commit from Simon.  Actually, the last one
      didn't all go into the main trunk; because of a CVS glitch it
      ended up in the wrong branch.
      
      So this commit includes:
      
      * Scoped type variables
      * Warnings for unused variables should work now (they didn't before)
      * Simplifier improvements:
      	- Much better treatment of strict arguments
      	- Better treatment of bottoming Ids
      	- No need for w/w split for fns that are merely strict
      	- Fewer iterations needed, I hope
      * Less gratuitous renaming in interface files and abs C
      * OccName is a separate module, and is an abstract data type
      
      I think the whole Prelude and Exts libraries compile correctly.
      Something isn't quite right about typechecking existentials though.
      7e602b0a
  26. 02 Dec, 1998 1 commit
  27. 19 Mar, 1998 1 commit
  28. 08 Mar, 1998 1 commit
  29. 10 Feb, 1998 1 commit
  30. 29 Jan, 1998 1 commit
  31. 08 Jan, 1998 1 commit
    • simonm's avatar
      [project @ 1998-01-08 18:03:08 by simonm] · 9dd6e1c2
      simonm authored
      The Great Multi-Parameter Type Classes Merge.
      
      Notes from Simon (abridged):
      
      * Multi-parameter type classes are fully implemented.
      * Error messages from the type checker should be noticeably improved
      * Warnings for unused bindings (-fwarn-unused-names)
      * many other minor bug fixes.
      
      Internally there are the following changes
      
      * Removal of Haskell 1.2 compatibility.
      * Dramatic clean-up of the PprStyle stuff.
      * The type Type has been substantially changed.
      * The dictionary for each class is represented by a new
        data type for that purpose, rather than by a tuple.
      9dd6e1c2
  32. 25 Jul, 1997 1 commit
  33. 05 Jul, 1997 1 commit
  34. 10 Jun, 1997 1 commit
  35. 05 Jun, 1997 1 commit
  36. 26 May, 1997 1 commit
  37. 19 May, 1997 1 commit
  38. 14 Mar, 1997 1 commit
  39. 19 Dec, 1996 1 commit
  40. 19 Jul, 1996 1 commit