summaryrefslogtreecommitdiff
path: root/ghc/includes/PrimOps.h
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2000-07-20 17:06:41 by rrt]rrt2000-07-201-48/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What's the story, Rory? My name's not Rory. Owing to circumstances not fully understood, the RTS used to work DLLized, even though it was largely broken. Unfortunately, this was recently fixed. What used to happen? The EF_ macro from StgMacros.h was used to refer to primops &c. Why was this a Bad Thing? Because you need to use EDF_ when building with DLLs. What was the result? primops such as divExactInteger were compiled as _divExactInteger, rather than __imp__div_Exact_Integer, so they didn't refer to the DLL routines. How on earth did it work? I'm not sure, but somehow the code for the relevant routines got linked into the import libraries (e.g. libHSrts_imp.a), and were thus linked statically into the final binary. So that explains why the import libraries (supposedly just containing stubs) were larger than the DLLs they were stubbing, or the static libraries, for that matter? Perhaps. Golly! Indeed. What caused this code leakage? That's what I don't know. Perhaps a bug in the Cygwin DLL-building tools? I've upgraded from B20.1 to 1.1 recently. So, what's the hack, Mac? My name's not Mac. I added a new macro, ERTSF_, which uses DLL_IMPORT_RTS to make sure that the Right Thing is always done (because you mustn't make DLL references to RTS routines when compiling the RTS). Thanks for the chat, Matt! <punch>
* [project @ 2000-06-04 20:32:49 by panne]panne2000-06-041-3/+3
| | | | Fixed braino.
* [project @ 2000-06-04 18:27:45 by panne]panne2000-06-041-9/+6
| | | | | | | The GCD saga continues: Fixed gcdInt/gcdInteger to work correctly for non-positive values, i.e. call mpn_gcd_1 only with positive inputs, and issue an error if both operands are zero. This should fix the bug reported by Marc.
* [project @ 2000-05-28 20:22:08 by panne]panne2000-05-281-3/+3
| | | | | | Fixed gcdIntegerInt# primop, the previous macros was completely wrong. gcd for Integers worked only as long the corresponding RULE in PrelReal didn't fire.
* [project @ 2000-05-12 20:01:28 by panne]panne2000-05-121-34/+34
| | | | | | | | | Fixed bug in integerTo{Word,Int}64zh primops: They used the number of allocated *words* to determine size of an integer, but this is wrong due to normalization. When e.g. two large numbers with different sign, but approximately same absolute value are added, MPN_NORMALIZE cuts down the *size*, but the allocation stays the same. Simple fix: Use size parameter of macros directly. Easier and more correct! :-)
* [project @ 2000-05-10 11:02:00 by simonmar]simonmar2000-05-101-2/+2
| | | | rename takeMaybeMVar to tryTakeMVar
* [project @ 2000-04-13 15:37:11 by panne]panne2000-04-131-4/+4
| | | | StgStablePtr is now void*, as required by The Happy Bit Fiddlers
* [project @ 2000-04-12 17:12:23 by simonmar]simonmar2000-04-121-1/+2
| | | | add takeMaybeMVarzh_fast decl.
* [project @ 2000-04-11 20:44:17 by panne]panne2000-04-111-2/+2
| | | | | | | | | | | | | | | | | | 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-04-05 14:26:31 by panne]panne2000-04-051-2/+2
| | | | | | Changed a bunch of `#endif FOO' to `#endif /* FOO */', the former is not strictly ANSI (don't know if the latter is, but `gcc -Wall -ansi -pedantic' is silent then).
* [project @ 2000-03-31 03:09:35 by hwloidl]hwloidl2000-03-311-29/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Numerous changes in the RTS to get GUM-4.06 working (currently works with parfib-ish programs). Most changes are isolated in the rts/parallel dir. rts/parallel/: The most important changes are a rewrite of the (un-)packing code (Pack.c) and changes in LAGA, GALA table operations (Global.c) expecially in rebuilding the tables during GC. rts/: Minor changes in Schedule.c, GC.c (interface to par specific root marking and evacuation), and lots of additions to Sanity.c (surprise ;-) Main.c change for startup: I use a new function rts_evalNothing to start non-main-PEs in a PAR || SMP setup (RtsAPI.c) includes/: Updated GranSim macros in PrimOps.h. lib/std: Few changes in PrelHandle.c etc replacing ForeignObj by Addr in a PAR setup (we still don't support ForeignObjs or WeakPtrs in GUM). Typically use #define FILE_OBJECT Addr when dealing with files. hslibs/lang/: Same as above (in Foreign(Obj).lhs, Weak.lhs, IOExts.lhs etc). -- HWL
* [project @ 2000-03-17 12:40:03 by simonmar]simonmar2000-03-171-32/+34
| | | | | | | | | 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-2/+1
| | | | | Remove unsafeThawByteArray# primop (which was a no-op), and use unsafeCoerce# instead.
* [project @ 2000-01-18 12:37:33 by simonmar]simonmar2000-01-181-47/+3
| | | | | - context switch after a `par` - remove some #if 0'd code
* [project @ 2000-01-13 14:33:57 by hwloidl]hwloidl2000-01-131-1/+113
| | | | | Merged GUM-4-04 branch into the main trunk. In particular merged GUM and SMP code. Most of the GranSim code in GUM-4-04 still has to be carried over.
* [project @ 2000-01-12 15:15:17 by simonmar]simonmar2000-01-121-1/+14
| | | | Add 'par' and sparking support to the SMP implementation.
* [project @ 2000-01-07 10:27:33 by sewardj]sewardj2000-01-071-2/+2
| | | | Remove _fast from macro name gcdIntegerIntzh_fast.
* [project @ 1999-12-08 14:21:52 by simonmar]simonmar1999-12-081-1/+18
| | | | | | | | | | | | | | | | 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-8/+4
| | | | | | | | | | | | | | | | | | 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-09 10:05:07 by sewardj]sewardj1999-11-091-2/+2
| | | | mulIntCzh (i386_TARGET_ARCH): xor --> xorl
* [project @ 1999-11-02 15:05:38 by simonmar]simonmar1999-11-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds in the current state of our SMP support. Notably, this allows the new way 's' to be built, providing support for running multiple Haskell threads simultaneously on top of any pthreads implementation, the idea being to take advantage of commodity SMP boxes. Don't expect to get much of a speedup yet; due to the excessive locking required to synchronise access to mutable heap objects, you'll see a slowdown in most cases, even on a UP machine. The best I've seen is a 1.6-1.7 speedup on an example that did no locking (two optimised nfibs in parallel). - new RTS -N flag specifies how many pthreads to start. - new driver -smp flag, tells the driver to use way 's'. - new compiler -fsmp option (not for user comsumption) tells the compiler not to generate direct jumps to thunk entry code. - largely rewritten scheduler - _ccall_GC is now done by handing back a "token" to the RTS before executing the ccall; it should now be possible to execute blocking ccalls in the current thread while allowing the RTS to continue running Haskell threads as normal. - you can only call thread-safe C libraries from a way 's' build, of course. Pthread support is still incomplete, and weird things (including deadlocks) are likely to happen.
* [project @ 1999-08-25 16:11:43 by simonmar]simonmar1999-08-251-2/+4
| | | | | | | | | | | | | | | | | Support for thread{WaitRead,WaitWrite,Delay}. These should behave identically to the 3.02 implementations. We now have the virtual timer on during all program runs, which ticks at 50Hz by default. This is used to implement threadDelay, so you won't get any better granularity than the tick frequency unfortunately. It remains to be seen whether using the virtual timer will have a measurable impact on performance for non-threadDelaying programs. All operations in the I/O subsystem should now be non-blocking with respect to other running Haskell threads. It remains to be seen whether this will have a measurable performance impact on non-concurrent programs (probably not).
* [project @ 1999-08-25 10:23:51 by simonmar]simonmar1999-08-251-1/+3
| | | | Eq and Ord instances for ThreadId.
* [project @ 1999-08-24 09:36:41 by simonmar]simonmar1999-08-241-6/+2
| | | | oops, back out some other changes that made it in by mistake.
* [project @ 1999-08-24 09:33:08 by simonmar]simonmar1999-08-241-3/+7
| | | | | | An inaccurate constraint on the inline assembly code for mulIntC# caused gcc 2.95 to overoptimise around it, leading to bogus multiply code for Integers.
* [project @ 1999-07-29 10:00:22 by simonmar]simonmar1999-07-291-6/+12
| | | | | | Shift operations where the shift count is greater than the width of the type being shifted are now defined as returning zero (or -1 in the case of a negative integer being shifted right with iShiftRA).
* [project @ 1999-06-25 10:09:19 by panne]panne1999-06-251-4/+4
| | | | Make -optc-DDEBUG work again
* [project @ 1999-05-10 09:56:50 by sof]sof1999-05-101-9/+5
| | | | extend cleanup to integer2Word#
* [project @ 1999-05-10 09:50:49 by simonm]simonm1999-05-101-14/+11
| | | | integer2Int# take 4: cleaned up a little.
* [project @ 1999-05-10 09:26:41 by sof]sof1999-05-101-4/+4
| | | | integer2Int#, take 3
* [project @ 1999-05-07 15:42:49 by sof]sof1999-05-071-3/+10
| | | | integer2Int# again: don't flip sign unless outside [minInt,maxInt]
* [project @ 1999-05-04 08:58:18 by sof]sof1999-05-041-2/+2
| | | | integer2Int# isn't sign preserving any longer, but modulo maxBound
* [project @ 1999-04-27 12:32:15 by simonm]simonm1999-04-271-4/+1
| | | | Remove declaration of PrelBase_Bool_closure_tbl.
* [project @ 1999-04-23 13:54:12 by simonm]simonm1999-04-231-1/+8
| | | | dataToTag# support.
* [project @ 1999-03-16 13:20:07 by simonm]simonm1999-03-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+4
| | | | | | | | | | | | | | | | | 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-03-02 19:44:07 by sof]sof1999-03-021-19/+19
| | | | | - misc changes to support DLLs - StgNat* --> StgWord*
* [project @ 1999-03-01 10:25:20 by simonm]simonm1999-03-011-10/+11
| | | | Missing { in mulIntCzh
* [project @ 1999-02-18 12:26:11 by simonm]simonm1999-02-181-30/+7
| | | | | | | | | | | | | | | | | 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-113/+171
| | | | | | | | | | | | | | | | | | 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-2/+2
| | | | More finalise/finalize updates.
* [project @ 1999-02-11 14:22:53 by simonm]simonm1999-02-111-2/+2
| | | | | | | - s/finalise/finalize/g - make finalize run the finalizer immediately, and wait for its completion - make mkWeak take a (Maybe (IO ())) for the finalizer argument - remove mkWeakNoFinalizer
* [project @ 1999-02-05 16:02:18 by simonm]simonm1999-02-051-1/+3
| | | | Copyright police.
* [project @ 1999-02-05 15:25:01 by simonm]simonm1999-02-051-3/+2
| | | | Remove MUT_ARR_WORDS. I'm not sure why we had it in the first place.
* [project @ 1999-02-02 14:19:49 by simonm]simonm1999-02-021-4/+4
| | | | Remove warnings in deRefWeakzh.
* [project @ 1999-02-01 18:05:30 by simonm]simonm1999-02-011-2/+12
| | | | | | - Add finalise# - Add mkWeakNoFinaliser - Move deRefWeak# from an out-of-line primop to an inline one.
* [project @ 1999-01-29 09:32:37 by simonm]simonm1999-01-291-3/+3
| | | | zh --> Zh (for genSymZh and resetGenSymZh)
* [project @ 1999-01-27 14:51:14 by simonpj]simonpj1999-01-271-245/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finally! This commits the ongoing saga of Simon's hygiene sweep FUNCTIONALITY ~~~~~~~~~~~~~ a) The 'unused variable' warnings from the renamer work. b) Better error messages here and there, esp type checker c) Fixities for Haskell 98 (maybe I'd done that before) d) Lazy reporting of name clashes for Haskell 98 (ditto) HYGIENE ~~~~~~~ a) type OccName has its own module. OccNames are represented by a single FastString, not three as in the last round. This string is held in Z-encoded form; a decoding function decodes for printing in user error messages. There's a nice tight encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) b) type Module is a proper ADT, in module OccName c) type RdrName is a proper ADT, in its own module d) type Name has a new, somwhat tidier, representation e) much grunting in the renamer to get Provenances right. This makes error messages look better (no spurious qualifiers)
* [project @ 1999-01-26 11:12:41 by simonm]simonm1999-01-261-44/+20
| | | | | | | | - Add Stable Names - Stable pointers and stable names are now both provided by the "Stable" module in ghc/lib/exts. Documentation is updated, and Foriegn still exports the stable pointer operations for backwards compatibility.
* [project @ 1999-01-23 17:48:23 by sof]sof1999-01-231-15/+18
| | | | integerToInt64Zh: didn't handle negative integers particularly well