Skip to content
Snippets Groups Projects
  1. Feb 08, 2024
    • 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
  2. Feb 07, 2024
    • jeffrey young's avatar
      ts: add wasm_arch, heapprof002 wasm extension · 75a31379
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      75a31379
    • jeffrey young's avatar
      ts: add compile_artifact, ignore_extension flag · 569b4c10
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      In b5213542 the testsuite gained the
      capability to collect generic metrics. But this assumed that the test
      was not linking and producing artifacts and we only wanted to track
      object files, interface files, or build artifacts from the compiler
      build. However, some backends, such as the JS backend, produce artifacts when
      compiling, such as the jsexe directory which we want to track.
      
      This patch:
      
      - tweaks the testsuite to collect generic metrics on any build artifact
      in the test directory.
      
      - expands the exe_extension function to consider windows and adds the
      ignore_extension flag.
      
      - Modifies certain tests to add the ignore_extension flag. Tests such as
      heaprof002 expect a .ps file, but on windows without ignore_extensions
      the testsuite will look for foo.exe.ps. Hence the flag.
      
      - adds the size_hello_artifact test
      569b4c10
  3. Feb 06, 2024
    • Zubin's avatar
      testsuite: Add test for #24327 · b09e6958
      Zubin authored and Marge Bot's avatar Marge Bot committed
      b09e6958
    • 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
  4. Feb 05, 2024
    • Andrei Borzenkov's avatar
      ce90f12f
    • Simon Peyton Jones's avatar
      Stop dropping a case whose binder is demanded · cfd68290
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR fixes #24251.
      
      See Note [Case-to-let for strictly-used binders]
      in GHC.Core.Opt.Simplify.Iteration, plus #24251, for
      lots of discussion.
      
      Final Nofib changes over 0.1%:
      +-----------------------------------------
      |        imaginary/digits-of-e2    -2.16%
      |                imaginary/rfib    -0.15%
      |                    real/fluid    -0.10%
      |                   real/gamteb    -1.47%
      |                       real/gg    -0.20%
      |                 real/maillist    +0.19%
      |                      real/pic    -0.23%
      |                      real/scs    -0.43%
      |               shootout/n-body    -0.41%
      |        shootout/spectral-norm    -0.12%
      +========================================
      |                     geom mean    -0.05%
      
      Pleasingly, overall executable size is down by just over 1%.
      
      Compile times (in perf/compiler) wobble around a bit +/- 0.5%, but the
      geometric mean is -0.1% which seems good.
      cfd68290
  5. Feb 03, 2024
    • Apoorv Ingle's avatar
      Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. · 5ff7cc26
      Apoorv Ingle authored
      - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206
      
      - The change is detailed in
        - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
        - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr`
               expains the rational of doing expansions in type checker as opposed to in the renamer
      
      - Adds new datatypes:
        - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier
          1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`)
          2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack
      
        - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated
          This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam`
      
        - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc`
      
      - Ensures warnings such as
        1. Pattern match checks
        2. Failable patterns
        3. non-() return in body statements are preserved
      
      - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker`
      
      - Testcases:
        * T18324 T20020 T23147 T22788 T15598 T22086
        * T23147b (error message check),
        * DoubleMatch (match inside a match for pmc check)
        * pattern-fails (check pattern match with non-refutable pattern, eg. newtype)
        * Simple-rec (rec statements inside do statment)
        * T22788 (code snippet from #22788)
        * DoExpanion1 (Error messages for body statments)
        * DoExpansion2 (Error messages for bind statements)
        * DoExpansion3 (Error messages for let statements)
      
      Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass
      
      Metric Increase 'compile_time/bytes allocated':
          T9020
      
      The testcase is a pathalogical example of a `do`-block with many statements that do nothing.
      Given that we are expanding the statements into function binds, we will have to bear
      a (small) 2% cost upfront in the compiler to unroll the statements.
      5ff7cc26
    • Matthew Craven's avatar
      Bump bytestring submodule to something closer to 0.12.1 · 27020458
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      ...mostly so that 16d6b7e835ffdcf9b894e79f933dd52348dedd0c
      (which reworks unaligned writes in Builder) and the stuff in
      https://github.com/haskell/bytestring/pull/631 can see wider testing.
      
      The less-terrible code for unaligned writes used in Builder on
      hosts not known to be ulaigned-friendly also takes less effort
      for GHC to compile, resulting in a metric decrease for T21839c
      on some platforms.
      
      The metric increase on T21839r is caused by the unrelated commit
      750dac33465e7b59100698a330b44de7049a345c.  It perhaps warrants
      further analysis and discussion (see #23822) but is not critical.
      
      Metric Decrease:
      T21839c
      Metric Increase:
      T21839r
      27020458
  6. Feb 01, 2024
    • Andrei Borzenkov's avatar
      Namespacing for WARNING/DEPRECATED pragmas (#24396) · 151dda4e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      New syntax for WARNING and DEPRECATED pragmas was added,
      namely namespace specifierss:
      
        namespace_spec ::= 'type' | 'data' | {- empty -}
      
        warning ::= warning_category namespace_spec namelist strings
      
        deprecation ::= namespace_spec namelist strings
      
      A new data type was introduced to represent these namespace specifiers:
      
        data NamespaceSpecifier =
          NoSpecifier |
          TypeNamespaceSpecifier (EpToken "type") |
          DataNamespaceSpecifier (EpToken "data")
      
      Extension field XWarning now contains this NamespaceSpecifier.
      
      lookupBindGroupOcc function was changed: it now takes NamespaceSpecifier
      and checks that the namespace of the found names matches the passed flag.
      With this change {-# WARNING data D "..." #-} pragma will only affect value
      namespace and {-# WARNING type D "..." #-} will only affect type
      namespace. The same logic is applicable to DEPRECATED pragmas.
      
      Finding duplicated warnings inside rnSrcWarnDecls now takes into
      consideration NamespaceSpecifier flag to allow warnings with the
      same names that refer to different namespaces.
      151dda4e
  7. Jan 31, 2024
  8. Jan 29, 2024
  9. Jan 26, 2024
  10. Jan 24, 2024
    • sheaf's avatar
      Fix FMA instruction on LLVM · a40f4ab2
      sheaf authored and Marge Bot's avatar Marge Bot committed
      We were emitting the wrong instructions for fused multiply-add
      operations on LLVM:
      
        - the instruction name is "llvm.fma.f32" or "llvm.fma.f64", not "fmadd"
        - LLVM does not support other instructions such as "fmsub"; instead
          we implement these by flipping signs of some arguments
        - the instruction is an LLVM intrinsic, which requires handling it
          like a normal function call instead of a machine instruction
      
      Fixes #24223
      a40f4ab2
    • Cheng Shao's avatar
      rts: enable wasm32 register mapping · 0cda2b8b
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      The wasm backend didn't properly make use of all Cmm global registers
      due to #24347. Now that it is fixed, this patch re-enables full
      register mapping for wasm32, and we can now generate smaller & faster
      wasm modules that doesn't always spill arguments onto the stack. Fixes #22460 #24152.
      0cda2b8b
  11. Jan 20, 2024
  12. Jan 19, 2024
  13. Jan 17, 2024
    • Cheng Shao's avatar
      base: treat all FDs as "nonblocking" on wasm · 2eca52b4
      Cheng Shao authored
      On posix platforms, when performing read/write on FDs, we check the
      nonblocking flag first. For FDs without this flag (e.g. stdout), we
      call fdReady() first, which in turn calls poll() to wait for I/O to be
      available on that FD. This is problematic for wasm32-wasi: although
      select()/poll() is supported via the poll_oneoff() wasi syscall, that
      syscall is rather heavyweight and runtime behavior differs in
      different wasi implementations. The issue is even worse when targeting
      browsers, given there's no satisfactory way to implement async I/O as
      a synchronous syscall, so existing JS polyfills for wasi often give up
      and simply return ENOSYS.
      
      Before we have a proper I/O manager that avoids poll_oneoff() for
      async I/O on wasm, this patch improves the status quo a lot by merely
      pretending all FDs are "nonblocking". Read/write on FDs will directly
      invoke read()/write(), which are much more reliably handled in
      existing wasi implementations, especially those in browsers.
      
      Fixes #23275 and the following test cases: T7773 isEOF001 openFile009
      T4808 cgrun025
      
      Approved by CLC proposal #234:
      https://github.com/haskell/core-libraries-committee/issues/234
      2eca52b4
  14. Jan 15, 2024
    • sheaf's avatar
      Use lookupOccRn_maybe in TH.lookupName · c5fc7304
      sheaf authored and Marge Bot's avatar Marge Bot committed
      When looking up a value, we want to be able to find both variables
      and record fields. So we should not use the lookupSameOccRn_maybe
      function, as we can't know ahead of time which record field namespace
      a record field with the given textual name will belong to.
      
      Fixes #24293
      c5fc7304
  15. Jan 14, 2024
  16. Jan 13, 2024
  17. Jan 10, 2024
  18. Jan 08, 2024
Loading