Skip to content
Snippets Groups Projects
  1. Mar 08, 2024
  2. Feb 26, 2024
  3. Feb 24, 2024
  4. Feb 12, 2024
    • Sylvain Henry's avatar
      JS: add support for linking C sources · aef587f6
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Support linking C sources with JS output of the JavaScript backend.
      See the added documentation in the users guide.
      
      The implementation simply extends the JS linker to use the objects (.o)
      that were already produced by the emcc compiler and which were filtered
      out previously. I've also added some options to control the link with C
      functions (see the documentation about pragmas).
      
      With this change I've successfully compiled the direct-sqlite package
      which embeds the sqlite.c database code. Some wrappers are still
      required (see the documentation about wrappers) but everything generic
      enough to be reused for other libraries have been integrated into
      rts/js/mem.js.
      aef587f6
    • Sylvain Henry's avatar
      JS: disable MergeObjsMode test · 55346ede
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      This isn't implemented for JS backend objects.
      55346ede
  5. Feb 08, 2024
    • Ben Gamari's avatar
      Move `base` to `ghc-internal` · 44f6557a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we move a good deal of the implementation of `base` into a new
      package, `ghc-internal` such that it can be evolved independently
      from the user-visible interfaces of `base`.
      
      While we want to isolate implementation from interfaces, naturally, we
      would like to avoid turning `base` into a mere set of module re-exports.
      However, this is a non-trivial undertaking for a variety of reasons:
      
       * `base` contains numerous known-key and wired-in things, requiring
         corresponding changes in the compiler
      
       * `base` contains a significant amount of C code and corresponding
         autoconf logic, which is very fragile and difficult to break apart
      
       * `base` has numerous import cycles, which are currently dealt with via
         carefully balanced `hs-boot` files
      
       * We must not break existing users
      
      To accomplish this migration, I tried the following approaches:
      
      * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
        migration of modules into ghc-internal: this knot is simply too
        intertwined to be easily pulled apart, especially given the rather
        tricky import cycles that it contains)
      
      * [Move-Core]: Moving the "core" connected component of base (roughly
        150 modules) into ghc-internal. While the Haskell side of this seems
        tractable, the C dependencies are very subtle to break apart.
      
      * [Move-Incrementally]:
      
        1. Move all of base into ghc-internal
        2. Examine the module structure and begin moving obvious modules (e.g.
           leaves of the import graph) back into base
        3. Examine the modules remaining in ghc-internal, refactor as necessary
           to facilitate further moves
        4. Go to (2) iterate until the cost/benefit of further moves is
           insufficient to justify continuing
        5. Rename the modules moved into ghc-internal to ensure that they don't
           overlap with those in base
        6. For each module moved into ghc-internal, add a shim module to base
           with the declarations which should be exposed and any requisite
           Haddocks (thus guaranteeing that base will be insulated from changes
           in the export lists of modules in ghc-internal
      
      Here I am using the [Move-Incrementally] approach, which is empirically
      the least painful of the unpleasant options above
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.Cabal
          haddock.base
      Metric Increase:
          MultiComponentModulesRecomp
          T16875
          size_hello_artifact
      44f6557a
    • Matthew Pickering's avatar
      Javascript: Don't filter out rtsDeps list · 20b702b5
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This logic appears to be incorrect as it would drop any dependency which
      was not in a direct dependency of the package being linked.
      
      In the ghc-internals split this started to cause errors because
      `ghc-internal` is not a direct dependency of most packages, and hence
      important symbols to keep which are hard coded into the js runtime were
      getting dropped.
      20b702b5
  6. Feb 06, 2024
    • Zubin's avatar
      driver: Really don't lose track of nodes when we fail to resolve cycles · 532993c8
      Zubin authored and Marge Bot's avatar Marge Bot committed
      This fixes a bug in 8db8d2fd, where we could lose
      track of acyclic components at the start of an unresolved cycle. We now ensure we
      never loose track of any of these components.
      
      As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC:
      
      When viewed without boot files, we have a single SCC
      
      ```
      [REC main:T24275B [main:T24275B {-# SOURCE #-},
                         main:T24275A {-# SOURCE #-}]
           main:T24275A [main:T24275A {-# SOURCE #-}]]
      ```
      
      But with boot files this turns into
      
      ```
      [NONREC main:T24275B {-# SOURCE #-} [],
       REC main:T24275B [main:T24275B {-# SOURCE #-},
                         main:T24275A {-# SOURCE #-}]
          main:T24275A {-# SOURCE #-} [main:T24275B],
       NONREC main:T24275A [main:T24275A {-# SOURCE #-}]]
      ```
      
      Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot.
      However, we treat this entire group as a single "SCC" because it seems so when we
      analyse the graph without taking boot files into account.
      
      Indeed, we must return a single ResolvedCycle element in the BuildPlan for this
      as described in Note [Upsweep].
      
      However, since after resolving this is not a true SCC anymore, `findCycle` fails
      to find a cycle and we have a sub-optimal error message as a result.
      
      To handle this, I extended `findCycle` to not assume its input is an SCC, and to
      try harder to find cycles in its input.
      
      Fixes #24275
      532993c8
    • Andrei Borzenkov's avatar
      Lazy skolemisation for @a-binders (#17594) · f5d3e03c
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      This patch is a preparation for @a-binders implementation.  The main changes are:
      
      * Skolemisation is now prepared to deal with @binders.
        See Note [Skolemisation overview] in GHC.Tc.Utils.Unify.
        Most of the action is in
          - Utils.Unify.matchExpectedFunTys
          - Gen.Pat.tcMatchPats
          - Gen.Expr.tcPolyExprCheck
          - Gen.Binds.tcPolyCheck
      
      Some accompanying refactoring:
      
      * I found that funTyConAppTy_maybe was doing a lot of allocation, and
        rejigged userTypeError_maybe to avoid calling it.
      f5d3e03c
  7. Jan 26, 2024
  8. Jan 10, 2024
    • Zubin's avatar
      testsuite: rename objcpp -> objcxx · 2cf9dd96
      Zubin authored and Marge Bot's avatar Marge Bot committed
      To avoid confusion with C Pre Processsor
      2cf9dd96
    • Zubin's avatar
      driver: Set -DPROFILING when compiling C++ sources with profiling · 09cb57ad
      Zubin authored and Marge Bot's avatar Marge Bot committed
      Earlier, we used to pass all preprocessor flags to the c++ compiler.
      This meant that -DPROFILING was passed to the c++ compiler because
      it was a part of C++ flags
      However, this was incorrect and the behaviour was changed in
      8ff3134e. See #21291.
      
      But that commit exposed this bug where -DPROFILING was no longer being passed
      when compiling c++ sources.
      
      The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is
      enabled to ensure we pass the correct options for the way to both C and C++
      compilers
      
      Fixes #24286
      09cb57ad
  9. Dec 31, 2023
  10. Dec 24, 2023
    • Ben Bellick's avatar
      Deprecate -ddump-json and introduce -fdiagnostics-as-json · dfd670a0
      Ben Bellick authored and Marge Bot's avatar Marge Bot committed
      Addresses #19278
      
      This commit deprecates the underspecified -ddump-json flag and
      introduces a newer, well-specified flag -fdiagnostics-as-json.
      
      Also included is a JSON schema as part of the documentation.
      
      The -ddump-json flag will be slated for removal shortly after this merge.
      dfd670a0
  11. Dec 23, 2023
  12. Dec 08, 2023
  13. Dec 03, 2023
  14. Nov 16, 2023
    • Sylvain Henry's avatar
      Fix unusable units and module reexport interaction (#21097) · cee81370
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      This commit fixes an issue with ModUnusable introduced in df0f148f.
      
      In mkUnusableModuleNameProvidersMap we traverse the list of unusable
      units and generate ModUnusable origin for all the modules they contain:
      exposed modules, hidden modules, and also re-exported modules. To do
      this we have a two-level map:
      
        ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin
      
      So for each module name "M" in broken unit "u" we have:
        "M" -> u:M -> ModUnusable reason
      
      However in the case of module reexports we were using the *target*
      module as a key. E.g. if "u:M" is a reexport for "X" from unit "o":
         "M" -> o:X -> ModUnusable reason
      
      Case 1: suppose a reexport without module renaming (u:M -> o:M) from
      unusable unit u:
         "M" -> o:M -> ModUnusable reason
      
      Here it's claiming that the import of M is unusable because a reexport
      from u is unusable. But if unit o isn't unusable we could also have in
      the map:
         "M" -> o:M -> ModOrigin ...
      
      Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
      (ModUnusable <> ModOrigin)
      
      Case 2: similarly we could have 2 unusable units reexporting the same module
      without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v
      unusable. It gives:
      
        "M" -> o:M -> ModUnusable ... (for u)
        "M" -> o:M -> ModUnusable ... (for v)
      
      Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
      (ModUnusable <> ModUnusable).
      
      This led to #21097, #16996, #11050.
      
      To fix this, in this commit we make ModUnusable track whether the module
      used as key is a reexport or not (for better error messages) and we use
      the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u
      is unusable, we now record:
      
          "M" -> u:M -> ModUnusable reason reexported=True
      
      So now, we have two cases for a reexport u:M -> o:X:
         - u unusable: "M" -> u:M -> ModUnusable ... reexported=True
         - u usable:   "M" -> o:X -> ModOrigin   ... reexportedFrom=u:M
      
      The second case is indexed with o:X because in this case the Semigroup
      instance of ModOrigin is used to combine valid expositions of a module
      (directly or via reexports).
      
      Note that module lookup functions select usable modules first (those who
      have a ModOrigin value), so it doesn't matter if we add new ModUnusable
      entries in the map like this:
      
        "M" -> {
          u:M -> ModUnusable ... reexported=True
          o:M -> ModOrigin ...
        }
      
      The ModOrigin one will be used. Only if there is no ModOrigin or
      ModHidden entry will the ModUnusable error be printed. See T21097 for an
      example printing several reasons why an import is unusable.
      cee81370
  15. Nov 15, 2023
    • Rodrigo Mesquita's avatar
      testsuite: Update to LC_ALL=C no longer being ignored in darwin · ce7fe5a9
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      MacOS seems to have fixed an issue where it used to ignore the variable
      `LC_ALL` in program invocations and default to using Unicode.
      
      Since the behaviour seems to be fixed to account for the locale
      variable, we mark tests that were previously broken in spite of it as
      fragile (since they now pass in recent macOS distributions)
      
      See #24161
      ce7fe5a9
  16. Nov 02, 2023
    • Alan Zimmerman's avatar
      EPA: Use full range for Anchor · 81fb8885
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      This change requires a series of related changes, which must all land
      at the same time, otherwise all the EPA tests break.
      
      * Use the current Anchor end as prior end
      
        Use the original anchor location end as the source of truth for
        calculating print deltas.
      
        This allows original spacing to apply in most cases, only changed
        AST items need initial delta positions.
      
      * Add DArrow to TrailingAnn
      
      * EPA Introduce HasTrailing in ExactPrint
      
         Use [TrailingAnn] in enterAnn and remove it from
         ExactPrint (LocatedN RdrName)
      
      * In HsDo, put TrailingAnns at top of LastStmt
      
      * EPA: do not convert comments to deltas when balancing.
      
      * EPA: deal with fallout from getMonoBind
      
      * EPA fix captureLineSpacing
      
      * EPA print any comments in the span before exiting it
      
      * EPA: Add comments to AnchorOperation
      
      * EPA: remove AnnEofComment, it is no longer used
      
      Updates Haddock submodule
      81fb8885
  17. Oct 20, 2023
  18. Oct 05, 2023
  19. Sep 27, 2023
  20. Sep 21, 2023
  21. Sep 12, 2023
  22. Sep 05, 2023
  23. Aug 17, 2023
  24. Aug 14, 2023
  25. Jul 23, 2023
    • Vladislav Zavialov's avatar
      Visible forall in types of terms: Part 1 (#22326) · 33b6850a
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements part 1 of GHC Proposal #281,
      introducing explicit `type` patterns and `type` arguments.
      
      Summary of the changes:
      
      1. New extension flag:
           RequiredTypeArguments
      
      2. New user-facing syntax:
           `type p` patterns    (represented by EmbTyPat)
           `type e` expressions (represented by HsEmbTy)
      
      3. Functions with required type arguments (visible forall)
         can now be defined and applied:
            idv :: forall a -> a -> a    -- signature   (relevant change: checkVdqOK in GHC/Tc/Validity.hs)
            idv (type a) (x :: a) = x    -- definition  (relevant change: tcPats in GHC/Tc/Gen/Pat.hs)
            x = idv (type Int) 42        -- usage       (relevant change: tcInstFun in GHC/Tc/Gen/App.hs)
      
      4. template-haskell support:
            TH.TypeE corresponds to HsEmbTy
            TH.TypeP corresponds to EmbTyPat
      
      5. Test cases and a new User's Guide section
      
      Changes *not* included here are the t2t (term-to-type) transformation
      and term variable capture; those belong to part 2.
      33b6850a
  26. Jul 08, 2023
  27. Jun 21, 2023
  28. Jun 20, 2023
    • Bodigrim's avatar
      Bump Cabal submodule · 7485f848
      Bodigrim authored and Marge Bot's avatar Marge Bot committed
      This requires changing the recomp007 test because now cabal passes
      `this-unit-id` to executable components, and that unit-id contains a
      hash which includes the ABI of the dependencies. Therefore changing the
      dependencies means that -this-unit-id changes and recompilation is
      triggered.
      
      The spririt of the test is to test GHC's recompilation logic assuming
      that `-this-unit-id` is constant, so we explicitly pass `-ipid` to
      `./configure` rather than letting `Cabal` work it out.
      7485f848
  29. Jun 15, 2023
Loading