summaryrefslogtreecommitdiff
path: root/rts/PrimOps.cmm
Commit message (Collapse)AuthorAgeFilesLines
* Implement #2191 (traceCcs# -- prints CCS of a value when available -- take 3)Samuel Bronson2009-01-271-0/+20
| | | | | | In this version, I untag R1 before using it, and even enter R2 at the end rather than simply returning it (which didn't work right when R2 was a thunk).
* putMVar and takeMVar: add write_barrier() to fix race with throwToSimon Marlow2009-01-071-2/+8
|
* FIX #1364: added support for C finalizers that run as soon as the value is ↵Simon Marlow2008-12-101-5/+72
| | | | | | | | | | | not longer reachable. Patch originally by Ivan Tomac <tomac@pacific.net.au>, amended by Simon Marlow: - mkWeakFinalizer# commoned up with mkWeakFinalizerEnv# - GC parameters to ALLOC_PRIM fixed
* Merging in the new codegen branchdias@eecs.harvard.edu2008-08-141-4/+4
| | | | | | | | | | | | | | | | | | This merge does not turn on the new codegen (which only compiles a select few programs at this point), but it does introduce some changes to the old code generator. The high bits: 1. The Rep Swamp patch is finally here. The highlight is that the representation of types at the machine level has changed. Consequently, this patch contains updates across several back ends. 2. The new Stg -> Cmm path is here, although it appears to have a fair number of bugs lurking. 3. Many improvements along the CmmCPSZ path, including: o stack layout o some code for infotables, half of which is right and half wrong o proc-point splitting
* fix via-C compilation: import ghczmprim_GHCziBool_False_closureSimon Marlow2008-11-071-0/+1
|
* re-instate counting of sparks convertedSimon Marlow2008-11-061-8/+2
| | | | lost in patch "Run sparks in batches"
* Run sparks in batches, instead of creating a new thread for each oneSimon Marlow2008-11-061-0/+22
| | | | | Signficantly reduces the overhead for par, which means that we can make use of paralellism at a much finer granularity.
* add readTVarIO :: TVar a -> IO aSimon Marlow2008-10-101-0/+11
|
* atomicModifyIORef: use a local cas() instead of the global lockSimon Marlow2008-10-081-13/+16
| | | | This should improve scaling when using atomicModifyIORef
* Move the context_switch flag into the CapabilitySimon Marlow2008-09-191-2/+2
| | | | | Fixes a long-standing bug that could in some cases cause sub-optimal scheduling behaviour.
* get exception names from Control.Exception.Base instead of Control.ExceptionRoss Paterson2008-08-121-2/+2
|
* Follow extensible exception changesIan Lynagh2008-07-301-2/+2
|
* Change the calling conventions for unboxed tuples slightlySimon Marlow2008-07-281-30/+0
| | | | | | | | | | When returning an unboxed tuple with a single non-void component, we now use the same calling convention as for returning a value of the same type as that component. This means that the return convention for IO now doesn't vary depending on the platform, which make some parts of the RTS simpler, and fixes a problem I was having with making the FFI work in unregisterised GHCi (the byte-code compiler makes some assumptions about calling conventions to keep things simple).
* add threadStatus# primop, for querying the status of a ThreadId#Simon Marlow2008-07-101-0/+33
|
* oops, fix more register clobberage Simon Marlow2008-07-101-2/+2
| | | | fixes crash with -threaded -debug for me
* Fix some random register clobbering in takeMVar/putMVarSimon Marlow2008-07-091-2/+6
| | | | This showed up as a crash in conc032 for me.
* 64-bit fixesSimon Marlow2008-06-171-4/+4
|
* fix some types for 64-bit platformsSimon Marlow2008-06-031-4/+4
|
* add [] to foreign callsSimon Marlow2008-04-161-11/+13
|
* remove GRAN/PAR codeSimon Marlow2008-04-161-24/+0
|
* Add a write barrier to the TSO link field (#1589)Simon Marlow2008-04-161-19/+32
|
* Fix conversions between Double/Float and simple-integerIan Lynagh2008-06-141-5/+9
|
* Fix a division-by-zero when +RTS -V0 is givenIan Lynagh2008-04-261-1/+5
| | | | In delayzh_fast we act as if tickInterval was 50, not 0.
* Fix int64ToInteger 0xFFFFFFFF00000000 on 32bit machine; trac #2223Ian Lynagh2008-04-241-3/+3
| | | | Patch from Mike Gunter.
* Add some more generic (en|de)code(Double|Float) codeIan Lynagh2008-04-171-0/+35
|
* Do not #include external header files when compiling via CSimon Marlow2008-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This has several advantages: - -fvia-C is consistent with -fasm with respect to FFI declarations: both bind to the ABI, not the API. - foreign calls can now be inlined freely across module boundaries, since a header file is not required when compiling the call. - bootstrapping via C will be more reliable, because this difference in behavour between the two backends has been removed. There is one disadvantage: - we get no checking by the C compiler that the FFI declaration is correct. So now, the c-includes field in a .cabal file is always ignored by GHC, as are header files specified in an FFI declaration. This was previously the case only for -fasm compilations, now it is also the case for -fvia-C too.
* Link libgmp.a statically into libHSrts.dll on WindowsClemens Fruhwirth2008-01-011-0/+2
|
* forkIO starts the new thread blocked if the parent is blocked (#1048)Simon Marlow2007-12-041-0/+12
|
* fix warnings when compiling via CSimon Marlow2007-10-181-4/+4
|
* Add a proper write barrier for MVarsSimon Marlow2007-10-111-20/+45
| | | | | | | | | | | | Previously MVars were always on the mutable list of the old generation, which meant every MVar was visited during every minor GC. With lots of MVars hanging around, this gets expensive. We addressed this problem for MUT_VARs (aka IORefs) a while ago, the solution is to use a traditional GC write-barrier when the object is modified. This patch does the same thing for MVars. TVars are still done the old way, they could probably benefit from the same treatment too.
* {Enter,Leave}CriticalSection imports should be outside #ifdef __PIC__Simon Marlow2007-09-051-1/+1
|
* FIX: Correct Leave/EnterCriticalSection importsManuel M T Chakravarty2007-09-051-2/+2
|
* put the @N suffix on stdcall foreign calls in .cmm codeSimon Marlow2007-09-041-0/+2
| | | | This applies to EnterCriticalSection and LeaveCriticalSection in the RTS
* Windows: remove the {Enter,Leave}CricialSection wrappersSimon Marlow2007-08-291-2/+2
| | | | | | The C-- parser was missing the "stdcall" calling convention for foreign calls, but once added we can call {Enter,Leave}CricialSection directly.
* annotate C-- calls that do not returnNorman Ramsey2007-08-201-6/+6
| | | | | | | | | * The correct definition of C-- requires that a procedure not 'fall off the end'. The 'never returns' annotation tells us if a (foreign) call is not going to return. Validated!
* Properly guard imports because they have to be precise on Windows and Darwin ↵Clemens Fruhwirth2007-08-101-0/+2
| | | | sets __PIC__ automatically
* Add explicit imports for RTS-external variablesClemens Fruhwirth2007-08-061-0/+20
|
* Pointer TaggingSimon Marlow2007-07-271-3/+6
| | | | | | | | | | | | | | | | | | | | | | This patch implements pointer tagging as per our ICFP'07 paper "Faster laziness using dynamic pointer tagging". It improves performance by 10-15% for most workloads, including GHC itself. The original patches were by Alexey Rodriguez Yakushev <mrchebas@gmail.com>, with additions and improvements by me. I've re-recorded the development as a single patch. The basic idea is this: we use the low 2 bits of a pointer to a heap object (3 bits on a 64-bit architecture) to encode some information about the object pointed to. For a constructor, we encode the "tag" of the constructor (e.g. True vs. False), for a function closure its arity. This enables some decisions to be made without dereferencing the pointer, which speeds up some common operations. In particular it enables us to avoid costly indirect jumps in many cases. More information in the commentary: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging
* FIX BUILD (Windows): catch up with changes to .cmm syntaxSimon Marlow2007-07-031-7/+7
|
* Implemented and fixed bugs in CmmInfo handlingMichael D. Adams2007-06-271-82/+68
|
* Make the threaded RTS compilable using -fasmSimon Marlow2007-06-261-10/+10
| | | | | We needed to turn some inline C functions and C macros into either real C functions or C-- macros.
* tiny cleanupSimon Marlow2007-05-251-2/+2
|
* Use a primop for getting the fields of the AP_STACK rather than an FFI callSimon Marlow2007-05-031-5/+10
| | | | | | This means we can avoid some StablePtrs, and also catch cases where the AP_STACK has been evaluated (this can happen with :history, see the hist001 test).
* Re-working of the breakpoint supportSimon Marlow2007-04-171-20/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the result of Bernie Pope's internship work at MSR Cambridge, with some subsequent improvements by me. The main plan was to (a) Reduce the overhead for breakpoints, so we could enable the feature by default without incurrent a significant penalty (b) Scatter more breakpoint sites throughout the code Currently we can set a breakpoint on almost any subexpression, and the overhead is around 1.5x slower than normal GHCi. I hope to be able to get this down further and/or allow breakpoints to be turned off. This patch also fixes up :print following the recent changes to constructor info tables. (most of the :print tests now pass) We now support single-stepping, which just enables all breakpoints. :step <expr> executes <expr> with single-stepping turned on :step single-steps from the current breakpoint The mechanism is quite different to the previous implementation. We share code with the HPC (haskell program coverage) implementation now. The coverage pass annotates source code with "tick" locations which are tracked by the coverage tool. In GHCi, each "tick" becomes a potential breakpoint location. Previously breakpoints were compiled into code that magically invoked a nested instance of GHCi. Now, a breakpoint causes the current thread to block and control is returned to GHCi. See the wiki page for more details and the current ToDo list: http://hackage.haskell.org/trac/ghc/wiki/NewGhciDebugger
* MERGE: Fix a few uses of the wrong return convention for the schedulerSimon Marlow2007-04-161-2/+1
| | | | | | | | | | We changed the convention a while ago so that BaseReg is returned to the scheduler in R1, because BaseReg may change during the run of a thread, e.g. during a foreign call. A few places got missed, mostly for very rare events. Should fix concprog001, although I'm not able to reliably reproduce the failure.
* add noDuplicate#Simon Marlow2007-03-061-0/+20
| | | | | | This primop ensures that the current computation is not being duplicated, by calling threadPaused(). The idea is to use it inside unsafePerformIO/unsafeInterleaveIO (see #986).
* remove vestiges of CCallable/CReturnableSimon Marlow2007-03-061-18/+0
|
* Remove vectored returns.Simon Marlow2007-02-281-110/+27
| | | | | We recently discovered that they aren't a win any more, and just cost code size.
* Remove the itbls field of BCO, put itbls in with the literalsSimon Marlow2007-02-271-7/+5
| | | | This is a simplification & minor optimisation for GHCi
* Two new prim ops to access the Info Table and Payload of a closure:Pepe Iborra2006-12-091-0/+49
| | | | | | | | - infoPtr# :: a -> Addr# - closurePayload# :: a -> (# Array b, ByteArr# #) These prim ops provide the magic behind the ':print' command