summaryrefslogtreecommitdiff
path: root/compiler/ghci/Linker.lhs
Commit message (Collapse)AuthorAgeFilesLines
...
* Implememt -fdefer-type-errors (Trac #5624)Simon Peyton Jones2012-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the idea of deferring (most) type errors to runtime, instead emitting only a warning at compile time. The basic idea is very simple: * The on-the-fly unifier in TcUnify never fails; instead if it gets stuck it emits a constraint. * The constraint solver tries to solve the constraints (and is entirely unchanged, hooray). * The remaining, unsolved constraints (if any) are passed to TcErrors.reportUnsolved. With -fdefer-type-errors, instead of emitting an error message, TcErrors emits a warning, AND emits a binding for the constraint witness, binding it to (error "the error message"), via the new form of evidence TcEvidence.EvDelayedError. So, when the program is run, when (and only when) that witness is needed, the program will crash with the exact same error message that would have been given at compile time. Simple really. But, needless to say, the exercise forced me into some major refactoring. * TcErrors is almost entirely rewritten * EvVarX and WantedEvVar have gone away entirely * ErrUtils is changed a bit: * New Severity field in ErrMsg * Renamed the type Message to MsgDoc (this change touches a lot of files trivially) * One minor change is that in the constraint solver we try NOT to combine insoluble constraints, like Int~Bool, else all such type errors get combined together and result in only one error message! * I moved some definitions from TcSMonad to TcRnTypes, where they seem to belong more
* 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.
* fix the object suffix when using TH with profiling (#5554)Simon Marlow2011-10-181-22/+27
|
* Add support for all top-level declarations to GHCiSimon Marlow2011-09-211-6/+55
| | | | | | | | | | | | | | | | This is work mostly done by Daniel Winograd-Cort during his internship at MSR Cambridge, with some further refactoring by me. This commit adds support to GHCi for most top-level declarations that can be used in Haskell source files. Class, data, newtype, type, instance are all supported, as are Type Family-related declarations. The current set of declarations are shown by :show bindings. As with variable bindings, entities bound by newer declarations shadow earlier ones. Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054. Documentation to follow.
* Followup to #5289 changes: fix searching for dynamic libraries and useSimon Marlow2011-08-031-3/+1
| | | | | | of the RTS addDLL() API on Windows. When searching for DLLs we should include the .dll extension, but addDLL() takes a filename without the extension.
* Fix #5289 (loading libstdc++.so in GHCi), and also fix some otherSimon Marlow2011-08-031-170/+58
| | | | | | | | | | | | | linking scenarios. We weren't searching for .a archives to satisfy -lfoo options on the GHCi command line, for example. I've tidied up the code in this module so that dealing with -l options on the command line is consistent with the handling of extra-libraries for packages. While I was here I moved some stuff out of Linker.hs that didn't seem to belong here: dataConInfoPtrToName (now in new module DebuggerUtils) and lessUnsafeCoerce (now in DynamicLoading, next to its only use)
* Add CoreMonad.reinitializeGlobals so plugins can work around linker issuesMax Bolingbroke2011-07-291-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a plugin is loaded, it currently gets linked against a *newly loaded* copy of the GHC package. This would not be a problem, except that the new copy has its own mutable state that is not shared with that state that has already been initialized by the original GHC package. This leads to loaded plugins calling GHC code which pokes the static flags, and then dying with a panic because the static flags *it* sees are uninitialized. There are two possible solutions: 1. Export the symbols from the GHC executable from the GHC library and link against this existing copy rather than a new copy of the GHC library 2. Carefully ensure that the global state in the two copies of the GHC library matches I tried 1. and it *almost* works (and speeds up plugin load times!) except on Windows. On Windows the GHC library tends to export more than 65536 symbols (see #5292) which overflows the limit of what we can export from the EXE and causes breakage. (Note that if the GHC exeecutable was dynamically linked this wouldn't be a problem, because we could share the GHC library it links to.) We are going to try 2. instead. Unfortunately, this means that every plugin will have to say `reinitializeGlobals` before it does anything, but never mind. I've threaded the cr_globals through CoreM rather than giving them as an argument to the plugin function so that we can turn this function into (return ()) without breaking any plugins when we eventually get 1. working.
* Fix DLL/SO loading (see #5313).Simon Marlow2011-07-121-21/+18
| | | | | The code in here is a bit of a mess. I've fixed up some inconsistencies I can see, but it could do with an overhaul.
* SafeHaskell: Transitively check safety when compiling a module.David Terei2011-06-171-1/+1
| | | | | | | | | | While we previously checked the safety of safe imported modules we didn't do this check transitively. This can be a problem when we depend on a trustworthy module in a package that is no longer trusted, so we should fail compilation. We already stored in an interface file the transitive list of packages a module depends on. Now we extend that list to include a flag saying if we depend on that package being trusted as well.
* Add dynamically-linked plugins (see Trac #3843)Simon Peyton Jones2011-06-161-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch was originally developed by Max Bolingbroke, and worked on further by Austin Seipp. It allows you to write a Core-to-Core pass and have it dynamically linked into an otherwise-unmodified GHC, and run at a place you specify in the Core optimisation pipeline. Main components: - CoreMonad: new types Plugin, PluginPass plus a new constructor CoreDoPluginPass in CoreToDo - SimplCore: stuff to dynamically load any plugins, splice them into the core-to-core pipeline, and invoke them - Move "getCoreToDo :: DynFlags -> [CoreToDo]" which constructs the main core-to-core pipeline from CoreMonad to SimplCore SimplCore is the driver for the optimisation pipeline, and it makes more sense to have the pipeline construction in the driver not in the infrastructure module. - New module DynamicLoading: invoked by SimplCore to load any plugins Some consequential changes in Linker. - New module GhcPlugins: this should be imported by plugin modules; it it not used by GHC itself.
* Fix parsing constructors containing dots; fixes trac #4891Ian Lynagh2011-04-031-3/+10
|
* GHCi linker: Assume non-Haskell libraries are dynamic libsIan Lynagh2010-12-131-0/+3
| | | | | This works around a segfault we get when trying to load libiconv.a on some platforms.
* Always enable the archive-loading codeIan Lynagh2010-11-271-27/+14
| | | | If the GHCi .o lib doesn't exist, load the .a instead
* Don't automatically link the haskell98 packageIan Lynagh2010-10-061-1/+1
| | | | | The default language is now Haskell2010, so this was a little odd. Also, --make is now on by default, so this was largely irrelevant.
* Implement archive loading for ghciIan Lynagh2010-09-201-7/+34
|
* Filter out the FFI library when loading package in ghciIan Lynagh2010-09-201-1/+7
| | | | | | | | The FFI GHCi import lib isn't needed as compiler/ghci/Linker.lhs + rts/Linker.c link the interpreted references to FFI to the compiled FFI. We therefore filter it out so that we don't get duplicate symbol errors.
* Remove (most of) the FiniteMap wrapperIan Lynagh2010-09-141-2/+2
| | | | | | | | We still have insertList, insertListWith, deleteList which aren't in Data.Map, and foldRightWithKey which works around the fold(r)WithKey addition and deprecation.
* Super-monster patch implementing the new typechecker -- at lastsimonpj@microsoft.com2010-09-131-1/+2
| | | | | | | | | This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
* Make PersistentLinkerState fields strict; fixes #4208Ian Lynagh2010-07-271-4/+4
| | | | We modify fields a lot, so we retain the old value if they aren't forced.
* adapt to the new async exceptions APISimon Marlow2010-07-091-2/+2
|
* Remove LazyUniqFM; fixes trac #3880Ian Lynagh2010-03-201-1/+1
|
* locateOneObj: don't look for dynamic libs in static modeSimon Marlow2010-01-031-10/+7
| | | | | also replace picIsOn with isDynamicGhcLib, as __PIC__ is not the correct test for whether the GHC library is dynamically linked.
* #3604: treat TH with -dynamic in the same way as -profSimon Marlow2009-11-041-1/+10
| | | | | | | | That is, you have to build the library/program without -dynamic first, to get plain object files, and then build it again with -dynamic. I still need to check whether any changes to Cabal are required to make this work.
* Allow TH/annotations to be used with -dynamicSimon Marlow2009-09-081-1/+1
|
* Follow changes in Cabal: package -> sourcePackageIdSimon Marlow2009-08-241-2/+2
|
* Add unique package identifiers (InstalledPackageId) in the package DBSimon Marlow2009-08-201-9/+12
| | | | | See commentary at http://hackage.haskell.org/trac/ghc/wiki/Commentary/Packages
* Make -dynamic a proper way, so we read the .dyn_hi filesSimon Marlow2009-08-201-1/+1
| | | | | | | | Also, I cleaned up some of the way-related infrastructure, removing two global variables. There's more that could be done here, but it's a start. The way flags probably don't need to be static any more.
* Make the dynamic linker thread-safe.Thomas Schilling2009-08-171-144/+146
| | | | | | | | | | | | The current implementation is rather pessimistic. The persistent linker state is now an MVar and all exported Linker functions are wrapped in modifyMVar calls. This is serves as a big lock around all linker functions. There might be a chance for more concurrency in a few places. E.g., extending the closure environment and loading packages might be independent in some cases. But for now it's better to be on the safe side.
* remove unnecessary -#include optionsSimon Marlow2009-08-021-2/+0
|
* Remove unused importsIan Lynagh2009-07-071-2/+0
|
* Support for -fwarn-unused-do-bind and -fwarn-wrong-do-bind, as per #3263Max Bolingbroke2009-07-011-1/+1
|
* tidy up "missing symbol" error messageSimon Marlow2009-03-131-1/+1
|
* Replace couple of fromJust with expectJustClemens Fruhwirth2008-11-071-3/+1
|
* Generalise type of 'withExtendedLinkEnv'.Thomas Schilling2008-09-151-7/+8
|
* Windows: print an error message in addDLLSimon Marlow2008-09-031-9/+8
| | | | | | | | Also, look for libXXX.dll in addition to XXX.dll (see #1883, this isn't really a proper fix, but it'll help in some cases). And I tidied up the error message for a DLL load failure, though it's still a bit of a mess because addDLL is supposed to return a (static) string with the error message, but this isn't possible on Windows.
* Follow changes in CabalIan Lynagh2008-08-131-1/+1
|
* Follow changes in the base libraryIan Lynagh2008-07-311-1/+1
| | | | | TopHandler now uses the new extensible exceptions module, so we need to interact with it using the new types.
* Follow extensible exception changesIan Lynagh2008-07-301-12/+12
|
* small cleanupSimon Marlow2008-07-241-2/+3
|
* Move -fno-cse flags from Makefile into pragmasIan Lynagh2008-07-111-0/+3
| | | | These are needed for GLOBAL_VAR's to work properly
* Follow Cabal changesIan Lynagh2008-06-261-3/+6
|
* Fix warnings in LinkerIan Lynagh2008-06-141-22/+27
|
* Use the right set of linkables in unload_wkrIan Lynagh2008-06-141-1/+1
|
* Use bracket_ rather than bracket in withExtendedLinkEnvIan Lynagh2008-06-141-5/+5
|
* Remove more ifdefferyIan Lynagh2008-06-141-12/+6
|
* Remove more ifdefferyIan Lynagh2008-06-141-4/+3
|
* Remove more ifdefferyIan Lynagh2008-06-141-18/+13
|
* Remove some ifdefferyIan Lynagh2008-06-141-12/+8
|
* FIX #2014: Template Haskell w/ mutually recursive modulesSimon Marlow2008-05-151-29/+35
| | | | Try to load interfaces in getLinkDeps
* Follow Cabal changes in ghci/LinkerIan Lynagh2008-05-111-2/+2
|