summaryrefslogtreecommitdiff
path: root/ghc/lib/std/PrelGHC.hi-boot
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2001-10-03 10:18:31 by rrt]rrt2001-10-031-1506/+0
| | | | | | | | This file shouldn't be in the repository any more (there's a PrelGHC.hi-boot.pp). Why is it only me that notices these phantom leftovers? Why don't they cause problems for other people?
* [project @ 2001-08-17 17:18:51 by apt]apt2001-08-171-0/+1506
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How I spent my summer vacation. Primops ------- The format of the primops.txt.pp file has been enhanced to allow (latex-style) primop descriptions to be included. There is a new flag to genprimopcode that generates documentation including these descriptions. A first cut at descriptions of the more interesting primops has been made, and the file has been reordered a bit. 31-bit words ------------ The front end now can cope with the possibility of 31-bit (or even 30-bit) Int# and Word# types. The only current use of this is to generate external .core files that can be translated into OCAML source files (OCAML uses a one-bit tag to distinguish integers from pointers). The only way to get this right now is by hand-defining the preprocessor symbol WORD_SIZE_IN_BITS, which is normally set automatically from the familiar WORD_SIZE_IN_BYTES. Just in case 31-bit words are used, we now have Int32# and Word32# primitive types and an associated family of operators, paralleling the existing 64-bit stuff. Of course, none of the operators actually need to be implemented in the absence of a 31-bit backend. There has also been some minor re-jigging of the 32 vs. 64 bit stuff. See the description at the top of primops.txt.pp file for more details. Note that, for the first time, the *type* of a primop can now depend on the target word size. Also, the family of primops intToInt8#, intToInt16#, etc. have been renamed narrow8Int#, narrow16Int#, etc., to emphasize that they work on Int#'s and don't actually convert between types. Addresses --------- As another part of coping with the possibility of 31-bit ints, the addr2Int# and int2Addr# primops are now thoroughly deprecated (and not even defined in the 31-bit case) and all uses of them have been removed except from the (deprecated) module hslibs/lang/Addr Addr# should now be treated as a proper abstract type, and has these suitable operators: nullAddr# : Int# -> Addr# (ignores its argument; nullary primops cause problems at various places) plusAddr# : Addr# -> Int# -> Addr# minusAddr : Addr# -> Addr# -> Int# remAddr# : Addr# -> Int# -> Int# Obviously, these don't allow completely arbitrary offsets if 31-bit ints are in use, but they should do for all practical purposes. It is also still possible to generate an address constant, and there is a built-in rule that makes use of this to remove the nullAddr# calls. Misc ---- There is a new compile flag -fno-code that causes GHC to quit after generating .hi files and .core files (if requested) but before generating STG. Z-encoded names for tuples have been rationalized; e.g., Z3H now means an unboxed 3-tuple, rather than an unboxed tuple with 3 commas (i.e., a 4-tuple)! Removed misc. litlits in hslibs/lang Misc. small changes to external core format. The external core description has also been substantially updated, and incorporates the automatically-generated primop documentation; its in the repository at /papers/ext-core/core.tex. A little make-system addition to allow passing CPP options to compiler and library builds.
* [project @ 2001-08-04 06:19:54 by ken]ken2001-08-041-442/+0
| | | | | | | | | | | | | | | | | | | | | | | | | NB: This commit renames some files. In each of your build directories, you will need to: rm -f ghc/compiler/prelude/primops.txt rm -f ghc/compiler/prelude/primops.i rm -f ghc/lib/std/PrelGHC.hi-boot lndir ../fptools # or wherever your CVS working directory is The change: Run PrelGHC.hi-boot through the preprocesor, as we already do primops.txt. This commit introduces a new prefix, ".pp", which means "run through preprocesor". In a previous commit, I changed ghc/compiler/Makefile to preprocess primops.txt into primops.i. That is gone now. We now preprocess primops.txt.pp (a file in the CVS repository) into primops.txt (a platform-dependent file, created at build time). We also preprocess PrelGHC.hi-boot.pp (a file in the CVS repository) into PrelGHC.hi-boot (a platform-dependent file, created at build time). The reason for using the preprocessor is because fewer primops are defined if SUPPORT_LONG_LONGS is undefined. SUPPORT_LONG_LONGS is undefined on 64-bit architectures such as the Alpha.
* [project @ 2001-07-13 11:39:48 by rrt]rrt2001-07-131-0/+1
| | | | Make eqForeignObj a primop; N.B. Not implemented for the NCG
* [project @ 2001-06-27 16:33:10 by simonmar]simonmar2001-06-271-1/+1
| | | | PrelGHC is package 'std'
* [project @ 2001-03-16 10:29:57 by simonmar]simonmar2001-03-161-5/+0
| | | | remove 4 old primops
* [project @ 2001-02-28 00:01:01 by qrczak]qrczak2001-02-281-50/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add {intToInt,wordToWord}{8,16,32}# primops. WARNING: Not implemented in ncg for Alpha and Sparc. But -O -fasm is not going to go far anyway because of other omissions. * Have full repertoire of 8,16,32-bit signed and unsigned MachMisc.Size values. Again only x86 is fully supported. They are used for {index,read,write}{Int,Word}{8,16,32}{OffAddr,Array}# and {intToInt,wordToWord}{8,16,32}# primops. * Have full repertoire of {index,read,write}\ {Char,WideChar,Int,Word,Addr,Float,Double,StablePtr,\ {Int,Word}{8,16,32,64}}\ {OffAddr,Array} primops and appropriate instances. There were various omissions in various places. * Add {plus,minus,times}Word# primops to avoid so many Word# <-> Int# coercions. * Rewrite modules PrelWord and PrelInt almost from scratch. * Simplify fromInteger and realToFrac rules. For each of {Int,Word}{8,16,32} there is just a pair of fromInteger rules replacing the source or target type with Int or Word. For {Int,Word,Int64,Word64} there are rules from any to any. Don't include rules which are derivable from inlining anyway, e.g. those mentioning Integer. Old explicit coercions are simply defined as appropriately typed fromInteger. * Various old coercion functions marked as deprecated. * Add instance Bits Int, and instance {Show,Num,Real,Enum,Integral,Bounded,Ix,Read,Bits} Word. * Coercions to sized integer types consistently behave as cutting the right amount of bits from the infinite two-complement representation. For example (fromIntegral (-1 :: Int8) :: Word64) == maxBound. * ghc/tests/numeric/should_run/arith011 tests {Int,Word}64 and instance Bits Int, and does not try to use overflowing toEnum. arith011.stdout is not updated yet because of a problem I will tell about soon. * Move fromInteger and realToFrac from Prelude to PrelReal. Move fromInt from PrelNum to PrelReal and define as fromInteger. Define toInt as fromInteger. fromInteger is the place to write integer conversion rules for. * Remove ArrayBase.newInitialisedArray, use default definition of newArray instead. * Bugs fixed: - {quot,rem}Word# primop attributes. - integerToInt64# for small negative values. - {min,max}Bound::Int on 64-bit platforms. - iShiftRL64#. - Various Bits instances. * Polishing: - Use 'ppr' instead of 'pprPrimOp' and 'text . showPrimRep'. - PrimRep.{primRepString,showPrimRepToUser} removed. - MachMisc.sizeOf returns Int instead of Integer. - Some eta reduction, parens, spacing, and reordering cleanups - sorry, couldn't resist. * Questions: - Should iShiftRL and iShiftRL64 be removed? IMHO they should, s/iShiftRA/iShiftR/, s/shiftRL/shiftR/. The behaviour on shifting is a property of the signedness of the type, not the operation! I haven't done this change.
* [project @ 2001-02-14 12:59:34 by simonmar]simonmar2001-02-141-0/+1
| | | | | | | - make putMVar block rather than raise an exception when it encounters a full MVar (to match the semantics in our recent paper on async excpetions). - add tryPutMVar, a non-blocking version of putMVar.
* [project @ 2001-01-15 09:55:41 by sewardj]sewardj2001-01-151-0/+1
| | | | | Add mkApUpd0# primop, used to make sure bytecode-compiled top-level things are updateable.
* [project @ 2001-01-03 16:44:29 by sewardj]sewardj2001-01-031-0/+1
| | | | | Start getting the bytecode interpreter to work. A matching commit to compiler/ghci/ByteCodeGen.lhs follows ...
* [project @ 2000-12-15 14:47:15 by sewardj]sewardj2000-12-151-0/+1
| | | | add BCOzh
* [project @ 2000-12-15 11:59:59 by sewardj]sewardj2000-12-151-1/+0
| | | | nuke getBCOPtrszh
* [project @ 2000-12-12 12:19:57 by simonmar]simonmar2000-12-121-7/+43
| | | | | | | | | | | | | - Add primops for {read,write,index}{Int,Word}{8,16,32,64}OffAddr. This enables us to remove all the _casm_s from Int/Word. - Replace new{Char,Int,etc.}Array# with newByteArray# (save a few primops, at the cost of having to know the size of these types in PrelArr). - Implement MArray/IArray support for sized types. finally. - Move the guts of the sized types into ghc/lib/std, we'll need them for doing more FFIish things in the Prelude.
* [project @ 2000-12-11 12:56:13 by simonmar]simonmar2000-12-111-0/+3
| | | | New BCO primops.
* [project @ 2000-12-04 12:31:19 by simonmar]simonmar2000-12-041-0/+2
| | | | merge recent changes from before-ghci-branch onto the HEAD
* [project @ 2000-11-07 10:42:55 by simonmar]simonmar2000-11-071-1/+5
| | | | | merge before-ghci -> before-ghci-branch-merged into the ghc (non-compiler) parts of the tree.
* [project @ 2000-09-26 16:45:33 by simonpj]simonpj2000-09-261-1/+0
| | | | | | | | | | | | * Remove all traces of addr2Integer. Big integer literals are now done by multiplying up small integers. * As a result, we can remove PrelNum.hi-boot altogether. * Correct the default method for (==) in PrelBase. (It simply returned True, which seems bogus to me!) * Add a type signature for PrelBase.mapFB
* [project @ 2000-09-11 11:17:09 by sewardj]sewardj2000-09-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Initial primop support for the metacircular interpreter (GHCI). Only appears if you compile with -DGHCI; if not, the world is unchanged. new primops: indexPtrOffClosure# indexWordOffClosure# modified: dataToTag# -- now dereferences indirections before extracting tag new entry code mci_constr_entry and mci_constr[1..8]entry being the direct and vectored return code fragments for interpreter created constructors. Support for static constructors is not yet done. New handwritten .hc functions: mci_make_constr* being code to create various flavours of constructors from args on the stack. An interface file to describe these will follow in a later commit.
* [project @ 2000-08-21 14:16:57 by simonmar]simonmar2000-08-211-0/+2
| | | | | | | | | | | | | | | | | - add touch# and foreignObjToAddr# primops. - add these functions to ForeignObj: withForeignObj :: ForeignObj -> (Addr -> IO a) -> IO a touchForeignObj :: ForeignObj -> IO () - foreignObjToAddr, which was previously implemented using a _casm_, now uses the foreignObjToAddr# primop. - replace implementations of readXXXOffForeignObj and writeXXXOffForeignObj using the withForeignObj and the Addr operations. ForeignObj.lhs now has no _casms_ in it! (it still can't be compiled with the NCG though, because it has a f.i.d.)
* [project @ 2000-08-02 14:13:26 by rrt]rrt2000-08-021-8/+1
| | | | | | | | | | | | | | | | | Many fixes to DLLisation. These were previously covered up because code was leaking into the import libraries for DLLs, so the fact that some symbols were thought of as local rather than in another DLL wasn't a problem. The main problems addressed by this commit are: 1. Fixes RTS symbols working properly when DLLised. They didn't before. 2. Uses NULL instead of stg_error_entry, because DLL entry points can't be used as static initialisers. 3. PrelGHC.hi-boot changed to be in package RTS, and export of PrelNum and PrelErr moved to PrelBase, so that references to primops & the like are cross-DLL as they should be. 4. Pass imports around as Modules rather than ModuleNames, so that ModuleInitLabels can be checked to see if they're in a DLL or not.
* [project @ 2000-06-28 17:03:17 by simonmar]simonmar2000-06-281-1/+1
| | | | | This file had version 407 burned into it; the convention is that zero means "don't check the version".
* [project @ 2000-05-25 12:41:14 by simonpj]simonpj2000-05-251-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~~~~~~~~~~~~ Apr/May 2000 ~~~~~~~~~~~~ This is a pretty big commit! It adds stuff I've been working on over the last month or so. DO NOT MERGE IT WITH 4.07! Interface file formats have changed a little; you'll need to make clean before remaking. Simon PJ Recompilation checking ~~~~~~~~~~~~~~~~~~~~~~ Substantial improvement in recompilation checking. The version management is now entirely internal to GHC. ghc-iface.lprl is dead! The trick is to generate the new interface file in two steps: - first convert Types etc to HsTypes etc, and thereby build a new ParsedIface - then compare against the parsed (but not renamed) version of the old interface file Doing this meant adding code to convert *to* HsSyn things, and to compare HsSyn things for equality. That is the main tedious bit. Another improvement is that we now track version info for fixities and rules, which was missing before. Interface file reading ~~~~~~~~~~~~~~~~~~~~~~ Make interface files reading more robust. * If the old interface file is unreadable, don't fail. [bug fix] * If the old interface file mentions interfaces that are unreadable, don't fail. [bug fix] * When we can't find the interface file, print the directories we are looking in. [feature] Type signatures ~~~~~~~~~~~~~~~ * New flag -ddump-types to print type signatures Type pruning ~~~~~~~~~~~~ When importing data T = T1 A | T2 B | T3 C it seems excessive to import the types A, B, C as well, unless the constructors T1, T2 etc are used. A,B,C might be more types, and importing them may mean reading more interfaces, and so on. So the idea is that the renamer will just import the decl data T unless one of the constructors is used. This turns out to be quite easy to implement. The downside is that we must make sure the constructors are always available if they are really needed, so I regard this as an experimental feature. Elimininate ThinAir names ~~~~~~~~~~~~~~~~~~~~~~~~~ Eliminate ThinAir.lhs and all its works. It was always a hack, and now the desugarer carries around an environment I think we can nuke ThinAir altogether. As part of this, I had to move all the Prelude RdrName defns from PrelInfo to PrelMods --- so I renamed PrelMods as PrelNames. I also had to move the builtinRules so that they are injected by the renamer (rather than appearing out of the blue in SimplCore). This is if anything simpler. Miscellaneous ~~~~~~~~~~~~~ * Tidy up the data types involved in Rules * Eliminate RnEnv.better_provenance; use Name.hasBetterProv instead * Add Unique.hasKey :: Uniquable a => a -> Unique -> Bool It's useful in a lot of places * Fix a bug in interface file parsing for __U[!]
* [project @ 2000-05-10 11:02:00 by simonmar]simonmar2000-05-101-1/+1
| | | | rename takeMaybeMVar to tryTakeMVar
* [project @ 2000-04-13 14:27:15 by panne]panne2000-04-131-1/+0
| | | | Removed the useless (and hard to implement) readForeignObjOffAddr#
* [project @ 2000-04-13 11:56:35 by simonpj]simonpj2000-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for 'packages'. * A package is a group of modules. * A package has a name (e.g. std) * A package is built into a single library (Unix; e.g. libHSstd.a) or a single DLL (Windows; e.g. HSstd.dll) * The '-package-name foo' flag tells GHC that the module being compiled is destined for package foo. * The '-package foo' flag tells GHC to make available modules from package 'foo'. It replaces '-syslib foo' which is now deprecated. * Cross-package references cost an extra indirection in Windows, but not Unix * GHC does not maintain detailed cross-package dependency information. It does remember which modules in other packages the current module depends on, but not which things within those imported things. All of this tidies up the Prelude enormously. The Prelude and Standard Libraries are built into a singl package called 'std'. (This is a change; the library is now called libHSstd.a instead of libHS.a)
* [project @ 2000-04-12 15:35:18 by simonmar]simonmar2000-04-121-0/+1
| | | | | Add takeMaybeMVarzh (I'm doing this commit in bits, since my working sources are so full of changes I can't easily unpick them...)
* [project @ 2000-04-11 20:44:17 by panne]panne2000-04-111-1/+1
| | | | | | | | | | | | | | | | | | Cleaning up the foreign object naming mess: * Renamed the primop from makeForeignObj# to mkForeignObj#, this is more consistent with the old Foreign.mkForeignObj. * PrelForeign now exports makeForeignObj with the new signature. * freeFile.c now uses StgAddr instead of StgForeignObj, this removes the need for some fixIOs. * Lots of import tweaking to prepare The Big Foreign Renamer, which will move most of Foreign to ForeignObj, and FFI to Foreign. Note: I've tried to track the changes in the interpreter sources, but didn't test them.
* [project @ 2000-03-23 17:45:17 by simonpj]simonpj2000-03-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This utterly gigantic commit is what I've been up to in background mode in the last couple of months. Originally the main goal was to get rid of Con (staturated constant applications) in the CoreExpr type, but one thing led to another, and I kept postponing actually committing. Sorry. Simon, 23 March 2000 I've tested it pretty thoroughly, but doubtless things will break. Here are the highlights * Con is gone; the CoreExpr type is simpler * NoRepLits have gone * Better usage info in interface files => less recompilation * Result type signatures work * CCall primop is tidied up * Constant folding now done by Rules * Lots of hackery in the simplifier * Improvements in CPR and strictness analysis Many bug fixes including * Sergey's DoCon compiles OK; no loop in the strictness analyser * Volker Wysk's programs don't crash the CPR analyser I have not done much on measuring compilation times and binary sizes; they could have got worse. I think performance has got significantly better, though, in most cases. Removing the Con form of Core expressions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The big thing is that For every constructor C there are now *two* Ids: C is the constructor's *wrapper*. It evaluates and unboxes arguments before calling $wC. It has a perfectly ordinary top-level defn in the module defining the data type. $wC is the constructor's *worker*. It is like a primop that simply allocates and builds the constructor value. Its arguments are the actual representation arguments of the constructor. Its type may be different to C, because: - useless dict args are dropped - strict args may be flattened For every primop P there is *one* Id, its (curried) Id Neither contructor worker Id nor the primop Id have a defminition anywhere. Instead they are saturated during the core-to-STG pass, and the code generator generates code for them directly. The STG language still has saturated primops and constructor applications. * The Const type disappears, along with Const.lhs. The literal part of Const.lhs reappears as Literal.lhs. Much tidying up in here, to bring all the range checking into this one module. * I got rid of NoRep literals entirely. They just seem to be too much trouble. * Because Con's don't exist any more, the funny C { args } syntax disappears from inteface files. Parsing ~~~~~~~ * Result type signatures now work f :: Int -> Int = \x -> x -- The Int->Int is the type of f g x y :: Int = x+y -- The Int is the type of the result of (g x y) Recompilation checking and make ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The .hi file for a modules is not touched if it doesn't change. (It used to be touched regardless, forcing a chain of recompilations.) The penalty for this is that we record exported things just as if they were mentioned in the body of the module. And the penalty for that is that we may recompile a module when the only things that have changed are the things it is passing on without using. But it seems like a good trade. * -recomp is on by default Foreign declarations ~~~~~~~~~~~~~~~~~~~~ * If you say foreign export zoo :: Int -> IO Int then you get a C produre called 'zoo', not 'zzoo' as before. I've also added a check that complains if you export (or import) a C procedure whose name isn't legal C. Code generation and labels ~~~~~~~~~~~~~~~~~~~~~~~~~~ * Now that constructor workers and wrappers have distinct names, there's no need to have a Foo_static_closure and a Foo_closure for constructor Foo. I nuked the entire StaticClosure story. This has effects in some of the RTS headers (i.e. s/static_closure/closure/g) Rules, constant folding ~~~~~~~~~~~~~~~~~~~~~~~ * Constant folding becomes just another rewrite rule, attached to the Id for the PrimOp. To achieve this, there's a new form of Rule, a BuiltinRule (see CoreSyn.lhs). The prelude rules are in prelude/PrelRules.lhs, while simplCore/ConFold.lhs has gone. * Appending of constant strings now works, using fold/build fusion, plus the rewrite rule unpack "foo" c (unpack "baz" c n) = unpack "foobaz" c n Implemented in PrelRules.lhs * The CCall primop is tidied up quite a bit. There is now a data type CCall, defined in PrimOp, that packages up the info needed for a particular CCall. There is a new Id for each new ccall, with an big "occurrence name" {__ccall "foo" gc Int# -> Int#} In interface files, this is parsed as a single Id, which is what it is, really. Miscellaneous ~~~~~~~~~~~~~ * There were numerous places where the host compiler's minInt/maxInt was being used as the target machine's minInt/maxInt. I nuked all of these; everything is localised to inIntRange and inWordRange, in Literal.lhs * Desugaring record updates was broken: it didn't generate correct matches when used withe records with fancy unboxing etc. It now uses matchWrapper. * Significant tidying up in codeGen/SMRep.lhs * Add __word, __word64, __int64 terminals to signal the obvious types in interface files. Add the ability to print word values in hex into C code. * PrimOp.lhs is no longer part of a loop. Remove PrimOp.hi-boot* Types ~~~~~ * isProductTyCon no longer returns False for recursive products, nor for unboxed products; you have to test for these separately. There's no reason not to do CPR for recursive product types, for example. Ditto splitProductType_maybe. Simplification ~~~~~~~~~~~~~~~ * New -fno-case-of-case flag for the simplifier. We use this in the first run of the simplifier, where it helps to stop messing up expressions that the (subsequent) full laziness pass would otherwise find float out. It's much more effective than previous half-baked hacks in inlining. Actually, it turned out that there were three places in Simplify.lhs that needed to know use this flag. * Make the float-in pass push duplicatable bindings into the branches of a case expression, in the hope that we never have to allocate them. (see FloatIn.sepBindsByDropPoint) * Arrange that top-level bottoming Ids get a NOINLINE pragma This reduced gratuitous inlining of error messages. But arrange that such things still get w/w'd. * Arrange that a strict argument position is regarded as an 'interesting' context, so that if we see foldr k z (g x) then we'll be inclined to inline g; this can expose a build. * There was a missing case in CoreUtils.exprEtaExpandArity that meant we were missing some obvious cases for eta expansion Also improve the code when handling applications. * Make record selectors (identifiable by their IdFlavour) into "cheap" operations. [The change is a 2-liner in CoreUtils.exprIsCheap] This means that record selection may be inlined into function bodies, which greatly improves the arities of overloaded functions. * Make a cleaner job of inlining "lone variables". There was some distributed cunning, but I've centralised it all now in SimplUtils.analyseCont, which analyses the context of a call to decide whether it is "interesting". * Don't specialise very small functions in Specialise.specDefn It's better to inline it. Rather like the worker/wrapper case. * Be just a little more aggressive when floating out of let rhss. See comments with Simplify.wantToExpose A small change with an occasional big effect. * Make the inline-size computation think that case x of I# x -> ... is *free*. CPR analysis ~~~~~~~~~~~~ * Fix what was essentially a bug in CPR analysis. Consider letrec f x = let g y = let ... in f e1 in if ... then (a,b) else g x g has the CPR property if f does; so when generating the final annotated RHS for f, we must use an envt in which f is bound to its final abstract value. This wasn't happening. Instead, f was given the CPR tag but g wasn't; but of course the w/w pass gives rotten results in that case!! (Because f's CPR-ness relied on g's.) On they way I tidied up the code in CprAnalyse. It's quite a bit shorter. The fact that some data constructors return a constructed product shows up in their CPR info (MkId.mkDataConId) not in CprAnalyse.lhs Strictness analysis and worker/wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BIG THING: pass in the demand to StrictAnal.saExpr. This affects situations like f (let x = e1 in (x,x)) where f turns out to have strictness u(SS), say. In this case we can mark x as demanded, and use a case expression for it. The situation before is that we didn't "know" that there is the u(SS) demand on the argument, so we simply computed that the body of the let expression is lazy in x, and marked x as lazily-demanded. Then even after f was w/w'd we got let x = e1 in case (x,x) of (a,b) -> $wf a b and hence let x = e1 in $wf a b I found a much more complicated situation in spectral/sphere/Main.shade, which improved quite a bit with this change. * Moved the StrictnessInfo type from IdInfo to Demand. It's the logical place for it, and helps avoid module loops * Do worker/wrapper for coerces even if the arity is zero. Thus: stdout = coerce Handle (..blurg..) ==> wibble = (...blurg...) stdout = coerce Handle wibble This is good because I found places where we were saying case coerce t stdout of { MVar a -> ... case coerce t stdout of { MVar b -> ... and the redundant case wasn't getting eliminated because of the coerce.
* [project @ 2000-03-17 12:40:03 by simonmar]simonmar2000-03-171-0/+11
| | | | | | | | | Add the readBlahOffAddr suite of primitives. The previous method of using indexStuffOffAddr didn't enforce proper ordering in the I/O monad. The indexBlahOffAddr primops may go away in the future if/when we figure out how to make unsafePerformIO into a no-op at the back end.
* [project @ 2000-03-13 12:11:43 by simonmar]simonmar2000-03-131-1/+0
| | | | | Remove unsafeThawByteArray# primop (which was a no-op), and use unsafeCoerce# instead.
* [project @ 1999-12-20 10:34:27 by simonpj]simonpj1999-12-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements a substantial re-organisation of the Prelude It also fixes a couple of small renamer bugs that were reported recently (notably, Sven pointed out that we weren't reporting unused imports properly) My original goal was to get rid of all "orphan" modules (i.e. ones with instance decls that don't belong either to a tycon or a class defined in the same module). This should reduce the number of interface files that have to be read when compiling small Haskell modules. But like most expeditions into the Prelude Swamp, it spiraled out of control. The result is quite satisfactory, though. GONE AWAY: PrelCCall, PrelNumExtra NEW: PrelReal, PrelFloat, PrelByteArr, PrelNum.hi-boot (The extra PrelNum.hi-boot is because of a tiresome thin-air Id, addr2Integer, which used to be in PrelBase.) Quite a lot of types have moved from one module to another, which entails some changes to part of the compiler (PrelInfo, PrelMods) etc, and there are a few places in the RTS includes and even in the driver that know about these home modules (alas). So the rough structure is as follows, in (linearised) dependency order [this list now appears in PrelBase.lhs] PrelGHC Has no implementation. It defines built-in things, and by importing it you bring them into scope. The source file is PrelGHC.hi-boot, which is just copied to make PrelGHC.hi Classes: CCallable, CReturnable PrelBase Classes: Eq, Ord, Functor, Monad Types: list, (), Int, Bool, Ordering, Char, String PrelTup Types: tuples, plus instances for PrelBase classes PrelShow Class: Show, plus instances for PrelBase/PrelTup types PrelEnum Class: Enum, plus instances for PrelBase/PrelTup types PrelMaybe Type: Maybe, plus instances for PrelBase classes PrelNum Class: Num, plus instances for Int Type: Integer, plus instances for all classes so far (Eq, Ord, Num, Show) Integer is needed here because it is mentioned in the signature of 'fromInteger' in class Num PrelReal Classes: Real, Integral, Fractional, RealFrac plus instances for Int, Integer Types: Ratio, Rational plus intances for classes so far Rational is needed here because it is mentioned in the signature of 'toRational' in class Real Ix Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples PrelArr Types: Array, MutableArray, MutableVar Does *not* contain any ByteArray stuff (see PrelByteArr) Arrays are used by a function in PrelFloat PrelFloat Classes: Floating, RealFloat Types: Float, Double, plus instances of all classes so far This module contains everything to do with floating point. It is a big module (900 lines) With a bit of luck, many modules can be compiled without ever reading PrelFloat.hi PrelByteArr Types: ByteArray, MutableByteArray We want this one to be after PrelFloat, because it defines arrays of unboxed floats. Other Prelude modules are much easier with fewer complex dependencies.
* [project @ 1999-12-08 14:21:52 by simonmar]simonmar1999-12-081-0/+6
| | | | | | | | | | | | | | | | Add Marc Van Dongen's Integer improvements. Specifically: - new primops: gcdInt#, gcdIntegerInt#, divExact#, quotInteger#, remInteger#. - new definitions of quot and rem for Integer in PrelNum (using the new quotInteger# and remInteger# primops instead of quotRemInteger#). Should be slightly faster than before. div & mod aren't likewise optimised (yet). - specialisations of gcd for Int and Integer, and lcm for Integer in PrelNum.
* [project @ 1999-12-01 14:34:38 by simonmar]simonmar1999-12-011-0/+2
| | | | | | | | | | | | | | | | | | Support for blocking & unblocking asynchronous exceptions. - new primops: blockAsyncExceptions#, unblockAsyncExceptions# :: IO a -> IO a - raiseInThread will block if the target thread is currently blocking async exceptions. - async exceptions are currently implicitly blocked inside an exception handler. This decision might be reversed when we have more experience with this stuff. - Move exception-related stuff in the RTS into its own file, Exception.{h,hc}.
* [project @ 1999-11-23 12:12:42 by simonmar]simonmar1999-11-231-0/+26
| | | | failure to commit important files is a jumping-out-of-the-window offence
* [project @ 1999-11-11 15:17:59 by simonmar]simonmar1999-11-111-0/+1
| | | | | Integer divMod now uses the native GMP method. The PrimOp was already there, it just wasn't being used.
* [project @ 1999-08-02 11:43:41 by simonmar]simonmar1999-08-021-0/+1
| | | | add gcdIntegerzh.
* [project @ 1999-05-11 16:47:39 by keithw]keithw1999-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | (this is number 9 of 9 commits to be applied together) Usage verification changes / ticky-ticky changes: We want to verify that SingleEntry thunks are indeed entered at most once. In order to do this, -ticky / -DTICKY_TICKY turns on eager blackholing. We blackhole with new blackholes: SE_BLACKHOLE and SE_CAF_BLACKHOLE. We will enter one of these if we attempt to enter a SingleEntry thunk twice. Note that CAFs are dealt with in by codeGen, and ordinary thunks by the RTS. We also want to see how many times we enter each Updatable thunk. To this end, we have modified -ticky. When -ticky is on, we update with a permanent indirection, and arrange that when we enter a permanent indirection we count the entry and then convert the indirection to a normal indirection. This gives us a means of counting the number of thunks entered again after the first entry. Obviously this screws up profiling, and so you can't build a ticky and profiling compiler any more. Also a few other changes that didn't make it into the previous 8 commits, but form a part of this set.
* [project @ 1999-04-26 16:08:12 by simonm]simonm1999-04-261-0/+1
| | | | add getTag#
* [project @ 1999-04-26 11:09:48 by simonm]simonm1999-04-261-0/+4
| | | | oops, forgot to add dataToTag#.
* [project @ 1999-03-16 13:20:07 by simonm]simonm1999-03-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improvements to the threading model. - asynchronous exceptions supported. - killThread# can now raise an exception in the specified thread. It's new type is killThread# :: ThreadId# -> Exception -> IO () High-level versions: killThread :: ThreadId -> IO () raiseInThread :: ThreadId -> Exception -> IO () (killThread raises a 'ThreadKilled' exception in the specified thread). If the thread has no exception handler, it is killed as before. Otherwise, the exception is passed to the innermost CATCH_FRAME and the thread is woken up if it was blocked. The current computation is suspended, instead of being replaced by the exception (as is the case with throw). Sending an exception to the current thread works too. - new primitive: myThreadId# :: IO ThreadId# and corresponding high-level version myThreadId :: IO ThreadId. - new primitive: yield# :: IO (), and yield :: IO (). - the TSO now contains a pointer to the resource currently blocked on (MVAR or BLACKHOLE_BQ). - Add a giant comment to TSO.h about what the various link fields are supposed to do, and invariants etc.
* [project @ 1999-03-05 10:21:22 by sof]sof1999-03-051-0/+3
| | | | | | | | | | | | | | | | | Support for unsafely thawing your (Byte)Arrays, i.e., added the following ops: MutableArray.unsafeThawArray :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt) MutableArray.unsafeThawByteArray :: Ix ix => ByteArray ix -> ST s (MutableByteArray s ix) MutableArray.thawByteArray :: Ix ix => ByteArray ix -> ST s (MutableByteArray s ix) ST.unsafeThawSTArray :: Ix ix => Array ix elt -> ST s (STArray s ix elt) LazyST.unsafeThawSTArray :: Ix ix => Array ix elt -> ST s (STArray s ix elt) IOExts.unsafeFreezeIOArray :: Ix ix => IOArray ix elt -> IO (Array ix elt) IOExts.unsafeThawIOArray :: Ix ix => Array ix elt -> IO (IOArray ix elt) + removed the re-exportation of Monad that ST and LazyST did.
* [project @ 1999-02-18 12:26:11 by simonm]simonm1999-02-181-2/+0
| | | | | | | | | | | | | | | | | Add two new operations to StgPrimFloat.c: __int_encodeFloat __int_encodeDouble for encoding floats/doubles from small integers. This avoids having to convert small integers to large ones before an encodeFloat operation, and fixes the two cases of slowdown in nofib after the small integer changes. Also: - remove encodeFloat and decodeFloat as primops - use foreign import for encode{Float,Double} and the various isNaN etc. ccalls in PrelNumExtra.
* [project @ 1999-02-17 15:57:20 by simonm]simonm1999-02-171-1/+4
| | | | | | | | | | | | | | | | | | Fast Integers. The rep. of Integers is now data Integer = S# Int# | J# Int# ByteArray# - several new primops added for overflow-detecting arithmetic - negateInteger# removed; it can be done directly - integer_0, integer_1 etc. removed. - the compiler now uses S# where it previously used int2Integer. - the compiler generates small integers for -2^32 .. 2^32-1, instead of -2^29 .. -2^29-1. - PrelST.State datatype moved to LazyST (its only use). - some library code (in Time.lhs) still needs cleaning up, it depends on the Integer rep.
* [project @ 1999-02-11 17:15:20 by simonm]simonm1999-02-111-1/+1
| | | | More finalise/finalize updates.
* [project @ 1999-02-11 14:35:23 by simonm]simonm1999-02-111-1/+1
| | | | More weak pointer changes.
* [project @ 1999-02-01 18:05:30 by simonm]simonm1999-02-011-1/+2
| | | | | | - Add finalise# - Add mkWeakNoFinaliser - Move deRefWeak# from an out-of-line primop to an inline one.
* [project @ 1999-01-28 11:27:01 by simonpj]simonpj1999-01-281-255/+257
| | | | Changes to PrelGHC.hi-boot for new z-encoding
* [project @ 1999-01-26 12:24:57 by simonm]simonm1999-01-261-0/+6
| | | | More stable name additions/changes.
* [project @ 1999-01-14 18:12:47 by sof]sof1999-01-141-5/+1
| | | | | | | Changes to make the Prelude comply with Haskell 98. I claim that this completes GHC's implementation of Haskell 98 (at least feature-wise, but there's bound to be some bugs lurking..)
* [project @ 1998-12-21 09:41:09 by simonpj]simonpj1998-12-211-2/+5
| | | | Forgot to commit PrelGHC.hi-boot; changes to syntax of open kind in CCallable