summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CgForeignCall.hs
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old codegenSimon Marlow2012-10-191-322/+0
| | | | | Except for CgUtils.fixStgRegisters that is used in the NCG and LLVM backends, and should probably be moved somewhere else.
* Some alpha renamingIan Lynagh2012-10-161-2/+2
| | | | | Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
* Move wORD_SIZE into platformConstantsIan Lynagh2012-09-161-3/+2
|
* Move some more constants into platformConstantsIan Lynagh2012-09-141-1/+1
|
* Move more constants to platformConstantsIan Lynagh2012-09-141-1/+1
|
* Use oFFSET_* from platformConstants rather than ConstantsIan Lynagh2012-09-131-7/+7
|
* Pass DynFlags down to wordWidthIan Lynagh2012-09-121-5/+5
|
* Pass DynFlags down to gcWordIan Lynagh2012-09-121-1/+1
|
* Pass DynFlags down to bWordIan Lynagh2012-09-121-34/+38
| | | | | | I've switched to passing DynFlags rather than Platform, as (a) it's simpler to not have to extract targetPlatform in so many places, and (b) it may be useful to have DynFlags around in future.
* Cleanup: add mkIntExpr and zeroExpr utilsSimon Marlow2012-08-311-1/+1
|
* Define callerSaves for all platformsIan Lynagh2012-08-071-2/+4
| | | | | | | | This means that we now generate the same code whatever platform we are on, which should help avoid changes on one platform breaking the build on another. It's also another step towards full cross-compilation.
* Make -fscc-profiling a dynamic flagIan Lynagh2012-07-241-22/+25
| | | | All the flags that 'ways' imply are now dynamic
* Remove lots of commented out 'in' keywordsIan Lynagh2012-06-131-1/+0
|
* Support code generation for unboxed-tuple function argumentsunboxed-tuple-arguments2Max Bolingbroke2012-05-151-1/+2
| | | | | | | | | | | This is done by a 'unarisation' pre-pass at the STG level which translates away all (live) binders binding something of unboxed tuple type. This has the following knock-on effects: * The subkind hierarchy is vastly simplified (no UbxTupleKind or ArgKind) * Various relaxed type checks in typechecker, 'foreign import prim' etc * All case binders may be live at the Core level
* Implement "value" imports with the CAPIIan Lynagh2012-02-261-1/+3
| | | | | | This allows us to import values (i.e. non-functions) with the CAPI. This means we can access values even if (on some or all platforms) they are simple #defines.
* Formatting fixesDavid Terei2012-01-051-9/+9
|
* Rename the CCCS field of StgTSO so as not to conflict with the CCCS ↵Simon Marlow2012-01-051-1/+1
| | | | | | pseudo-register Needed by #5357
* Make profiling work with multiple capabilities (+RTS -N)Simon Marlow2011-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This means that both time and heap profiling work for parallel programs. Main internal changes: - CCCS is no longer a global variable; it is now another pseudo-register in the StgRegTable struct. Thus every Capability has its own CCCS. - There is a new built-in CCS called "IDLE", which records ticks for Capabilities in the idle state. If you profile a single-threaded program with +RTS -N2, you'll see about 50% of time in "IDLE". - There is appropriate locking in rts/Profiling.c to protect the shared cost-centre-stack data structures. This patch does enough to get it working, I have cut one big corner: the cost-centre-stack data structure is still shared amongst all Capabilities, which means that multiple Capabilities will race when updating the "allocations" and "entries" fields of a CCS. Not only does this give unpredictable results, but it runs very slowly due to cache line bouncing. It is strongly recommended that you use -fno-prof-count-entries to disable the "entries" count when profiling parallel programs. (I shall add a note to this effect to the docs).
* Get rid of the "safety" field of CmmCall (OldCmm)Simon Marlow2011-11-291-4/+4
| | | | | This field was doing nothing. I think it originally appeared in a very old incarnation of the new code generator.
* Remove a tabs kludgeIan Lynagh2011-11-261-7/+0
|
* Whitespace only in codeGen/CgForeignCall.hsIan Lynagh2011-11-261-101/+101
|
* Use -fwarn-tabs when validatingIan Lynagh2011-11-041-0/+7
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* More refactoring (CgRep)Simon Peyton Jones2011-08-251-0/+1
| | | | | | * Move CgRep (private to old codgen) from SMRep to ClosureInfo * Avoid using CgRep in new codegen * Move SMRep and Bitmap from codeGen/ to cmm/
* Snapshot of codegen refactoring to share with simonpjSimon Marlow2011-08-251-1/+0
|
* Remove type synonyms for CmmFormals, CmmActuals (and hinted versions).Edward Z. Yang2011-06-131-3/+3
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Port "Make array copy primops inline" and related patches to new codegen.Edward Z. Yang2011-06-131-0/+3
| | | | | | | | | | The following patches were ported: d0faaa6 Fix segfault in array copy primops on 32-bit 18691d4 Make assignTemp_ less pessimistic 9c23f06 Make array copy primops inline Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Merge in new code generator branch.Simon Marlow2011-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This changes the new code generator to make use of the Hoopl package for dataflow analysis. Hoopl is a new boot package, and is maintained in a separate upstream git repository (as usual, GHC has its own lagging darcs mirror in http://darcs.haskell.org/packages/hoopl). During this merge I squashed recent history into one patch. I tried to rebase, but the history had some internal conflicts of its own which made rebase extremely confusing, so I gave up. The history I squashed was: - Update new codegen to work with latest Hoopl - Add some notes on new code gen to cmm-notes - Enable Hoopl lag package. - Add SPJ note to cmm-notes - Improve GC calls on new code generator. Work in this branch was done by: - Milan Straka <fox@ucw.cz> - John Dias <dias@cs.tufts.edu> - David Terei <davidterei@gmail.com> Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD and fixed a few bugs.
* Implement stack chunks and separate TSO/STACK objectsSimon Marlow2010-12-151-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes two changes to the way stacks are managed: 1. The stack is now stored in a separate object from the TSO. This means that it is easier to replace the stack object for a thread when the stack overflows or underflows; we don't have to leave behind the old TSO as an indirection any more. Consequently, we can remove ThreadRelocated and deRefTSO(), which were a pain. This is obviously the right thing, but the last time I tried to do it it made performance worse. This time I seem to have cracked it. 2. Stacks are now represented as a chain of chunks, rather than a single monolithic object. The big advantage here is that individual chunks are marked clean or dirty according to whether they contain pointers to the young generation, and the GC can avoid traversing clean stack chunks during a young-generation collection. This means that programs with deep stacks will see a big saving in GC overhead when using the default GC settings. A secondary advantage is that there is much less copying involved as the stack grows. Programs that quickly grow a deep stack will see big improvements. In some ways the implementation is simpler, as nothing special needs to be done to reclaim stack as the stack shrinks (the GC just recovers the dead stack chunks). On the other hand, we have to manage stack underflow between chunks, so there's a new stack frame (UNDERFLOW_FRAME), and we now have separate TSO and STACK objects. The total amount of code is probably about the same as before. There are new RTS flags: -ki<size> Sets the initial thread stack size (default 1k) Egs: -ki4k -ki2m -kc<size> Sets the stack chunk size (default 32k) -kb<size> Sets the stack chunk buffer size (default 1k) -ki was previously called just -k, and the old name is still accepted for backwards compatibility. These new options are documented.
* Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4Edward Z. Yang2010-09-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This is patch that adds support for interruptible FFI calls in the form of a new foreign import keyword 'interruptible', which can be used instead of 'safe' or 'unsafe'. Interruptible FFI calls act like safe FFI calls, except that the worker thread they run on may be interrupted. Internally, it replaces BlockedOnCCall_NoUnblockEx with BlockedOnCCall_Interruptible, and changes the behavior of the RTS to not modify the TSO_ flags on the event of an FFI call from a thread that was interruptible. It also modifies the bytecode format for foreign call, adding an extra Word16 to indicate interruptibility. The semantics of interruption vary from platform to platform, but the intent is that any blocking system calls are aborted with an error code. This is most useful for making function calls to system library functions that support interrupting. There is no support for pre-Vista Windows. There is a partner testsuite patch which adds several tests for this functionality.
* Add new LLVM code generator to GHC. (Version 2)David Terei2010-06-151-1/+2
| | | | | | | | | | | | | | | | | | This was done as part of an honours thesis at UNSW, the paper describing the work and results can be found at: http://www.cse.unsw.edu.au/~pls/thesis/davidt-thesis.pdf A Homepage for the backend can be found at: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM Quick summary of performance is that for the 'nofib' benchmark suite, runtimes are within 5% slower than the NCG and generally better than the C code generator. For some code though, such as the DPH projects benchmark, the LLVM code generator outperforms the NCG and C code generator by about a 25% reduction in run times.
* Refactor PackageTarget back into StaticTargetBen.Lippmeier@anu.edu.au2010-01-041-8/+1
|
* Tag ForeignCalls with the package they correspond toBen.Lippmeier@anu.edu.au2010-01-021-2/+21
|
* * Refactor CLabel.RtsLabel to CLabel.CmmLabelBen.Lippmeier@anu.edu.au2009-11-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-2/+2
|
* Remove old 'foreign import dotnet' codeSimon Marlow2009-07-271-3/+0
| | | | It still lives in darcs, if anyone wants to revive it sometime.
* Fixes to "Retract Hp *before* checking for HpLim==0"Simon Marlow2009-03-181-2/+7
|
* When generating C, don't pretend functions are dataIan Lynagh2009-02-061-1/+2
| | | | | | | | | | | | | | | We used to generated things like: extern StgWordArray (newCAF) __attribute__((aligned (8))); ((void (*)(void *))(W_)&newCAF)((void *)R1.w); (which is to say, pretend that newCAF is some data, then cast it to a function and call it). This goes wrong on at least IA64, where: A function pointer on the ia64 does not point to the first byte of code. Intsead, it points to a structure that describes the function. The first quadword in the structure is the address of the first byte of code so we end up dereferencing function pointers one time too many, and segfaulting.
* Fix warnings in CgForeignCallIan Lynagh2008-12-151-10/+16
|
* Merging in the new codegen branchdias@eecs.harvard.edu2008-08-141-28/+27
| | | | | | | | | | | | | | | | | | 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
* replace Cmm 'hint' with 'kind'Norman Ramsey2008-05-031-11/+11
| | | | | | C-- no longer has 'hints'; to guide parameter passing, it has 'kinds'. Renamed type constructor, data constructor, and record fields accordingly
* (F)SLIT -> (f)sLit in CgForeignCallIan Lynagh2008-04-121-4/+2
|
* Don't import FastString in HsVersions.hIan Lynagh2008-03-291-0/+1
| | | | Modules that need it import it themselves instead.
* change CmmActual, CmmFormal to use a data CmmHinted rather than tuple (#1405)Isaac Dupree2008-01-041-11/+12
| | | | | | | This allows the instance of UserOfLocalRegs to be within Haskell98, and IMHO makes the code a little cleaner generally. This is one small (though tedious) step towards making GHC's code more portable...
* Move OPTIONS pragmas above commentsIan Lynagh2007-09-211-7/+7
| | | | Fixes building with -Werror (i.e. validate) and GHC < 6.6
* a good deal of salutory renamingNorman Ramsey2007-09-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've renamed a number of type and data constructors within Cmm so that the names used in the compiler may more closely reflect the C-- specification 2.1. I've done a bit of other renaming as well. Highlights: CmmFormal and CmmActual now bear a CmmKind (which for now is a MachHint as before) CmmFormals = [CmmFormal] and CmmActuals = [CmmActual] suitable changes have been made to both code and nonterminals in the Cmm parser (which is as yet untested) For reasons I don't understand, parts of the code generator use a sequence of 'formal parameters' with no C-- kinds. For these we now have the types type CmmFormalWithoutKind = LocalReg type CmmFormalsWithoutKinds = [CmmFormalWithoutKind] A great many appearances of (Tau, MachHint) have been simplified to the appropriate CmmFormal or CmmActual, though I'm sure there are more opportunities. Kind and its data constructors are now renamed to data GCKind = GCKindPtr | GCKindNonPtr to avoid confusion with the Kind used in the type checker and with CmmKind. Finally, in a somewhat unrelated bit (and in honor of Simon PJ, who thought of the name), the Whalley/Davidson 'transaction limit' is now called 'OptimizationFuel' with the net effect that there are no longer two unrelated uses of the abbreviation 'tx'.
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-041-1/+1
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-031-2/+2
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-011-0/+7
|
* put CmmReturnInfo into a CmmCall (and related types)Norman Ramsey2007-08-201-6/+7
|
* Rename a constructor CmmForeignCall to CmmCallee, and tidy Cmm codesimonpj@microsoft.com2007-08-091-5/+5
| | | | | | This patch should have no effect; it's mainly comments, layout, plus this contructor name change.