1. 11 Dec, 2001 3 commits
  2. 10 Dec, 2001 10 commits
    • sewardj's avatar
      [project @ 2001-12-10 18:04:51 by sewardj] · 0d1a15fd
      sewardj authored
      Add just enough infrastructure to the NCG that it can deal with simple 64-bit
      code on 32-bit platforms.  Main changes are:
      
      * Addition of a simple 64-bit instruction selection fn iselExpr64 to MachCode.
        This generates code for a 64-bit value and places the results into two
        virtual registers, related thusly:
      
      * Add a new type VRegUnique, which is used to label Stix virtual registers.
        This type used to be a plain Unique, but that forces the assumption that
        each Abstract-C level C temporary corresponds to exactly one Stix virtual
        register, which is untrue when the C temporary is 64-bit sized on a
        32-bit machine.  In the new scheme, the Unique for the C temporary can
        turn into two related VRegUniques, related by having the same embedded
        unique.
      
      * Made a start on 'target metrics' by adding ncg_target_is_32bits to the
        end of Stix.lhs.
      
      * Cleaned up numerous other gruesomenesses in the NCG which never came
        to light before now.   Got rid of MachMisc.sizeOf, which doesn't make
        sense in a 64-bit setting, and replaced it by calls to
        PrimRep.getPrimRepArrayElemSize, which, as far as I'm concerned, is the
        definitive answer to the questio `How Big Is This PrimRep Really?'
      
      Result: on x86-linux, at least, you can now compile the Entire Prelude
      with -fasm!  At this stage I cannot claim that the resulting code is
      correct, but it's a start.
      0d1a15fd
    • simonmar's avatar
      [project @ 2001-12-10 14:08:58 by simonmar] · c72549be
      simonmar authored
      Some lifting of the lazy parts of the parse tree so we don't parse too
      much when using happy --strict.
      c72549be
    • simonmar's avatar
      [project @ 2001-12-10 14:08:14 by simonmar] · c5d45a35
      simonmar authored
      The flag -fno-cpr is now only present in a DEBUG compiler.
      c5d45a35
    • simonmar's avatar
      [project @ 2001-12-10 14:07:30 by simonmar] · 973539a8
      simonmar authored
      Make the inclusion of the old strictness analyser, CPR analyser, and
      the relevant IdInfo components, conditional on DEBUG.  This makes
      IdInfo smaller by three fields in a non-DEBUG compiler, and reduces
      the risk that the unused fields could harbour space leaks.
      
      Eventually these passes will go away altogether.
      973539a8
    • simonmar's avatar
      [project @ 2001-12-10 14:05:06 by simonmar] · a0cb0c4b
      simonmar authored
      Note that the final call to coreBindsSize is still necessary to
      eliminate space leakage from the simplifier.
      a0cb0c4b
    • simonmar's avatar
      [project @ 2001-12-10 14:02:45 by simonmar] · fca21bb3
      simonmar authored
      Print the "type description" of a closure for profiling as the user
      string, not the Z-encoded string.  Fixes problems with things like
      'ZMZN' appearing in profiling output.
      fca21bb3
    • simonmar's avatar
      [project @ 2001-12-10 14:00:35 by simonmar] · ccaf7b66
      simonmar authored
      Make the OccName and SrcLoc fields of a Name strict, to eliminate
      space leaks.  This doesn't hurt performance.
      ccaf7b66
    • simonmar's avatar
      [project @ 2001-12-10 13:54:35 by simonmar] · 2e346fb3
      simonmar authored
      Don't force the IdInfo of a variable *occurrence* in exprSize, just
      the binding sites should be enough.
      2e346fb3
    • simonpj's avatar
      [project @ 2001-12-10 12:26:10 by simonpj] · 7953d080
      simonpj authored
      ------------------------------
      	Don't do CPR w/w for constants
      	------------------------------
      
      We don't want to do a CPR split for a constant
      function.  So if the worker will get no (value) args,
      we disable the CPR transformation.
      
      This infelicity exposed a buglet in the full laziness
      transformation; we were floating an expression outside
      an InlineMe context.   I've take the blunderbuss approach
      now, of effectively disabling full laziness inside an
      InlineMe.  Seems reasonable.
      7953d080
    • sebc's avatar
      [project @ 2001-12-10 01:27:59 by sebc] · 5ca4a013
      sebc authored
      MacOS X 10.1 identifies as "darwin"
      5ca4a013
  3. 07 Dec, 2001 6 commits
    • simonpj's avatar
      [project @ 2001-12-07 17:33:26 by simonpj] · 8cc5cc27
      simonpj authored
      ----------------------------
      	More jiggling in the renamer
      	----------------------------
      
      I was a little hasty before.  (Thanks Sigbjorn for finding
      this.)  This commit tidies up the handling of AvailEnvs.
      Principally:
      
        * filterImports now deals completely with hiding
          (before it handed off part of the job to mkGlobalRdrEnv)
      
        * The AvailEnv in an ExportAvails does not have class ops and
          data constructors in its domain.  This makes plusExportAvails
          more efficient, but the main thing is that it collects things
          up right.  (Previously, if we had
      	import M( C )
      	import M( op )
          then we got an AvailEnv which had C |-> AvailTC C [C]
          (no 'op').
      
        * In Rename, we do need a "filled-out" version of the overall
          AvailEnv, full_avail_env, which we construct on the spot in 'rename'.
      8cc5cc27
    • sof's avatar
      [project @ 2001-12-07 15:49:41 by sof] · f50db2a9
      sof authored
      Track the removal of ReallyUnsafePtrEqualityOp + InterTo{Int,Word}64Op primops.
      f50db2a9
    • sewardj's avatar
      [project @ 2001-12-07 11:34:48 by sewardj] · 5861bb81
      sewardj authored
      Change the story on shifting primops: SllOp, SrlOp, ISllOp, ISraOp, ISrlOp.
      
      In the old primop story, these were implemented by C macros which
      checked that the shift amount did not exceed the word size, and if so
      returns a suitable value (0 or -1).  This gives consistent, defined
      behaviour for any shift amount.  However, these checks were not
      implemented on the NCG route, an inconsistency.
      
      New story: these primops do NOT check their args; they just do the shift.
      Shift values >= word size give undefined results.  To reflect this, their
      Haskell names have been prefixed with 'unchecked'.
      
      The checks are now done on the Bits instances in the Prelude.  This means
      all code generation routes are consistently checked, and hopefully the
      simplifier will remove the checks for literal shift amounts.
      
      I have tried to fix up the implementation for 64-bit platforms too, but
      not having one to hand, I don't know if it will work as-is.
      5861bb81
    • sewardj's avatar
      [project @ 2001-12-07 11:27:09 by sewardj] · a523b9fb
      sewardj authored
      Comments only.
      a523b9fb
    • sof's avatar
      [project @ 2001-12-07 08:12:53 by sof] · c5ba8422
      sof authored
      mkExportAvails: computing the AvailEnv is rather delicate
      c5ba8422
    • sof's avatar
      [project @ 2001-12-07 07:37:43 by sof] · 24279879
      sof authored
      Tidyup - previous instance-decl commit fell a bit short:
      
       * RnEnv.lookupInstDeclBndr unceremoniously fell over when passed
         an out-of-scope class name.
      
       * the AvailEnv carried around didn't common up type/class info
         (i.e.,  AvailTCs), but rather type/class and method/label names,
         causing the renamer to (semi)randomly report instance methods as
         being out-of-scope in the presence of multiple imports for a module.
      
       * didn't support 'hiding' of class / method names (for the purposes
         of checking instance decls).
      24279879
  4. 06 Dec, 2001 7 commits
    • simonmar's avatar
      [project @ 2001-12-06 17:33:30 by simonmar] · 8408f316
      simonmar authored
      Make the Name field of a Var strict - it doesn't hurt performance (in
      fact it makes a tiny improvement) but it can help residency.
      8408f316
    • simonmar's avatar
      [project @ 2001-12-06 14:42:56 by simonmar] · b1c3d11a
      simonmar authored
      Turn a lazy pattern match into a strict one in tidyIdBndr.  This
      prevents us accidentally hanging onto stuff in the OccName field of a
      Name after tidying.
      b1c3d11a
    • sewardj's avatar
      [project @ 2001-12-06 13:09:19 by sewardj] · 5fdd7ebe
      sewardj authored
      Make it compile -DDEBUG.
      5fdd7ebe
    • sewardj's avatar
      [project @ 2001-12-06 11:50:07 by sewardj] · 530086f6
      sewardj authored
      Add constructor CBytesPerWord to (the wildly-misnamed) CAddrMode, and
      use this in various places to remove word size dependencies in the
      C -> C simplification pass.  Tart up the Stix constant folder a bit
      so as to be able to fold out the shift/mask literal expressions.
      530086f6
    • simonpj's avatar
      [project @ 2001-12-06 10:45:42 by simonpj] · 61fae1d3
      simonpj authored
      --------------------------
      	Fix the instance-decl wart
      	--------------------------
      
      This commit implements the (proposed) H98 rule for
      resolving the class-method name in an instance decl.
      
      	module M( C( op1, op2 ) ) where
      		-- NB: op3 not exported
      	  class C a where
      	    op1, op2, op3 :: a -> a
      
      
      	module N where
      	  import qualified M as P( C )
      	  import qualified M as Q hiding( op2 )
      
      	  instance P.C Int where
      	    op1 x = x
      	    -- op2, op3 both illegal here
      
      The point is that
        a) only methods that can be named are legal
           in the instance decl
      	(so op2, op3 are not legal)
        b) but it doesn't matter *how* they can be named
      	(in this case Q.op1 is in scope, though
      	the class is called P.C)
      
      The AvailEnv carries the information about what's in scope,
      so we now have to carry it around in the monad, so that
      instance decl bindings can see it.  Quite simple really.
      
      Same deal for export lists. E.g.
      
      	module N( P.C( op1 ) ) where
      	  import qualified M as P( C )
      	  import qualified M as Q hiding( op2 )
      
      Actually this is what GHC has always implemented!
      61fae1d3
    • simonpj's avatar
      [project @ 2001-12-06 10:45:14 by simonpj] · 94cf74b8
      simonpj authored
      Comments only
      94cf74b8
    • simonpj's avatar
      [project @ 2001-12-06 09:21:31 by simonpj] · d88a1d8c
      simonpj authored
      Fix the simplIdInfo inconsistency Sigbjorn found
      d88a1d8c
  5. 05 Dec, 2001 9 commits
    • sof's avatar
      [project @ 2001-12-05 19:24:53 by sof] · a5b2186d
      sof authored
      oops, changes not tested with a stage2 build
      a5b2186d
    • sewardj's avatar
      [project @ 2001-12-05 17:35:12 by sewardj] · d11e681f
      sewardj authored
      --------------------------------------------
              Translate out PrimOps at the AbstractC level
              --------------------------------------------
      
      This is the first in what might be a series of changes intended
      to make GHC less dependent on its C back end.  The main change is
      to translate PrimOps into vanilla abstract C inside the compiler,
      rather than having to duplicate that work in each code generation
      route.  The main changes are:
      
      * A new type, MachOp, in compiler/absCSyn/MachOp.hs.  A MachOp
        is a primitive operation which we can reasonably expect the
        native code generators to implement.  The set is quite small
        and unlikely to change much, if at all.
      
      * Translations from PrimOps to MachOps, at the end of
        absCSyn/AbsCUtils.  This should perhaps be moved to a different
        module, but it is hard to see how to do this without creating
        a circular dep between it and AbsCUtils.
      
      * The x86 insn selector has been updated to track these changes.  The
        sparc insn selector remains to be done.
      
      As a result of this, it is possible to compile much more code via the
      NCG than before.  Almost all the Prelude can be compiled with it.
      Currently it does not know how to do 64-bit code generation.  Once
      this is fixed, the entire Prelude should be compilable that way.
      
      I also took the opportunity to clean up the NCG infrastructure.
      The old Stix data type has been split into StixStmt (statements)
      and StixExpr (now denoting values only).  This removes a class
      of impossible constructions and clarifies the NCG.
      
      Still to do, in no particular order:
      
      * String and literal lifting, currently done in the NCG at the top
        of nativeGen/MachCode, should be done in the AbstractC flattener,
        for the benefit of all targets.
      
      * Further cleaning up of Stix assignments.
      
      * Remove word-size dependency from Abstract C.  (should be easy).
      
      * Translate out MagicIds in the AbsC -> Stix translation, not
        in the Stix constant folder. (!)
      
      Testsuite failures caused by this:
      
      * memo001 - fails (segfaults) for some unknown reason now.
      * arith003 - wrong answer in gcdInt boundary cases.
      * arith011 - wrong answer for shifts >= word size.
      * cg044 - wrong answer for some FP boundary cases.
      
      These should be fixed, but I don't think they are mission-critical for
      anyone.
      d11e681f
    • sof's avatar
      [project @ 2001-12-05 16:29:54 by sof] · 20baa4d6
      sof authored
      make it compile - i.e., use Subst.simplIdInfo in a manner
      consistent with the repo contents. (wouldn't surprise me
      if there's coreSyn/Subst.lhs change that hasn't been
      committed yet...)
      20baa4d6
    • simonpj's avatar
      [project @ 2001-12-05 15:00:21 by simonpj] · b6fc6104
      simonpj authored
      Preserve IdInfo for strict binders
      b6fc6104
    • simonmar's avatar
      [project @ 2001-12-05 13:52:19 by simonmar] · 966c5772
      simonmar authored
      Make some record selections strict to reduce space leaks.
      966c5772
    • simonmar's avatar
      [project @ 2001-12-05 11:05:21 by simonmar] · 9e94a1af
      simonmar authored
      Add seqDemand, seqDemands, seqDmdType and seqStrictSig.
      9e94a1af
    • simonmar's avatar
      [project @ 2001-12-05 11:00:24 by simonmar] · d0d6d186
      simonmar authored
      - fix a space leak in the cg_env passed back from the code generator
        to CoreTidy that was keeping the result of CoreToStg alive through
        code generation.
      
      - some cost centre changes
      d0d6d186
    • sof's avatar
      [project @ 2001-12-05 00:08:26 by sof] · 099c2716
      sof authored
      - new option, -keep-ilx-file, for stashing away ILX input.
      - restrict ILX-specific code/defs to only be visible iff ILX is #defined.
      099c2716
    • sof's avatar
      [project @ 2001-12-05 00:06:32 by sof] · 6e5735b5
      sof authored
      reuse Panic.showGhcException
      6e5735b5
  6. 04 Dec, 2001 5 commits