Skip to content
Snippets Groups Projects
  1. Sep 20, 2016
  2. Sep 09, 2016
    • Alan Zimmerman's avatar
      Add hook for creating ghci external interpreter · 65d9597d
      Alan Zimmerman authored
      Summary:
      The external interpreter is launched by calling
      'System.Process.createProcess' with a 'CreateProcess' parameter.
      
      The current value for this has the 'std_in', 'std_out' and 'std_err'
      fields use the default of 'Inherit', meaning that the remote interpreter
      shares the stdio with the original ghc/ghci process.
      
      This patch introduces a new hook to the DynFlags, which has an
      opportunity to override the 'CreateProcess' fields, launch the process,
      and retrieve the stdio handles actually used.
      
      So if a ghci external interpreter session is launched from the GHC API
      the stdio can be redirected if required, which is useful for tooling/IDE
      integration.
      
      Test Plan: ./validate
      
      Reviewers: austin, hvr, simonmar, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2518
      65d9597d
  3. Aug 30, 2016
    • mniip's avatar
      Tag pointers in interpreted constructors · a25bf267
      mniip authored
      Instead of stg_interp_constr_entry there are now 7 functions (one for
      each value of the tag bits) that tag the constructor pointer before
      returning. This is consistent with compiled constructors' entry code,
      and expectations that compiled code places on compiled constructors. The
      iserv protocol is extended with an extra field that explains what
      pointer tag the constructor should use.
      
      Test Plan: Added tests for #12523
      
      Reviewers: erikd, bgamari, hvr, austin, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: osa1, thomie, rwbarton
      
      Differential Revision: https://phabricator.haskell.org/D2473
      
      GHC Trac Issues: #12523
      a25bf267
  4. Aug 23, 2016
  5. Aug 21, 2016
  6. Jul 22, 2016
    • Simon Marlow's avatar
      Squash space leaks in the result of byteCodeGen · 648fd73a
      Simon Marlow authored
      When loading a large number of modules into GHCi, we collect
      CompiledByteCode for every module and then link it all at the end.
      Space leaks in the CompiledByteCode linger until we traverse it all for
      linking, and possibly longer, if there are bits we don't look at.
      
      This is the nuke-it-from-orbit approach: we deepseq the whole thing
      after code generation. It's the only way to be sure.
      
      Test Plan:
      Heap profile of GHCi while loading nofib/real/anna into GHCi, this patch
      reduces the peak heap usage from ~100M to ~50M.
      
      Reviewers: hvr, austin, bgamari, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2419
      648fd73a
  7. Jul 21, 2016
    • Ömer Sinan Ağacan's avatar
      Implement unboxed sum primitive type · 714bebff
      Ömer Sinan Ağacan authored
      Summary:
      This patch implements primitive unboxed sum types, as described in
      https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes.
      
      Main changes are:
      
      - Add new syntax for unboxed sums types, terms and patterns. Hidden
        behind `-XUnboxedSums`.
      
      - Add unlifted unboxed sum type constructors and data constructors,
        extend type and pattern checkers and desugarer.
      
      - Add new RuntimeRep for unboxed sums.
      
      - Extend unarise pass to translate unboxed sums to unboxed tuples right
        before code generation.
      
      - Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
        code generation when sum values are involved.
      
      - Add user manual section for unboxed sums.
      
      Some other changes:
      
      - Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
        `MultiValAlt` to be able to use those with both sums and tuples.
      
      - Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
        wrong, given an `Any` `TyCon`, there's no way to tell what its kind
        is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.
      
      - Fix some bugs on the way: #12375.
      
      Not included in this patch:
      
      - Update Haddock for new the new unboxed sum syntax.
      
      - `TemplateHaskell` support is left as future work.
      
      For reviewers:
      
      - Front-end code is mostly trivial and adapted from unboxed tuple code
        for type checking, pattern checking, renaming, desugaring etc.
      
      - Main translation routines are in `RepType` and `UnariseStg`.
        Documentation in `UnariseStg` should be enough for understanding
        what's going on.
      
      Credits:
      
      - Johan Tibell wrote the initial front-end and interface file
        extensions.
      
      - Simon Peyton Jones reviewed this patch many times, wrote some code,
        and helped with debugging.
      
      Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
                 simonmar, hvr, erikd
      
      Reviewed By: simonpj
      
      Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
                   thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2259
      714bebff
  8. Jul 20, 2016
  9. Jun 27, 2016
    • Ömer Sinan Ağacan's avatar
      Remove some `undefined`s · 82282e8d
      Ömer Sinan Ağacan authored
      These get annoying when `undefined` is actually used as placeholder in WIP code.
      Some of these were also completely redundant (just call `deAnnotate'` instead of
      `deAnnotate` etc.).
      82282e8d
  10. Jun 24, 2016
  11. Jun 07, 2016
  12. Jun 06, 2016
    • niteria's avatar
      Use UniqDFM for HomePackageTable · 3042a9d8
      niteria authored
      This isn't strictly necessary for deterministic ABIs.
      The results of eltsHpt are consumed in two ways:
      1) they determine the order of linking
      2) if you track the data flow all the family instances get put in
         FamInstEnvs, so the nondeterministic order is forgotten.
      3) same for VectInfo stuff
      4) same for Annotations
      
      The problem is that I haven't found a nice way to do 2. in
      a local way and 1. is nice to have if we went for deterministic
      object files. Besides these maps are keyed on ModuleNames so they
      should be small relative to other things and the overhead should
      be negligible.
      
      As a bonus we also get more specific names.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, hvr, ezyang, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2300
      
      GHC Trac Issues: #4012
      3042a9d8
  13. Jun 02, 2016
  14. May 26, 2016
    • Simon Peyton Jones's avatar
      Fix bytecode gen to deal with rep-polymorphism · 0f1e315b
      Simon Peyton Jones authored
      When faced runtime-rep-polymorphic code from a pattern-synonym
      matcher, the bytecode generator was treating the result as lifted,
      which it isn't.  The fix is just to treat those rep-polymorphic
      continuations like unlifted types, and add a dummy arg.
      
      Trac #12007 is a case in point.
      0f1e315b
  15. May 22, 2016
  16. Apr 17, 2016
    • Tamar Christina's avatar
      Add Windows import library support to the Runtime Linker · 97f2b164
      Tamar Christina authored
      Summary:
      Import libraries are files ending in `.dll.a` and `.lib` depending on which
      compiler creates them (GCC, vs MSVC).
      
      Import Libraries are standard `archive` files that contain object files.
      These object files can have two different formats:
      
      1) The normal COFF Object format for object files
          (contains all ascii data and very little program code, so do not
           try to execute.)
      2) "short import" format which just contains a symbol name and
         the dll in which the symbol can be found.
      
      Import Libraries are useful for two things:
      
      1) Allowing applications that don't support dynamic linking to
         link against the import lib (non-short format) which then
         makes calls into the DLL by loading it at runtime.
      
      2) Allow linking of mutually recursive dlls. if `A.DLL` requires
         `B.DLL` and vice versa, import libs can be used to break the cycle
         as they can be created from the expected exports of the DLLs.
      
      A side effect of having these two capabilities is that Import libs are often
      used to hide specific versions of DLLs behind a non-versioned import lib.
      
      e.g. GCC_S.a (non-conventional import lib) will point to the correct
      `libGCC` DLL. With this support Windows Haskell files can now just link
      to `-lGCC_S` and not have to worry about what the actual name of libGCC is.
      
      Also third party libraries such as `icuuc` use import libs to forward to
      versioned DLLs. e.g. `icuuc.lib` points to `icuuc51.dll` etc.
      
      Test Plan:
      ./validate
      
      Two new tests added T11072gcc T11072msvc
      
      Two binary files have been added to the test folder because the "short"
      import library format doesn't seem to be creatable via `dlltool`
      and requires Microsoft's `lib.exe`.
      
      Reviewers: bgamari, RyanGlScott, erikd, goldfire, austin, hvr
      
      Reviewed By: RyanGlScott, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1696
      
      GHC Trac Issues: #11072
      97f2b164
  17. Apr 14, 2016
  18. Mar 30, 2016
  19. Mar 24, 2016
    • Ben Gamari's avatar
      ErrUtils: Add timings to compiler phases · 8048d51b
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      This adds timings and allocation figures to the compiler's output when
      run with `-v2` in an effort to ease performance analysis.
      
      Todo:
        * Documentation
        * Where else should we add these?
        * Perhaps we should remove some of the now-arguably-redundant
          `showPass` occurrences where they are
        * Must we force more?
        * Perhaps we should place this behind a `-ftimings` instead of `-v2`
      
      Test Plan: `ghc -v2 Test.hs`, look at the output
      
      Reviewers: hvr, goldfire, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: angerman, michalt, niteria, ezyang, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1959
      8048d51b
  20. Feb 25, 2016
    • barrucadu's avatar
      Print which warning-flag controls an emitted warning · bb5afd3c
      barrucadu authored and Herbert Valerio Riedel's avatar Herbert Valerio Riedel committed
      Both gcc and clang tell which warning flag a reported warning can be
      controlled with, this patch makes ghc do the same. More generally, this
      allows for annotated compiler output, where an optional annotation is
      displayed in brackets after the severity.
      
      This also adds a new flag `-f(no-)show-warning-groups` to control
      whether to show which warning-group (such as `-Wall` or `-Wcompat`)
      a warning belongs to. This flag is on by default.
      
      This implements #10752
      
      Reviewed By: quchen, bgamari, hvr
      
      Differential Revision: https://phabricator.haskell.org/D1943
      bb5afd3c
  21. Feb 24, 2016
    • Richard Eisenberg's avatar
      Address #11471 by putting RuntimeRep in kinds. · d8c64e86
      Richard Eisenberg authored
      See Note [TYPE] in TysPrim. There are still some outstanding
      pieces in #11471 though, so this doesn't actually nail the bug.
      
      This commit also contains a few performance improvements:
      
      * Short-cut equality checking of nullary type syns
      
      * Compare types before kinds in eqType
      
      * INLINE coreViewOneStarKind
      
      * Store tycon binders separately from kinds.
      
      This resulted in a ~10% performance improvement in compiling
      the Cabal package. No change in functionality other than
      performance. (This affects the interface file format, though.)
      
      This commit updates the haddock submodule.
      d8c64e86
  22. Feb 05, 2016
  23. Feb 04, 2016
    • Georgios Karachalias's avatar
      Overhaul the Overhauled Pattern Match Checker · 28f951ed
      Georgios Karachalias authored and Ben Gamari's avatar Ben Gamari committed
      Overhaul the Overhauled Pattern Match Checker
      
      * Changed the representation of Value Set Abstractions. Instead of
      using a prefix tree, we now use a list of Value Vector Abstractions.
      The set of constraints Delta for every Value Vector Abstraction is the
      oracle state so that we solve everything only once.
      
      * Instead of doing everything lazily, we prune at once (and in general
      everything is much stricter). Hence, an example written with pattern
      guards is checked in almost the same time as the equivalent with
      pattern matching.
      
      * Do not store the covered and the divergent sets at all. Since what we
      only need is a yes/no (does this clause cover anything? Does it force
      any thunk?) We just keep a boolean for each.
      
      * Removed flags `-Wtoo-many-guards` and `-ffull-guard-reasoning`.
      Replaced with `fmax-pmcheck-iterations=n`. Still debatable what should
      the default `n` be.
      
      * When a guard is for sure not going to contribute anything, we treat
      it as such: The oracle is not called and cases `CGuard`, `UGuard` and
      `DGuard` from the paper are not happening at all (the generation of a
      fresh variable, the unfolding of the pattern list etc.). his combined
      with the above seems to be enough to drop the memory increase for test
      T783 down to 18.7%.
      
      * Do not export function `dsPmWarn` (it is now called directly from
      within `checkSingle` and `checkMatches`).
      
      * Make `PmExprVar` hold a `Name` instead of an `Id`. The term oracle
      does not handle type information so using `Id` was a waste of
      time/space.
      
      * Added testcases T11195, T11303b (data families) and T11374
      
      The patch addresses at least the following:
      Trac #11195, #11276, #11303, #11374, #11162
      
      Test Plan: validate
      
      Reviewers: goldfire, bgamari, hvr, austin
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1795
      28f951ed
  24. Feb 02, 2016
  25. Jan 29, 2016
  26. Jan 27, 2016
    • Simon Marlow's avatar
      Remote GHCi: create cost centre stacks in batches · a496f82d
      Simon Marlow authored
      Towards optimising the binary serialisation that
      -fexternal-interpreter does, this saves quite a bit of time when using
      -fexternal-interpreter with -prof.
      a496f82d
    • Richard Eisenberg's avatar
      Refactor the typechecker to use ExpTypes. · 00cbbab3
      Richard Eisenberg authored
      The idea here is described in [wiki:Typechecker]. Briefly,
      this refactor keeps solid track of "synthesis" mode vs
      "checking" in GHC's bidirectional type-checking algorithm.
      When in synthesis mode, the expected type is just an IORef
      to write to.
      
      In addition, this patch does a significant reworking of
      RebindableSyntax, allowing much more freedom in the types
      of the rebindable operators. For example, we can now have
      `negate :: Int -> Bool` and
      `(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
      is in tcSyntaxOp.
      
      This addresses tickets #11397, #11452, and #11458.
      
      Tests:
        typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
        th/T11452
      00cbbab3
    • Ömer Sinan Ağacan's avatar
      s/unLifted/unlifted for consistency · 4faa1a63
      Ömer Sinan Ağacan authored
      This was causing trouble as we had to remember when to use "unLifted"
      and when to use "unlifted".
      
      "unlifted" is used instead of "unLifted" as it's a single word.
      
      Reviewers: austin, hvr, goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1852
      4faa1a63
    • Tamar Christina's avatar
      Enable RemoteGHCi on Windows · 44a5d51a
      Tamar Christina authored and Ben Gamari's avatar Ben Gamari committed
      Makes the needed changes to make RemoteGHCi work on Windows.
      The approach passes OS Handles areound instead of the Posix Fd
      as on Linux.
      
      The reason is that I could not find any real documentation about
      the behaviour of Windows w.r.t inheritance and Posix FDs.
      
      The implementation with Fd did not seem to be able to find the Fd
      in the child process. Instead I'm using the much better documented
      approach of passing inheriting handles.
      
      This requires a small modification to the `process` library.
      https://github.com/haskell/process/pull/52
      
      Test Plan: ./validate On Windows x86_64
      
      Reviewers: thomie, erikd, bgamari, simonmar, austin, hvr
      
      Reviewed By: simonmar
      
      Subscribers: #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D1836
      
      GHC Trac Issues: #11100
      44a5d51a
  27. Jan 18, 2016
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  28. Jan 15, 2016
    • Peter Trommler's avatar
      Link command line libs to temp so · c6a3e227
      Peter Trommler authored and Ben Gamari's avatar Ben Gamari committed
      Symbols in libraries specified on the GHCis command line are
      not available to compiled modules because shared libraries
      are loaded with local scope. So we link all libraries specified
      on the command line into each temporary shared library.
      
      Test Plan: validate
      
      Reviewers: simonmar, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1631
      
      GHC Trac Issues: #10458
      c6a3e227
  29. Jan 13, 2016
  30. Jan 08, 2016
    • Simon Marlow's avatar
      Enable stack traces with ghci -fexternal-interpreter -prof · 6be09e88
      Simon Marlow authored
      Summary:
      The main goal here is enable stack traces in GHCi.  After this change,
      if you start GHCi like this:
      
        ghci -fexternal-interpreter -prof
      
      (which requires packages to be built for profiling, but not GHC
      itself) then the interpreter manages cost-centre stacks during
      execution and can produce a stack trace on request.  Call locations
      are available for all interpreted code, and any compiled code that was
      built with the `-fprof-auto` familiy of flags.
      
      There are a couple of ways to get a stack trace:
      
      * `error`/`undefined` automatically get one attached
      * `Debug.Trace.traceStack` can be used anywhere, and prints the current
        stack
      
      Because the interpreter is running in a separate process, only the
      interpreted code is running in profiled mode and the compiler itself
      isn't slowed down by profiling.
      
      The GHCi debugger still doesn't work with -fexternal-interpreter,
      although this patch gets it a step closer.  Most of the functionality
      of breakpoints is implemented, but the runtime value introspection is
      still not supported.
      
      Along the way I also did some refactoring and added type arguments to
      the various remote pointer types in `GHCi.RemotePtr`, so there's
      better type safety and documentation in the bridge code between GHC
      and ghc-iserv.
      
      Test Plan: validate
      
      Reviewers: bgamari, ezyang, austin, hvr, goldfire, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1747
      
      GHC Trac Issues: #11047, #11100
      6be09e88
  31. Dec 31, 2015
  32. Dec 27, 2015
    • Georgios Karachalias's avatar
      Adding flags: -ffull-guard-reasoning and too-many-guards · bec5350d
      Georgios Karachalias authored and Ben Gamari's avatar Ben Gamari committed
      Introduction of two new flags, for more precise control over the new
      pattern match checker's behaviour when reasoning about guards. This is
      supposed to address #11195 (and maybe more performance bugs related to
      the NP-Hardness of coverage checking).
      
      Expected behaviour:
      
        * When `-ffull-guard-reasoning` is on, run the new pattern match
          checker in its full power
      
        * When `-ffull-guard-reasoning` is off (the default), for every
          match, check a metric to see whether pattern match checking for it
          has high probability of being non performant (at the the moment we
          check whether the number of guards is over 20 but I would like to
          use a more precise measure in the future). If the probability is
          high:
      
          - Oversimplify the guards (less expressive but more performant)
            and run the checker, and
      
          - Issue a warning about the simplification that happened.
      
      A new flag `-Wtoo-many-guards/-Wno-too-many-guards` suppresses the
      warning about the simplification (useful when combined with -Werror).
      
      Test Plan: validate
      
      Reviewers: goldfire, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1676
      
      GHC Trac Issues: #11195
      bec5350d
Loading