summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim
Commit message (Collapse)AuthorAgeFilesLines
* [ci skip] ghc-prim: Update .gitignoreAustin Seipp2014-08-281-0/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Specialise Eq, Ord, Read, Show at Int, Char, StringSimon Peyton Jones2014-08-281-0/+4
| | | | | These instances are quite common, so it's good to have pre-specialised versions available
* Workaround GCC `__ctzdi2` intrinsic linker errorsHerbert Valerio Riedel2014-08-171-1/+17
| | | | | | | | | | | | | | | | | | | | | | | On Linux/i386 the 64bit `__builtin_ctzll()` instrinsic doesn't get inlined by GCC but rather a short `__ctzdi2` runtime function is inserted when needed into compiled object files. This causes failures for the four test-cases TEST="T8639_api T8628 dynCompileExpr T5313" with error messages of the kind dynCompileExpr: .../libraries/ghc-prim/dist-install/build/libHSghcpr_BE58KUgBe9ELCsPXiJ1Q2r.a: unknown symbol `__ctzdi2' dynCompileExpr: dynCompileExpr: unable to load package `ghc-prim' This workaround forces GCC on 32bit x86 to to express `hs_ctz64` in terms of the 32bit `__builtin_ctz()` (this is no loss, as there's no 64bit BSF instruction on i686 anyway) and thus avoid the problematic out-of-line runtime function. Note: `__builtin_ctzll()` is used since e0c1767d0ea8d12e0a4badf43682a08784e379c6 (re #9340)
* Implement new CLZ and CTZ primops (re #9340)Herbert Valerio Riedel2014-08-143-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | This implements the new primops clz#, clz32#, clz64#, ctz#, ctz32#, ctz64# which provide efficient implementations of the popular count-leading-zero and count-trailing-zero respectively (see testcase for a pure Haskell reference implementation). On x86, NCG as well as LLVM generates code based on the BSF/BSR instructions (which need extra logic to make the 0-case well-defined). Test Plan: validate and succesful tests on i686 and amd64 Reviewers: rwbarton, simonmar, ezyang, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D144 GHC Trac Issues: #9340
* Remove obsolete "-- #hide" Haddock pragmasReid Barton2014-08-092-2/+0
| | | | The modules already have the modern version {-# OPTIONS_HADDOCK hide #-}.
* Tweak Haddock in GHC.TypesReid Barton2014-08-091-2/+2
|
* Tweak Haddock markup in GHC.MagicReid Barton2014-08-091-6/+6
|
* Package keys (for linking/type equality) separated from package IDs.Edward Z. Yang2014-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch set makes us no longer assume that a package key is a human readable string, leaving Cabal free to "do whatever it wants" to allocate keys; we'll look up the PackageId in the database to display to the user. This also means we have a new level of qualifier decisions to make at the package level, and rewriting some Safe Haskell error reporting code to DTRT. Additionally, we adjust the build system to use a new ghc-cabal output Make variable PACKAGE_KEY to determine library names and other things, rather than concatenating PACKAGE/VERSION as before. Adds a new `-this-package-key` flag to subsume the old, erroneously named `-package-name` flag, and `-package-key` to select packages by package key. RFC: The md5 hashes are pretty tough on the eye, as far as the file system is concerned :( ToDo: safePkg01 test had its output updated, but the fix is not really right: the rest of the dependencies are truncated due to the fact the we're only grepping a single line, but ghc-pkg is wrapping its output. ToDo: In a later commit, update all submodules to stop using -package-name and use -this-package-key. For now, we don't do it to avoid submodule explosion. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D80
* Re-add more primops for atomic ops on byte arraysJohan Tibell2014-06-302-0/+307
| | | | | | | | | | | | | | | | | | | | | | | This is the second attempt to add this functionality. The first attempt was reverted in 950fcae46a82569e7cd1fba1637a23b419e00ecd, due to register allocator failure on x86. Given how the register allocator currently works, we don't have enough registers on x86 to support cmpxchg using complicated addressing modes. Instead we fall back to a simpler addressing mode on x86. Adds the following primops: * atomicReadIntArray# * atomicWriteIntArray# * fetchSubIntArray# * fetchOrIntArray# * fetchXorIntArray# * fetchAndIntArray# Makes these pre-existing out-of-line primops inline: * fetchAddIntArray# * casIntArray#
* Revert "Add more primops for atomic ops on byte arrays"Johan Tibell2014-06-262-307/+0
| | | | | | | | This commit caused the register allocator to fail on i386. This reverts commit d8abf85f8ca176854e9d5d0b12371c4bc402aac3 and 04dd7cb3423f1940242fdfe2ea2e3b8abd68a177 (the second being a fix to the first).
* Work around lack of __sync_fetch_and_nand in clangJohan Tibell2014-06-261-0/+26
| | | | | clang chose to not implement this function. See http://llvm.org/bugs/show_bug.cgi?id=8842
* Add more primops for atomic ops on byte arraysJohan Tibell2014-06-242-0/+281
| | | | | | | | | | | | | | | | | | | Summary: Add more primops for atomic ops on byte arrays Adds the following primops: * atomicReadIntArray# * atomicWriteIntArray# * fetchSubIntArray# * fetchOrIntArray# * fetchXorIntArray# * fetchAndIntArray# Makes these pre-existing out-of-line primops inline: * fetchAddIntArray# * casIntArray#
* Make FunPtr's role be phantom; add comments.Richard Eisenberg2014-06-111-2/+9
| | | | | This change also updates castFunPtr to make it free at runtime. This fixes #9163.
* Update Cabal source-repository entries (re #8545)Herbert Valerio Riedel2014-04-191-6/+2
| | | | | | | | This adapts the source-repository entries to match the new situation of base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and template-haskell.git being folded into ghc.git Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Make argument types in popcnt.c match declared primop typesReid Barton2014-03-221-10/+10
| | | | | | | | | | | | | | | On 64-bit Mac OS, gcc 4.2 (which comes with Xcode 4.6) generates code that assumes that an argument that is smaller than the register it is passed in has been sign- or zero-extended. But ghc thinks the types of the PopCnt*Op primops are Word# -> Word#, so it passes the entire argument word to the hs_popcnt* function as though it was declared to have an argument of type StgWord. Segfaults ensue. The easiest fix is to sidestep all this zero-extension business by declaring the hs_popcnt* functions to take a whole StgWord (when their argument would fit in a register), thereby matching the list of primops. Fixes #7684.
* Export Coercible in GHC.Types (#8894)Joachim Breitner2014-03-161-18/+4
|
* Refer to the coercible paper in Coercible' docsJoachim Breitner2014-03-141-0/+4
| | | | Implements parts of #8888.
* Better Comment [Kind-changing of (~) and Coercible]Joachim Breitner2014-03-141-1/+11
|
* Note [Kind-changing of (~) and Coercible]Joachim Breitner2014-03-141-3/+23
|
* Update Coercible docs due to Safe Haskell adjustmentJoachim Breitner2014-03-141-4/+0
| | | | | This should go with [59722295bb8da8f01d37356fbed6aef7321a8195/ghc], see bug #8826.
* Add Since-annotation to `Coercible`Herbert Valerio Riedel2014-03-011-0/+2
| | | | Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Document Coercible in GHC.TypesJoachim Breitner2014-01-301-3/+48
| | | | | | It is not exported from here, but haddock still uses this documentation (and not the one from the fake GHC/Prim.hs file). So just put the user documentation here.
* Comment typoJoachim Breitner2014-01-301-1/+1
|
* Add overlooked language extensions to `IntWord64.hs`Herbert Valerio Riedel2013-10-271-1/+1
| | | | | | | This was overseen in b07b88e5d5c3ccd1508b235688f751408636c49e as the extensions are only needed when compiling for 32-bit archs. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Modernize `ghc-prim.cabal` to `cabal-version>=1.10`Herbert Valerio Riedel2013-10-272-17/+32
| | | | | | | | | | This also removes the use of `makefileHook` in `Setup.hs` which was dropped from the `Cabal` API Note: This cleanups make `ghc-prim` almost a proper Cabal package; `cabal sdist` still needs to be tweaked to change `build-type` to `Simple`, to make the resulting ghc-prim source distribution package self-contained.
* Add missing `{-# LANGUAGE #-}` pragmasHerbert Valerio Riedel2013-10-274-4/+4
| | | | Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Add actual documentation for new SPEC type.Austin Seipp2013-10-251-1/+7
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Implement SPEC for SpecConstr as a built in type.Austin Seipp2013-10-251-1/+5
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Comments onlyJan Stolarek2013-09-181-1/+1
|
* Follow changes in comparison primops (see #6135)Jan Stolarek2013-09-186-240/+137
|
* Add `{-# MINIMAL #-}` to `class Eq` and `class Ord`Herbert Valerio Riedel2013-09-181-0/+2
| | | | | | | This makes use of the new compiler checked minimal-complete-defintion `{-# MINIMAL #-}` annotation (see #7633 for more details) Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Define GHC.Types.CoercibleJoachim Breitner2013-09-131-0/+5
| | | | | This data type is required so that Coercible (which is actually a class and is exported from GHC.Prim) has a info table etc., similar to ~
* Update Git repo URL in `.cabal` fileHerbert Valerio Riedel2013-09-111-1/+1
|
* Change return type for emulated 64bit comparisonsJan Stolarek2013-08-162-37/+37
| | | | | | | In the previous patch I used Int64# as a return value for comparison primops used on 32bit machines for comparing Int64# and Word64#. This obviously wasn't a good idea. This patch changes return type from emulated Int64# to a native Int#.
* Comparison primops return Int# (Fixes #6135)Jan Stolarek2013-07-266-27/+190
| | | | | For a deatiled discussion of this changes please visit the wiki page: http://hackage.haskell.org/trac/ghc/wiki/PrimBool
* add other architecture for bswap in a form of Stg functions.Ian Lynagh2013-06-092-0/+28
| | | | Patch from Vincent Hanquez
* Add word2floatJohan Tibell2012-12-062-0/+16
|
* Bump version number following new policyIan Lynagh2012-11-301-1/+1
| | | | | We now keep the HEAD version numbers as values which would be suitable for immediate release.
* Add comment to .cabal file saying what GHC 7.6.1 shipped withIan Lynagh2012-11-301-0/+1
|
* Add a test for #6026 (fixity info for primops)Ian Lynagh2012-11-232-0/+11
|
* Move lazy from GHC.Base to GHC.MagicIan Lynagh2012-11-131-1/+27
|
* Merge documentation from inline's old primop entryIan Lynagh2012-11-131-6/+16
|
* Bump version to 0.3.0.0Paolo Capriotti2012-07-101-1/+1
|
* Move GHC.Generics to baseJose Pedro Magalhaes2012-06-214-395/+2
| | | | | There is no real reason for it to be in ghc-prim, and it complicates things.
* Move divInt#/modInt# from baseIan Lynagh2012-06-192-1/+26
| | | | This allows them to be shared with integer-gmp
* Move the Word type from base to ghc-primIan Lynagh2012-05-212-1/+6
|
* Minor Haddock documentation fixJose Pedro Magalhaes2012-02-211-1/+1
|
* Add CTYPE pragmasIan Lynagh2012-02-161-5/+5
|
* Break the GHC.Generics / GHC.Types import loop.Jose Pedro Magalhaes2011-09-264-98/+83
| | | | | | Also related to #5464. Now GHC.Generics imports GHC.Types, and the Generic instances for primitive types use StandaloneDeriving.
* Add a data type we can use to box up equality evidence for -XConstraintKindMax Bolingbroke2011-09-061-0/+7
|