gitignore: Ignore tests/rts/rdynamic

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
submodule update hpc/stm with gitignore.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Do not zero out version number when processing wired-in packages.

Summary:
Previously, GHC would look for instances of wired-in packages in the
in-memory package database and null out the version number.  This was
necessary when the sourcePackageId was used to determine the linker
symbols; however, we now use a package key, so only that needs to be
updated.

Long-term, we can remove this hack by ensuring that Cabal actually records
the proper package key in the database.  This will also fix an unrelated
hack elsewhere.

Keeping version numbers means that wired in packages get rendered differently
when output by GHC.  This is the source of all the test-case output changes.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: hvr, austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D170
Revert "rts/base: Fix #9423"

This should fix the Windows fallout, and hopefully this will be fixed
once that's sorted out.

This reverts commit f9f89b7884ccc8ee5047cf4fffdf2b36df6832df.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Normalise GHC version number to make tests less fragile.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Enable GHC API tests by default.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
testsuite: T7815 requires SMP support from ghc

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: disable gcc's warnings about casts of incompatible prototypes in UNREG

Haskell's 'foreign import' declaraion does not have a way
to extress exact C prototypes (it ignores 'const' modifiers, exact pointer
types, etc.) which leads to warnings when C backend generates calls to such
functions:

    /tmp/ghc32698_0/ghc32698_10.hc:52:5:
         warning: conflicting types for built-in function ‘strlen’ [enabled by default]
         EF_(strlen);
             ^

Patch disables builtin functions for UNREG build
to workaround test failures due to stderr mismatch.

Fixes the following test failures:
    TEST="safePkg01 T5423 T7574 T3736"

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: disable memcpy asm comparison tests on UNREG

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
testsuite: mark testwsdeque mark as faulty on NOSMP builds

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
rts/Linker.c: declare 'deRefStablePtr' as an exported 'rts' symbol

    $ inplace/bin/ghc-stage2 -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -optc-fno-builtin -fno-ghci-history \
        testsuite/tests/ffi/should_run/T4038.hs --interactive -v0 -ignore-dot-ghci +RTS -I0.1 -RTS

    *Main> main
    <interactive>: /tmp/ghc16668_0/ghc16668_5.o: unknown symbol `deRefStablePtr'

The reference to 'deRefStablePtr' is generated by 'compiler/deSugar/DsForeign.lhs':
    the_cfun
       = case maybe_target of
          Nothing    -> text "(StgClosure*)deRefStablePtr(the_stableptr)"
          Just hs_fn -> char '&' <> ppr hs_fn <> text "_closure"

Patch fixes all broken tests using 'import wrapper':
    TEST="ffi013 ffi010 ffi011 ffi005 ffi020 ffi006 ffi019 fed001 T1679 T4038"

Tests manifested as broken only in DYNAMIC_GHC_PROGRAMS=NO builds,
where GHCi's custom linker is used instead of system's linker.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Add MO_AddIntC, MO_SubIntC MachOps and implement in X86 backend

Summary:
These MachOps are used by addIntC# and subIntC#, which in turn are
used in integer-gmp when adding or subtracting small Integers. The
following benchmark shows a ~6% speedup after this commit on x86_64
(building GHC with BuildFlavour=perf).

    {-# LANGUAGE MagicHash #-}

    import GHC.Exts
    import Criterion.Main

    count :: Int -> Integer
    count (I# n#) = go n# 0
      where go :: Int# -> Integer -> Integer
            go 0# acc = acc
            go n# acc = go (n# -# 1#) $! acc + 1

    main = defaultMain [bgroup "count"
                          [bench "100" $ whnf count 100]]

Differential Revision: https://phabricator.haskell.org/D140
testsuite: added 'bytes allocated' for T9339 wordsize(32)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Declare official GitHub home of libraries/{directory,process}

Effective immediately, pushing to libraries/{directory,process} requires
pushing to ssh://git@github.com/haskell/{directory.process}.git. This has
been done now even though there's no scripted tooling yet as the GitHub repo
was already getting issues filed.
testsuite: add 16-byte case for T9329

Exposes Issue #9512 on amd64

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Use DumpStyle rather than UserStyle for pprTrace output

The main motivation is that user-style output assumes that everything has been
tidied, not enough uniques are printed by default.

The downside is that pprTrace output now has module prefixes which can be overwhelming,
but -dsuppress-module-prefixes will suppress them.
Introduce the Call data types

This is just a small refactoring that makes the code a bit clearer,
using a data type instead of a triple.  We get better pretty-printing too.
Do not duplicate call information in SpecConstr (Trac #8852)

This long-standing and egregious bug meant that call information was
being gratuitously copied, leading to an exponential blowup in the
number of calls to be examined when function definitions are deeply
nested.  That is what has been causing the blowup in SpecConstr's
running time, not (as I had previously supposed) generating very large code.

See Note [spec_usg includes rhs_usg]
More refactoring in SpecConstr

This patch should make no change in behaviour.

 * Make RhsInfo into a record

 * Include ri_rhs_usg, which previously travelled around separately

 * Introduce specRec, specNonRec, and
   make them return [OneSpec] rather than SpecInfo
Make Core Lint check for un-saturated type applications

Un-saturated type-family and type-synonym applications are
detected in the front end, but for some reason Lint wasn't
looking for them.

I came across this when wondering why Trac #9433 didn't give
a Core Lint error