summaryrefslogtreecommitdiff
path: root/compiler/codeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* omit "dyn" from the way appended to the __stginit labelSimon Marlow2010-04-281-8/+13
| | | | | When GHCi is linked dynamically, we still want to be able to load non-dynamic object files.
* New implementation of BLACKHOLEsSimon Marlow2010-03-294-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the global blackhole_queue with a clever scheme that enables us to queue up blocked threads on the closure that they are blocked on, while still avoiding atomic instructions in the common case. Advantages: - gets rid of a locked global data structure and some tricky GC code (replacing it with some per-thread data structures and different tricky GC code :) - wakeups are more prompt: parallel/concurrent performance should benefit. I haven't seen anything dramatic in the parallel benchmarks so far, but a couple of threading benchmarks do improve a bit. - waking up a thread blocked on a blackhole is now O(1) (e.g. if it is the target of throwTo). - less sharing and better separation of Capabilities: communication is done with messages, the data structures are strictly owned by a Capability and cannot be modified except by sending messages. - this change will utlimately enable us to do more intelligent scheduling when threads block on each other. This is what started off the whole thing, but it isn't done yet (#3838). I'll be documenting all this on the wiki in due course.
* Never jump directly to a thunk's entry code, even if it is single-entrySimon Marlow2010-03-251-10/+18
| | | | | | I don't think this fixes any bugs as we don't have single-entry thunks at the moment, but it could cause problems for parallel execution if we ever did re-introduce update avoidance.
* do_checks: do not set HpAlloc if the stack check failsSimon Marlow2010-03-251-6/+16
| | | | | | | | | | | | | | | | | | | | | | This fixes a very rare heap corruption bug, whereby - a context switch is requested, which sets HpLim to zero (contextSwitchCapability(), called by the timer signal or another Capability). - simultaneously a stack check fails, in a code fragment that has both a stack and a heap check. The RTS then assumes that a heap-check failure has occurred and subtracts HpAlloc from Hp, although in fact it was a stack-check failure and retreating Hp will overwrite valid heap objects. The bug is that HpAlloc should only be set when Hp has been incremented by the heap check. See comments in rts/HeapStackCheck.cmm for more details. This bug is probably incredibly rare in practice, but I happened to be working on a test that triggers it reliably: concurrent/should_run/throwto001, compiled with -O -threaded, args 30 300 +RTS -N2, run repeatedly in a loop.
* Comments onlysimonpj@microsoft.com2010-03-041-0/+2
|
* Beef up cmmMiniInline a tiny bitSimon Marlow2010-02-162-9/+1
| | | | | | | | | Allow a temporary assignment to be pushed past an assignment to a global if the global is not mentioned in the rhs of the assignment we are inlining. This fixes up some bad code. We should make sure we're doing something equivalent in the new backend in due course.
* Following Simon M's "take newCAF() out from sm_mutex" patchdias@cs.tufts.edu2010-01-051-1/+4
|
* Refactor PackageTarget back into StaticTargetBen.Lippmeier@anu.edu.au2010-01-042-13/+12
|
* Tag ForeignCalls with the package they correspond toBen.Lippmeier@anu.edu.au2010-01-027-21/+42
|
* take newCAF() out from sm_mutex; use the capability-local mut list insteadSimon Marlow2009-12-311-1/+4
|
* Copying Simon M's fix for 650 to the new codegendias@cs.tufts.edu2009-12-221-2/+15
|
* Better error checking and code cleanupdias@cs.tufts.edu2009-12-221-6/+5
|
* unused named variablesdias@cs.tufts.edu2009-12-181-2/+2
|
* missed a case in a previous fixdias@cs.tufts.edu2009-12-171-4/+26
| | | | | | | | | | | | | Here's the obscure problem: -- However, we also want to allow an assignment to be generated -- in the case when the types are compatible, because this allows -- some slightly-dodgy but occasionally-useful casts to be used, -- such as in RtClosureInspect where we cast an HValue to a MutVar# -- so we can print out the contents of the MutVar#. If we generate -- code that enters the HValue, then we'll get a runtime panic, because -- the HValue really is a MutVar#. The types are compatible though, -- so we can just generate an assignment.
* Fix #650: use a card table to mark dirty sections of mutable arraysSimon Marlow2009-12-171-3/+15
| | | | | | | | | | | | The card table is an array of bytes, placed directly following the actual array data. This means that array reading is unaffected, but array writing needs to read the array size from the header in order to find the card table. We use a bytemap rather than a bitmap, because updating the card table must be multi-thread safe. Each byte refers to 128 entries of the array, but this is tunable by changing the constant MUT_ARR_PTRS_CARD_BITS in includes/Constants.h.
* Fix warnings about unused importsBen.Lippmeier@anu.edu.au2009-11-181-1/+5
|
* Use opt_PIC not #defined __PIC__ in compiler source.Ben.Lippmeier@anu.edu.au2009-11-172-5/+14
|
* Don't share low valued Int and Char closures with Windows DLLsBen.Lippmeier@anu.edu.au2009-11-142-1/+15
|
* Loop problems in native back ends, update to T3286 fixdias@cs.tufts.edu2009-11-051-1/+1
| | | | | | | | | | | The native back ends had difficulties with loops; in particular the code for branch-chain elimination could run in infinite loops or drop basic blocks. The old codeGen didn't expose these problems. Also, my fix for T3286 in the new codegen was getting applied to too many (some wrong) cases; a better pattern match fixed that.
* Keep Touch'd variables live through the back enddias@cs.tufts.edu2009-09-182-6/+6
| | | | | | | When we used derived pointers into the middle of an object, we need to keep the pointer to the start of the object live. We use a "fat machine instruction" with the primitive MO_Touch to propagate this information through the back end.
* Fixed calling convention for unboxed tuplesdias@cs.tufts.edu2009-09-183-7/+9
| | | | | | Apparently, the arguments should be sorted by pointerhood. While we're at it, I rewrote the code that assigns registers and stack space to function call and return parameters.
* Fix for T3286 in new codegen (related to T3132); plus formattingdias@cs.tufts.edu2009-09-181-15/+38
| | | | | | | | | If the scrutinee is bottom, the generated Cmm code could have a type error when the case arm expected an unboxed floating-point value (even though the arm should never be reached). Now, we detect this case and avoid producing the type-incorrect assignment.
* validate fixesBen.Lippmeier@anu.edu.au2009-11-061-1/+1
|
* * Refactor CLabel.RtsLabel to CLabel.CmmLabelBen.Lippmeier@anu.edu.au2009-11-0618-73/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type of the CmmLabel ctor is now CmmLabel :: PackageId -> FastString -> CmmLabelInfo -> CLabel - When you construct a CmmLabel you have to explicitly say what package it is in. Many of these will just use rtsPackageId, but I've left it this way to remind people not to pretend labels are in the RTS package when they're not. - When parsing a Cmm file, labels that are not defined in the current file are assumed to be in the RTS package. Labels imported like import label are assumed to be in a generic "foreign" package, which is different from the current one. Labels imported like import "package-name" label are marked as coming from the named package. This last one is needed for the integer-gmp library as we want to refer to labels that are not in the same compilation unit, but are in the same non-rts package. This should help remove the nasty #ifdef __PIC__ stuff from integer-gmp/cbits/gmp-wrappers.cmm
* Merge RtsLabelInfo.Rts* with RtsLabelInfo.Rts*FSBen.Lippmeier@anu.edu.au2009-10-1817-147/+150
|
* Replace a checking `is_elem` with a plain `elem`Simon Marlow2009-09-301-2/+1
| | | | This one complains sometimes, but there's no good way to improve it.
* RTS tidyup sweep, first phaseSimon Marlow2009-08-027-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* fix warningSimon Marlow2009-07-281-1/+0
|
* Remove old 'foreign import dotnet' codeSimon Marlow2009-07-273-7/+0
| | | | It still lives in darcs, if anyone wants to revive it sometime.
* Remove GHC's haskell98 dependencyIan Lynagh2009-07-245-5/+5
|
* Remove unused importsIan Lynagh2009-07-0713-15/+0
|
* Trim unused imports detected by new unused-import codesimonpj@microsoft.com2009-07-061-1/+0
|
* Support for -fwarn-unused-do-bind and -fwarn-wrong-do-bind, as per #3263Max Bolingbroke2009-07-018-16/+19
|
* Add missing StgPrimCallOp case to isSimpleOpIan Lynagh2009-06-111-0/+1
|
* Add PrimCall to the STG layer and update Core -> STG translationDuncan Coutts2009-06-093-2/+19
| | | | | | | | | | It adds a third case to StgOp which already hold StgPrimOp and StgFCallOp. The code generation for the new StgPrimCallOp case is almost exactly the same as for out-of-line primops. They now share the tailCallPrim function. In the Core -> STG translation we map foreign calls using the "prim" calling convention to the StgPrimCallOp case. This is because in Core we represent prim calls using the ForeignCall stuff. At the STG level however the prim calls are really much more like primops than foreign calls.
* Fix #3132: a case of bogus code generationSimon Marlow2009-06-181-2/+28
|
* Remove old GUM/GranSim codeSimon Marlow2009-06-021-5/+1
|
* Make some showSDoc's use OneLineMode rather than PageModeIan Lynagh2009-03-311-2/+2
|
* Debugging by Sesame Street:dias@eecs.tufts.edu2009-04-031-1/+1
| | | | | | | | | | | | | | | | One of these things is not like the others: stdPattern :: [LRep] -> Maybe StgHalfWord stdPattern reps = case reps of [] -> Just ARG_NONE -- just void args, probably [N] -> Just ARG_N [P] -> Just ARG_N [F] -> Just ARG_F [D] -> Just ARG_D [L] -> Just ARG_L Today's debugging session was brought to you by the letter P.
* Better handling of node parameter in calling conventionsdias@eecs.tufts.edu2009-03-251-3/+7
| | | | | | - Previously, the node was taken as a parameter, then ignored, for static closures. Goofy. Now, the vestigial node parameters are gone.
* When calling gc, avoid saving node in static closuresdias@eecs.tufts.edu2009-03-232-4/+5
|
* Code simplifications due to call/return separation; some improvements to how ↵dias@eecs.tufts.edu2009-03-232-22/+22
| | | | node argument is managed
* Calls with and without passing node arguments more clearly separateddias@eecs.tufts.edu2009-03-233-6/+6
|
* Another small step: call and return conventions specified separately when ↵dias@eecs.tufts.edu2009-03-235-13/+14
| | | | making calls
* Small step toward call-conv improvement: separate out calls and returnsdias@eecs.tufts.edu2009-03-235-6/+6
|
* Removed a tracedias@eecs.tufts.edu2009-03-181-1/+1
|
* Calling convention bug and cleanupdias@eecs.tufts.edu2009-03-174-5/+3
| | | | | - yet another wrong calling convention; this one was a special case for returning one value.
* Inconsistent type and arguments in safe foreign calls...dias@eecs.tufts.edu2009-03-161-15/+15
| | | | | - The function argument was stripped from the argument list but not from the type. Now they're both stripped.
* Fixes to "Retract Hp *before* checking for HpLim==0"Simon Marlow2009-03-181-2/+7
|
* FIX biographical profiling (#3039, probably #2297)Simon Marlow2009-03-173-4/+21
| | | | | | | | | Since we introduced pointer tagging, we no longer always enter a closure to evaluate it. However, the biographical profiler relies on closures being entered in order to mark them as "used", so we were getting spurious amounts of data attributed to VOID. It turns out there are various places that need to be fixed, and I think at least one of them was also wrong before pointer tagging (CgCon.cgReturnDataCon).