summaryrefslogtreecommitdiff
path: root/includes
Commit message (Collapse)AuthorAgeFilesLines
* arm64: 64bit iOS and SMP support (#7942)Luke Iannini2014-11-194-3/+116
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts: remove old-style field designator extension (#9396)Austin Seipp2014-11-191-24/+24
| | | | | | Authored-by: jrp Signed-off-by: Austin Seipp <austin@well-typed.com>
* includes/Stg.h: define _DEFAULT_SOURCE for glibc-2.20Sergei Trofimovich2014-11-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | _BSD_SOURCE we are using for 'gamma()' and friends was deprecated in glibc-2.20 in favour of '_DEFAULT_SOURCE'. gcc says: In file included from /usr/include/math.h:26:0: 0, from includes/Stg.h:69, from /tmp/ghc19488_0/ghc19488_2.hc:3: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^ Patch fixes testsuite failures on UNREG (stderr are not cluttered by warnings anymore). Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Per-thread allocation counters and limitsSimon Marlow2014-11-124-11/+42
| | | | | | | | This reverts commit f0fcc41d755876a1b02d1c7c79f57515059f6417. New changes: now works on 32-bit platforms too. I added some basic support for 64-bit subtraction and comparison operations to the x86 NCG.
* Revert "Rename _closure to _static_closure, apply naming consistently."Edward Z. Yang2014-10-207-61/+24
| | | | | | | This reverts commit 35672072b4091d6f0031417bc160c568f22d0469. Conflicts: compiler/main/DriverPipeline.hs
* Name worker threads using pthread_setname_npSimon Marlow2014-10-101-1/+1
| | | | | This helps identify threads in gdb particularly in processes with a lot of threads.
* Make the linker more robust to errorsSimon Marlow2014-10-081-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: When linking fails because there was a problem with the supplied object file, then we should not barf() or exit, we should emit a suitable error message and return an error code to the caller. We should also free all memory that might have been allocated during linking, and generally not do any damage. This patch fixes most common instances of this problem. Test Plan: validate Reviewers: rwbarton, austin, ezyang Reviewed By: ezyang Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D294
* Implement `MIN_VERSION_GLASGOW_HASKELL()` macroHerbert Valerio Riedel2014-10-051-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This exposes the `cProjectPatchLevel{1,2}` value at the CPP level to allow it to be used in CPP conditionals. Concretely, GHC 7.10.2.20150623 would result in #define __GLASGOW_HASKELL__ 710 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 2 #define __GLASGOW_HASKELL_PATCHLEVEL2__ 20150623 while GHC 7.10.3 results in #define __GLASGOW_HASKELL__ 710 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 3 and finally GHC 7.9.20141009 results in #define __GLASGOW_HASKELL__ 709 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 20141009 As it's error-prone to properly express CPP conditionals for testing GHC multi-component versions, a new macro `MIN_VERSION_GLASGOW_HASKELL()` is provided (also via the new CPP include file `ghcversion.h`) Finally, in order to make it easier to define the new CPP macro `MIN_VERSION_GLASGOW_HASKELL()`, a new default-included `include/ghcversion.h` is used for the new CPP definitions. Reviewed By: ekmett, austin, #ghc Differential Revision: https://phabricator.haskell.org/D66
* Rename _closure to _static_closure, apply naming consistently.Edward Z. Yang2014-10-017-24/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In preparation for indirecting all references to closures, we rename _closure to _static_closure to ensure any old code will get an undefined symbol error. In order to reference a closure foobar_closure (which is now undefined), you should instead use STATIC_CLOSURE(foobar). For convenience, a number of these old identifiers are macro'd. Across C-- and C (Windows and otherwise), there were differing conventions on whether or not foobar_closure or &foobar_closure was the address of the closure. Now, all foobar_closure references are addresses, and no & is necessary. CHARLIKE/INTLIKE were not changed, simply alpha-renamed. Part of remove HEAP_ALLOCED patch set (#8199) Depends on D265 Signed-off-by: Edward Z. Yang <ezyang@mit.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D267 GHC Trac Issues: #8199
* rts/includes: Fix up .dir-locals.elAustin Seipp2014-10-011-9/+10
| | | | | | After 23bb90460, these were slightly busted for `c-mode`. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add emacs indentation/line-length settingsSimon Marlow2014-09-291-0/+12
|
* `M-x delete-trailing-whitespace` & `M-x untabify`Herbert Valerio Riedel2014-09-241-1/+1
|
* Implement `decodeDouble_Int64#` primopHerbert Valerio Riedel2014-09-171-0/+1
| | | | | | | | | | | | | | | The existing `decodeDouble_2Int#` primop is rather inconvenient to use (and in fact is not even used by `integer-gmp`) as the mantissa is split into 3 components which would actually fit in an `Int64#` value. However, `decodeDouble_Int64#` is to be used by the new `integer-gmp2` re-implementation (see #9281). Moreover, `decodeDouble_2Int#` performs direct bit-wise operations on the IEEE representation which can be replaced by a combination of the portable standard C99 `scalbn(3)` and `frexp(3)` functions. Differential Revision: https://phabricator.haskell.org/D160
* Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.Andreas Voellmy2014-09-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This reverts commit 4748f5936fe72d96edfa17b153dbfd84f2c4c053. The fix for #9423 was reverted because this commit introduced a C function setIOManagerControlFd() (defined in Schedule.c) defined for all OS types, while the prototype (in includes/rts/IOManager.h) was only included when mingw32_HOST_OS is not defined. This broke Windows builds. This commit reverts the original commit and resolves the problem by only defining setIOManagerControlFd() when mingw32_HOST_OS is defined. Hence the missing prototype error should not occur on Windows. In addition, since the io_manager_control_wr_fd field of the Capability struct is only usd by the setIOManagerControlFd, this commit includes the io_manager_control_wr_fd field in the Capability struct only when mingw32_HOST_OS is not defined. Test Plan: Try to compile successfully on all platforms. Reviewers: austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D174
* includes/Stg.h: remove unused 'wcStore' inlineSergei Trofimovich2014-09-011-18/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Commit reverts never used addition in cbd29e0a23bb8e15033edae123d6c8fbe9740c97 I think it might make sense to take advantage of TSO/RMO/PSO models tome day. But it's highly architecture/model-dependent thus it better be implemented in per-arch Native CodeGen. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build-tested on UNREG-amd64 Reviewers: simonmar, austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D186
* PprC: cleanup: don't emit 'FB_' / 'FE_' in via-CSergei Trofimovich2014-08-291-2/+0
| | | | | | | No need to emit (now empty) those special markers. Markers were needed only in registerised -fvia-C mode. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Revert "rts/base: Fix #9423"Austin Seipp2014-08-221-2/+1
| | | | | | | | | 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>
* includes: detabify/dewhitespace rts/storage/ClosureMacros.hAustin Seipp2014-08-201-44/+44
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/InfoTables.hAustin Seipp2014-08-201-34/+34
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/Block.hAustin Seipp2014-08-201-4/+4
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/GC.hAustin Seipp2014-08-201-27/+27
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/Closures.hAustin Seipp2014-08-201-17/+17
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/TSO.hAustin Seipp2014-08-201-13/+13
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/storage/MBlock.hAustin Seipp2014-08-201-3/+3
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/prof/LDV.hAustin Seipp2014-08-201-1/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/prof/CCS.hAustin Seipp2014-08-201-35/+34
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/Hpc.hAustin Seipp2014-08-201-3/+3
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/OSThreads.hAustin Seipp2014-08-201-10/+10
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/Stable.hAustin Seipp2014-08-201-3/+3
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/Threads.hAustin Seipp2014-08-201-4/+4
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace rts/Ticky.hAustin Seipp2014-08-201-8/+7
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace stg/Types.hAustin Seipp2014-08-201-20/+20
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace stg/SMP.hAustin Seipp2014-08-201-21/+21
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace stg/Regs.hAustin Seipp2014-08-201-52/+52
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace Cmm.hAustin Seipp2014-08-201-117/+117
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace HsFFI.hAustin Seipp2014-08-201-84/+84
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace Rts.hAustin Seipp2014-08-201-10/+10
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace RtsAPI.hAustin Seipp2014-08-201-9/+9
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* [ci skip] includes: detabify/dewhitespace Stg.hAustin Seipp2014-08-201-1/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts/base: Fix #9423Andreas Voellmy2014-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix #9423. The problem in #9423 is caused when code invoked by `hs_exit()` waits on all foreign calls to return, but some IO managers are in `safe` foreign calls and do not return. The previous design signaled to the timer manager (via its control pipe) that it should "die" and when the timer manager returned to Haskell-land, the Haskell code in timer manager then signalled to the IO manager threads that they should return from foreign calls and `die`. Unfortunately, in the shutdown sequence the timer manager is unable to return to Haskell-land fast enough and so the code that signals to the IO manager threads (via their control pipes) is never executed and the IO manager threads remain out in the foreign calls. This patch solves this problem by having the RTS signal to all the IO manager threads (via their control pipes; and in addition to signalling to the timer manager thread) that they should shutdown (in `ioManagerDie()` in `rts/Signals.c`. To do this, we arrange for each IO manager thread to register its control pipe with the RTS (in `GHC.Thread.startIOManagerThread`). In addition, `GHC.Thread.startTimerManagerThread` registers its control pipe. These are registered via C functions `setTimerManagerControlFd` (in `rts/Signals.c`) and `setIOManagerControlFd` (in `rts/Capability.c`). The IO manager control pipe file descriptors are stored in a new field of the `Capability_ struct`. Test Plan: See the notes on #9423 to recreate the problem and to verify that it no longer occurs with the fix. Auditors: simonmar Reviewers: simonmar, edsko, ezyang, austin Reviewed By: austin Subscribers: phaskell, simonmar, ezyang, carter, relrod Differential Revision: https://phabricator.haskell.org/D129 GHC Trac Issues: #9423, #9284
* includes/stg/Prim.h: add matching 'hs_atomic_*' prototypesSergei Trofimovich2014-08-191-0/+38
| | | | | | Fixes implicit function declarations in C codegen. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Revert "Fix typos 'resizze'"Gabor Greif2014-08-161-1/+1
| | | | | | this is z-encoding (as hvr tells me) This reverts commit 425d5178af55620efa00e6e16426f491c63ad533.
* Fix typos 'resizze'Gabor Greif2014-08-161-1/+1
|
* Implement {resize,shrink}MutableByteArray# primopsHerbert Valerio Riedel2014-08-163-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two new primops with the type-signatures resizeMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, MutableByteArray# s #) shrinkMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> State# s allow to resize MutableByteArray#s in-place (when possible), and are useful for algorithms where memory is temporarily over-allocated. The motivating use-case is for implementing integer backends, where the final target size of the result is either N or N+1, and only known after the operation has been performed. A future commit will implement a stateful variant of the `sizeofMutableByteArray#` operation (see #9447 for details), since now the size of a `MutableByteArray#` may change over its lifetime (i.e before it gets frozen or GCed). Test Plan: ./validate --slow Reviewers: ezyang, austin, simonmar Reviewed By: austin, simonmar Differential Revision: https://phabricator.haskell.org/D133
* Implement new CLZ and CTZ primops (re #9340)Herbert Valerio Riedel2014-08-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* stg/Prim.h: drop redundant #ifdefSergei Trofimovich2014-08-111-4/+0
| | | | | | | | | | | | | | | | | Summary: Noticed by Herbert Valerio Riedel Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build test Reviewers: simonmar, austin, hvr Reviewed By: hvr Subscribers: rwbarton, phaskell, simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D143
* rts: drop unused 'SpinLockCount' typedefSergei Trofimovich2014-07-201-2/+0
| | | | | | | | | | | | | | Summary: Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: git grep, git log -SSpinLockCount, build test Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: phaskell, simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D76
* rts: Fix #9003 with an annoying hackAustin Seipp2014-07-091-1/+3
| | | | | | | The TL;DR is that by adding this, we can distinguish GHC 7.8.3 from 7.8.2, which had a buggy implementation. See the ticket for details. Signed-off-by: Austin Seipp <austin@well-typed.com>
* includes/stg/SMP.h: use 'NOSMP' instead of never defined 'WITHSMP' (Trac #8789)Sergei Trofimovich2014-07-021-21/+21
| | | | | | | | | | | | | | | | | | Summary: git history does not contain state where 'WITHSMP' macro was ever defined. It should have always been '!NOSMP'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build tested Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D33
* Partially fix #9003 by reverting bad numbering.Edward Z. Yang2014-07-011-13/+15
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>