summaryrefslogtreecommitdiff
path: root/compiler/cbits/genSym.c
Commit message (Collapse)AuthorAgeFilesLines
* Add configure flag to enable ASSERTs in all waysDaniel Gröber2021-07-291-3/+1
| | | | | | | | Running the test suite with asserts enabled is somewhat tricky at the moment as running it with a GHC compiled the DEBUG way has some hundred failures from the start. These seem to be unrelated to assertions though. So this provides a toggle to make it easier to debug failing assertions using the test suite.
* Put Unique related global variables in the RTS (#19940)Sylvain Henry2021-06-051-0/+6
|
* Implement Unique supply with Addr# atomic primopSylvain Henry2021-01-051-27/+5
| | | | | | | | Before this patch the compiler depended on the RTS way (threaded or not) to use atomic incrementation or not. This is wrong because the RTS is supposed to be switchable at link time, without recompilation. Now we always use atomic incrementation of the unique counter.
* Windows: Update tarballs to GCC 9.2 and remove MAX_PATH limit.Tamar Christina2019-10-201-1/+1
|
* Clean up `#include`s in the compilerJohn Ericson2019-10-051-1/+1
| | | | | | | | - Remove unneeded ones - Use <..> for inter-package. Besides general clean up, helps distinguish between the RTS we link against vs the RTS we compile for.
* unique: fix UNIQUE_BITS crosscompilation (Trac #13491)Sergei Trofimovich2017-03-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The #13491 manifests best when we try to crosscompile from 32-bit (i386-linux) to 64-bit (powerpc64-linux) system: ./configure --target=powerpc64-unknown-linux-gnu The build fails at assembly time: "inplace/bin/ghc-stage1" ... -c rts/StgStartup.cmm /tmp/ghc19687_0/ghc_4.s: Assembler messages: /tmp/ghc19687_0/ghc_4.s:11:0: error: Error: unknown pseudo-op: `.l' | 11 | .L<\x00>4: | ^ That happens because UNIQUE_BITS is defined in terms of WORD_SIZE_IN_BITS macro: #define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) WORD_SIZE_IN_BITS is 64 bits (equals to target value) while ghc-stage1 is still running on i386-linux The fix is to stop relying on target macros and use host's 'sizeof (HsInt)' and 'finiteBitSize' way to determine unique layout. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build i386-to-powerpc64 crosscompiler Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3397
* genSym: Fix DEBUG buildBen Gamari2017-03-191-1/+1
| | | | It looks like this was likely a cut-and-paste error.
* UniqSupply: Use full range of machine wordBen Gamari2016-12-151-4/+21
| | | | | | | | | | | | | | | | | | | | | | Currently uniques are 32-bits wide. 8 of these bits are for the unique class, leaving only 24 for the unique number itself. This seems dangerously small for a large project. Let's use the full range of the native machine word. We also add (now largely unnecessary) overflow check to ensure that the unique number doesn't overflow. Test Plan: Validate Reviewers: simonmar, austin, niteria Reviewed By: niteria Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2844 GHC Trac Issues: #12944
* Make it possible to have different UniqSupply strategiesBartosz Nitka2015-10-271-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To get reproducible/deterministic builds, the way that the Uniques are assigned shouldn't matter. This allows to test for that. It add 2 new flags: * `-dinitial-unique` * `-dunique-increment` And by varying these you can get interesting effects: * `-dinitial-unique=0 -dunique-increment 1` - current sequential UniqSupply * `-dinitial-unique=16777215 -dunique-increment -1` - UniqSupply that generates in decreasing order * `-dinitial-unique=1 -dunique-increment PRIME` - where PRIME big enough to overflow often - nonsequential order I haven't proven the usefullness of the last one yet and it's the reason why we have to mask the bits with `0xFFFFFF` in `genSym`, so I can remove it if it becomes contentious. Test Plan: validate on harbormaster Reviewers: simonmar, austin, ezyang, bgamari Reviewed By: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1360 GHC Trac Issues: #4012
* Fix bootstrapping of GHC with earlier versionsPatrick Palka2013-09-041-0/+4
| | | | | | | | We can no longer use atomic_inc() in the stage1 compiler because its prototype was recently changed. Since the stage1 compiler is always single-threaded, only use atomic_inc() when THREADED_RTS is defined.
* genSym: atomic_inc() now takes two argumentsPatrick Palka2013-09-041-1/+1
|
* UniqSupply: make mkSplitUniqSupply thread-safePatrick Palka2013-08-261-1/+5
| | | | | | | | | | | | | unsafeInterleaveIO is used instead of unsafeDupableInterleaveIO because a mk_supply thunk that is simultaneously entered by two threads should evaluate to the same UniqSupply. The UniqSupply counter is now incremented atomically using the RTS's atomic_inc(). To mitigate the extra overhead of unsafeInterleaveIO in the single-threaded compiler, noDuplicate# is changed to exit early when n_capabilities == 1.
* Move the genSym stuff from rts into compilerIan Lynagh2013-05-171-0/+9
It's no longer used by Data.Unique, so there's no need to have it in rts any more.