ghc-hetmet.git
18 years ago[project @ 2005-11-03 11:00:40 by simonmar]
simonmar [Thu, 3 Nov 2005 11:00:40 +0000 (11:00 +0000)]
[project @ 2005-11-03 11:00:40 by simonmar]
Check for librt and clock_gettime()

18 years ago[project @ 2005-11-02 17:41:00 by simonpj]
simonpj [Wed, 2 Nov 2005 17:41:00 +0000 (17:41 +0000)]
[project @ 2005-11-02 17:41:00 by simonpj]
Second correction to the TH fix of Oct 26, involving thFAKE

Original message
  1) A bug in the renaming of [d| brackets |]. The problem was
  that when we renamed the bracket we messed up the name cache, because
  the module was still that of the parent module. Now we set a fake
  module before renaming it.

This commit fixes the typecheker problem in a different way,
in tcLookupGlobal.

18 years ago[project @ 2005-11-02 17:39:57 by simonpj]
simonpj [Wed, 2 Nov 2005 17:39:57 +0000 (17:39 +0000)]
[project @ 2005-11-02 17:39:57 by simonpj]
Trace output only

18 years ago[project @ 2005-11-02 13:05:30 by simonmar]
simonmar [Wed, 2 Nov 2005 13:05:30 +0000 (13:05 +0000)]
[project @ 2005-11-02 13:05:30 by simonmar]
release/acquire the SM lock around scheduleFinalizers(), because we
need to call allocateLocal() in there, which acquires the SM lock.

18 years ago[project @ 2005-11-02 13:04:55 by simonmar]
simonmar [Wed, 2 Nov 2005 13:04:55 +0000 (13:04 +0000)]
[project @ 2005-11-02 13:04:55 by simonmar]
when shutting down, don't allow a worker to exit until the run queue
is empty, because the thread in exitScheduler() is waiting for this.

18 years ago[project @ 2005-11-02 12:26:21 by simonmar]
simonmar [Wed, 2 Nov 2005 12:26:21 +0000 (12:26 +0000)]
[project @ 2005-11-02 12:26:21 by simonmar]
scheduleHandleStackOverflow: fix bug in non-threaded RTS - if
(task->tso != NULL), then (task->tso) is not necessarily the TSO we
are running (in the threaded RTS it is).

Also fix a few non-threaded warnings while I'm here.

18 years ago[project @ 2005-11-02 12:23:58 by simonmar]
simonmar [Wed, 2 Nov 2005 12:23:58 +0000 (12:23 +0000)]
[project @ 2005-11-02 12:23:58 by simonmar]
add an ASSERT

18 years ago[project @ 2005-11-02 11:56:56 by simonmar]
simonmar [Wed, 2 Nov 2005 11:56:56 +0000 (11:56 +0000)]
[project @ 2005-11-02 11:56:56 by simonmar]
Fix warnings when assigning the result of a foreign call to BaseReg
(as now happens in SMP mode with resumeThread()).

18 years ago[project @ 2005-11-02 09:57:45 by simonpj]
simonpj [Wed, 2 Nov 2005 09:57:45 +0000 (09:57 +0000)]
[project @ 2005-11-02 09:57:45 by simonpj]
Correct the TH fix of Oct 26, involving thFAKE
MERGE TO STABLE

Original message
  1) A bug in the renaming of [d| brackets |]. The problem was
  that when we renamed the bracket we messed up the name cache, because
  the module was still that of the parent module. Now we set a fake
  module before renaming it.

But we have to tell the *typechecker* too, not just the renamer.
See comments with TcSplice.tc_bracket (DecBr case).

Should fix TH failures in the STABLE branch

18 years ago[project @ 2005-11-02 09:53:18 by simonpj]
simonpj [Wed, 2 Nov 2005 09:53:18 +0000 (09:53 +0000)]
[project @ 2005-11-02 09:53:18 by simonpj]
Export lists

18 years ago[project @ 2005-10-31 11:53:42 by simonmar]
simonmar [Mon, 31 Oct 2005 11:53:42 +0000 (11:53 +0000)]
[project @ 2005-10-31 11:53:42 by simonmar]
x86_64: pass -fno-unit-at-a-time to gcc.  See comment for details.

18 years ago[project @ 2005-10-31 11:49:29 by simonpj]
simonpj [Mon, 31 Oct 2005 11:49:30 +0000 (11:49 +0000)]
[project @ 2005-10-31 11:49:29 by simonpj]
Wibble to: "Add a new pragma: SPECIALISE INLINE"

I messed up the way that NOINLINE is parsed; this commit fixes it.

18 years ago[project @ 2005-10-31 11:31:10 by simonmar]
simonmar [Mon, 31 Oct 2005 11:31:10 +0000 (11:31 +0000)]
[project @ 2005-10-31 11:31:10 by simonmar]
clean up more junk generated by gcc

18 years ago[project @ 2005-10-31 11:17:53 by simonmar]
simonmar [Mon, 31 Oct 2005 11:17:53 +0000 (11:17 +0000)]
[project @ 2005-10-31 11:17:53 by simonmar]
x86_64: catch and fix one kind of crappy code generated by gcc

    #    movq -4(%rbp), %rax
    #    jmp  *%rax

==>

    #    jmp  *-4(%rbp)

18 years ago[project @ 2005-10-31 10:52:06 by simonmar]
simonmar [Mon, 31 Oct 2005 10:52:06 +0000 (10:52 +0000)]
[project @ 2005-10-31 10:52:06 by simonmar]
Reverse the sense of the is-young-generation test in the update code.
This generates much better code from gcc.

18 years ago[project @ 2005-10-30 19:12:31 by krasimir]
krasimir [Sun, 30 Oct 2005 19:12:31 +0000 (19:12 +0000)]
[project @ 2005-10-30 19:12:31 by krasimir]
Change the way in which the .exe suffix to the output file is added. The reason
is that "-o main" will generate main.exe on Windows while the doesFileExists "main"
in DriverPipeline.link will return False.

18 years ago[project @ 2005-10-29 18:13:52 by krasimir]
krasimir [Sat, 29 Oct 2005 18:13:52 +0000 (18:13 +0000)]
[project @ 2005-10-29 18:13:52 by krasimir]
The guessed output file should have ".exe" extension on Windows. ld tends to
add .exe automatically if the output file doesn't have extension but if
we don't add the extension explicitly then the doesFileExists check in
DriverPipeline.link will fail.

18 years ago[project @ 2005-10-29 14:19:59 by panne]
panne [Sat, 29 Oct 2005 14:19:59 +0000 (14:19 +0000)]
[project @ 2005-10-29 14:19:59 by panne]
Fixed the last commit, which broke the nightly builds. I'm not sure if
this is really a fix or a workaround only, though...

18 years ago[project @ 2005-10-29 05:17:57 by krasimir]
krasimir [Sat, 29 Oct 2005 05:17:57 +0000 (05:17 +0000)]
[project @ 2005-10-29 05:17:57 by krasimir]
The mut_lists array was allocated but never initialized. This was causing SegFault.

18 years ago[project @ 2005-10-28 15:51:15 by simonmar]
simonmar [Fri, 28 Oct 2005 15:51:15 +0000 (15:51 +0000)]
[project @ 2005-10-28 15:51:15 by simonmar]
document -stubdir

18 years ago[project @ 2005-10-28 15:22:39 by simonmar]
simonmar [Fri, 28 Oct 2005 15:22:39 +0000 (15:22 +0000)]
[project @ 2005-10-28 15:22:39 by simonmar]
Add -stubdir option to control location of generated stub files.  Also
do some clean up while I'm here - remove hscStubCOut/hscStubHOut from
DynFlags, and add

  mkStubPaths :: DynFlags -> Module -> ModLocation -> (FilePath,FilePath)

to Finder.  (this seemed better than caching the stub paths in every
ModLocation, because they are rarely needed and only present in home
modules, and are easily calculated from other available information).

-stubdir behaves in exactly the same way as -odir and -hidir.

18 years ago[project @ 2005-10-28 11:35:35 by simonmar]
simonmar [Fri, 28 Oct 2005 11:35:35 +0000 (11:35 +0000)]
[project @ 2005-10-28 11:35:35 by simonmar]
Change the default executable name to match the basename of the source
file containing the Main module (or the module specified by -main-is),
if there is one.  On Windows, the .exe extension is added.

As requested on the ghc-users list, and as implemented by Tomasz
Zielonka <tomasz.zielonka at gmail.com>, with modifications by me.

I changed the type of the mainModIs field of DynFlags from Maybe
String to Module, which removed some duplicate code.

18 years ago[project @ 2005-10-28 11:29:19 by simonmar]
simonmar [Fri, 28 Oct 2005 11:29:19 +0000 (11:29 +0000)]
[project @ 2005-10-28 11:29:19 by simonmar]
Fix double "Linking ..." message, and mention the name of the
executable in the message.

18 years ago[project @ 2005-10-28 08:16:54 by simonmar]
simonmar [Fri, 28 Oct 2005 08:16:54 +0000 (08:16 +0000)]
[project @ 2005-10-28 08:16:54 by simonmar]
Fix links to library doc for Haddock 0.7.

18 years ago[project @ 2005-10-28 08:10:09 by simonmar]
simonmar [Fri, 28 Oct 2005 08:10:09 +0000 (08:10 +0000)]
[project @ 2005-10-28 08:10:09 by simonmar]
Fix recent breakage on non-Windows systems

18 years ago[project @ 2005-10-27 15:26:06 by simonmar]
simonmar [Thu, 27 Oct 2005 15:26:06 +0000 (15:26 +0000)]
[project @ 2005-10-27 15:26:06 by simonmar]
- Very simple work-sharing amongst Capabilities: whenever a Capability
  detects that it has more than 1 thread in its run queue, it runs
  around looking for empty Capabilities, and shares the threads on its
  run queue equally with the free Capabilities it finds.

- unlock the garbage collector's mutable lists, by having private
  mutable lists per capability (and per generation).  The private
  mutable lists are moved onto the main mutable lists at each GC.
  This pulls the old-generation update code out of the storage manager
  mutex, which is one of the last remaining causes of (alleged) contention.

- Fix some problems with synchronising when a GC is required.  We should
  synchronise quicker now.

18 years ago[project @ 2005-10-27 15:21:05 by simonpj]
simonpj [Thu, 27 Oct 2005 15:21:05 +0000 (15:21 +0000)]
[project @ 2005-10-27 15:21:05 by simonpj]
Improve warning a little (suggested by Benjamin Pierce)

18 years ago[project @ 2005-10-27 15:18:50 by simonmar]
simonmar [Thu, 27 Oct 2005 15:18:50 +0000 (15:18 +0000)]
[project @ 2005-10-27 15:18:50 by simonmar]
rtsFatalInternalError(): better to abort() rather than just
stg_exit(), at least then we get a core dump.

18 years ago[project @ 2005-10-27 15:17:11 by simonmar]
simonmar [Thu, 27 Oct 2005 15:17:11 +0000 (15:17 +0000)]
[project @ 2005-10-27 15:17:11 by simonmar]
unpark_tso: call unblockOne() instead of doing the job inline.  This
properly migrates the thread, setting its task to point back to the
right capability, if necessary.

18 years ago[project @ 2005-10-27 14:35:20 by simonpj]
simonpj [Thu, 27 Oct 2005 14:35:21 +0000 (14:35 +0000)]
[project @ 2005-10-27 14:35:20 by simonpj]
Add a new pragma: SPECIALISE INLINE

This amounts to adding an INLINE pragma to the specialised version
of the function.  You can add phase stuff too (SPECIALISE INLINE [2]),
and NOINLINE instead of INLINE.

The reason for doing this is to support inlining of type-directed
recursive functions.  The main example is this:

  -- non-uniform array type
  data Arr e where
    ArrInt  :: !Int -> ByteArray#       -> Arr Int
    ArrPair :: !Int -> Arr e1 -> Arr e2 -> Arr (e1, e2)

  (!:) :: Arr e -> Int -> e
  {-# SPECIALISE INLINE (!:) :: Arr Int -> Int -> Int #-}
  {-# SPECIALISE INLINE (!:) :: Arr (a, b) -> Int -> (a, b) #-}
  ArrInt  _ ba    !: (I# i) = I# (indexIntArray# ba i)
  ArrPair _ a1 a2 !: i      = (a1 !: i, a2 !: i)

If we use (!:) at a particular array type, we want to inline (:!),
which is recursive, until all the type specialisation is done.

On the way I did a bit of renaming and tidying of the way that
pragmas are carried, so quite a lot of files are touched in a
fairly trivial way.

18 years ago[project @ 2005-10-27 14:34:32 by simonpj]
simonpj [Thu, 27 Oct 2005 14:34:32 +0000 (14:34 +0000)]
[project @ 2005-10-27 14:34:32 by simonpj]
Filter out inaccessible GADT alternatives

18 years ago[project @ 2005-10-27 13:51:27 by simonpj]
simonpj [Thu, 27 Oct 2005 13:51:27 +0000 (13:51 +0000)]
[project @ 2005-10-27 13:51:27 by simonpj]
Allow GADTs in record update, provided all the relevant datacons are
vanilla.  Turns out that ObjectIO.StdMenuElement uses this facility!

This a slight enhancement to the new stuff allowing record
fields in GADTs.

18 years ago[project @ 2005-10-27 08:00:03 by simonmar]
simonmar [Thu, 27 Oct 2005 08:00:03 +0000 (08:00 +0000)]
[project @ 2005-10-27 08:00:03 by simonmar]
Fix getThreadLocalVar() on Win32 - thanks for Krasimir for finding the bug.

18 years ago[project @ 2005-10-27 01:39:40 by sof]
sof [Thu, 27 Oct 2005 01:39:40 +0000 (01:39 +0000)]
[project @ 2005-10-27 01:39:40 by sof]
[mingw/msys only]
Undo long-standing workaround for buggy GNU ld's on mingw/msys; i.e.,
the linker wasn't correctly generating relocatable object files when
the number of relocs exceeded 2^16. Worked around the issue by
hackily splitting up the GHCi object file for the larger packages
('base', 'ObjectIO' and 'win32') into a handful of object files,
each with a manageable number of relocs. Tiresome and error-prone
(but the hack has served us well!)

This commit imposes a restriction on the 'ld' you use to compile
up GHC with; it now has to be ld-2.15.x or later (something GHC
binary dists have shipped with since 6.2.2)

18 years ago[project @ 2005-10-27 01:27:37 by sof]
sof [Thu, 27 Oct 2005 01:27:37 +0000 (01:27 +0000)]
[project @ 2005-10-27 01:27:37 by sof]
ocGetNames_PEi386(): fix bug in previous commit to this function;
the correct .bss size for object files wasn't being passed to
addProddableBlock().
Not directly harmful, but triggers ASSERT() failure w/ DEBUG.

Merge to STABLE.

18 years ago[project @ 2005-10-27 00:21:24 by sof]
sof [Thu, 27 Oct 2005 00:21:24 +0000 (00:21 +0000)]
[project @ 2005-10-27 00:21:24 by sof]
emitForeignCall: avoid CC warnings by hinting that resume/suspendThread id arg is a ptr

18 years ago[project @ 2005-10-26 22:33:20 by sof]
sof [Wed, 26 Oct 2005 22:33:20 +0000 (22:33 +0000)]
[project @ 2005-10-26 22:33:20 by sof]
ASSERT_TASK_ID(): THREADED_RTS-only assert

18 years ago[project @ 2005-10-26 15:36:06 by simonmar]
simonmar [Wed, 26 Oct 2005 15:36:06 +0000 (15:36 +0000)]
[project @ 2005-10-26 15:36:06 by simonmar]
Package up the various properties of Capabilities/Tasks that we were
asserting all over the place, and put them in a single macro
ASSERT_CAPABILITY_INVARIANTS().

18 years ago[project @ 2005-10-26 15:22:08 by simonmar]
simonmar [Wed, 26 Oct 2005 15:22:08 +0000 (15:22 +0000)]
[project @ 2005-10-26 15:22:08 by simonmar]
The prev/next link fields in struct Capability_ aren't used

18 years ago[project @ 2005-10-26 15:20:59 by simonmar]
simonmar [Wed, 26 Oct 2005 15:20:59 +0000 (15:20 +0000)]
[project @ 2005-10-26 15:20:59 by simonmar]
- forkProcess fix: add a forgotten rts_unlock()
- add a couple more ASSERTs

18 years ago[project @ 2005-10-26 14:53:30 by simonpj]
simonpj [Wed, 26 Oct 2005 14:53:30 +0000 (14:53 +0000)]
[project @ 2005-10-26 14:53:30 by simonpj]
awaitRequests: blocked_queue_tl was being set to NULL rather than
END_TSO_QUEUE if the thread being removed was at the end of the queue.

This bug has been in the code since 2003 - I have absolutely no idea
why it hasn't manifested until today.

18 years ago[project @ 2005-10-26 13:58:40 by simonmar]
simonmar [Wed, 26 Oct 2005 13:58:40 +0000 (13:58 +0000)]
[project @ 2005-10-26 13:58:40 by simonmar]
forkOS_createThreadWrapper: oops, better use the result from rts_evalStableIO()

18 years ago[project @ 2005-10-26 13:03:39 by simonpj]
simonpj [Wed, 26 Oct 2005 13:03:39 +0000 (13:03 +0000)]
[project @ 2005-10-26 13:03:39 by simonpj]
Improve documentation of typeclass extensions; merge to stable if it goes easily

18 years ago[project @ 2005-10-26 12:35:12 by simonpj]
simonpj [Wed, 26 Oct 2005 12:35:12 +0000 (12:35 +0000)]
[project @ 2005-10-26 12:35:12 by simonpj]
Simplify Provenance (the LocalDef constructor) a little

18 years ago[project @ 2005-10-26 12:05:03 by simonpj]
simonpj [Wed, 26 Oct 2005 12:05:03 +0000 (12:05 +0000)]
[project @ 2005-10-26 12:05:03 by simonpj]
MERGE TO STABLE

Fix two small Template Haskell bugs.

(1) A bug in the renaming of [d| brackets |].  The problem was
that when we renamed the bracket we messed up the name cache, because
the module was still that of the parent module.  Now we set a fake
module before renaming it.

TH_spliceDecl4 is the test.

(2) An expression splice can in principle mention *any* variable,
so the renamer really has to assume that it does when doing depdendency
analysis.  For example
f = ...
h = ...$(thing "f")...
The renamer had better not put 'h' before 'f', else the type checker
won't find a defn for 'f' in the type envt.

TH_spliceE5 is the test

18 years ago[project @ 2005-10-26 11:58:57 by simonmar]
simonmar [Wed, 26 Oct 2005 11:58:57 +0000 (11:58 +0000)]
[project @ 2005-10-26 11:58:57 by simonmar]
x86_64 fix: I was a bit sloppy before and assumed that the malloc()'d
memory would be in the low 2Gb, so I could use 32-bit offset
addressing.  It appears that this sometimes isn't the case, so do it
properly and use 64-bit absolute addressing.

18 years ago[project @ 2005-10-26 11:41:51 by simonmar]
simonmar [Wed, 26 Oct 2005 11:41:51 +0000 (11:41 +0000)]
[project @ 2005-10-26 11:41:51 by simonmar]
fix to previous change: allow workers to exit

18 years ago[project @ 2005-10-26 10:42:54 by simonmar]
simonmar [Wed, 26 Oct 2005 10:42:54 +0000 (10:42 +0000)]
[project @ 2005-10-26 10:42:54 by simonmar]
- change the type of StgRun(): now we return the Capability that the
  thread currently holds.  The return status of the thread is now
  stored in cap->r.rRet (a new slot in the reg table).

  This was necessary because on return from StgRun(), the current
  TSO may be blocked, so it no longer belongs to us.  If it is a bound
  thread, then the Task may have been already woken up on another
  Capability, so the scheduler can't use task->cap to find the
  capability it currently owns.

- when shutting down, allow a bound thread to remove its TSO from
  the run queue when exiting (eliminates an error condition in
  releaseCapability()).

18 years ago[project @ 2005-10-26 10:23:47 by simonpj]
simonpj [Wed, 26 Oct 2005 10:24:10 +0000 (10:24 +0000)]
[project @ 2005-10-26 10:23:47 by simonpj]
Cosmetics

18 years ago[project @ 2005-10-26 08:41:32 by simonpj]
simonpj [Wed, 26 Oct 2005 08:41:32 +0000 (08:41 +0000)]
[project @ 2005-10-26 08:41:32 by simonpj]
Fix PUSH_ON_RUN_QUEUE bug on Win32

18 years ago[project @ 2005-10-25 17:31:38 by sof]
sof [Tue, 25 Oct 2005 17:31:38 +0000 (17:31 +0000)]
[project @ 2005-10-25 17:31:38 by sof]
FPTOOLS_CHECK_HTYPE: correctly scope the resetting of CPPFLAGS; as was,
it got blown away if the value was cached.

Merge to STABLE.

18 years ago[project @ 2005-10-25 15:27:22 by simonmar]
simonmar [Tue, 25 Oct 2005 15:27:22 +0000 (15:27 +0000)]
[project @ 2005-10-25 15:27:22 by simonmar]
Fix bug in allocateLocal, we weren't assigning bd->step properly

18 years ago[project @ 2005-10-25 15:04:58 by simonmar]
simonmar [Tue, 25 Oct 2005 15:04:58 +0000 (15:04 +0000)]
[project @ 2005-10-25 15:04:58 by simonmar]
add missing boot files

18 years ago[project @ 2005-10-25 12:56:50 by simonmar]
simonmar [Tue, 25 Oct 2005 12:56:50 +0000 (12:56 +0000)]
[project @ 2005-10-25 12:56:50 by simonmar]
doc LANGUAGE pragma

18 years ago[project @ 2005-10-25 12:48:35 by simonmar]
simonmar [Tue, 25 Oct 2005 12:48:35 +0000 (12:48 +0000)]
[project @ 2005-10-25 12:48:35 by simonmar]
Two changes from Krasimir Angelov, which were required for Visual
Haskell:

  - messaging cleanup throughout the compiler.  DynFlags has a new
    field:

    log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO ()

    this action is invoked for every message generated by the
    compiler.  This means a client of the GHC API can direct messages to
    any destination, or collect them up in an IORef for later
    perusal.

    This replaces previous hacks to redirect messages in the GHC API
    (hence some changes to function types in GHC.hs).

  - The JustTypecheck mode of GHC now does what it says.  It doesn't
    run any of the compiler passes beyond the typechecker for each module,
    but does generate the ModIface in order that further modules can be
    typechecked.

And one change from me:

  - implement the LANGUAGE pragma, finally

18 years ago[project @ 2005-10-25 10:48:44 by simonmar]
simonmar [Tue, 25 Oct 2005 10:48:44 +0000 (10:48 +0000)]
[project @ 2005-10-25 10:48:44 by simonmar]
companion to Lexer.x rev. 1.29; columns now always count tabs as 1 in SrcLoc.

18 years ago[project @ 2005-10-25 10:28:59 by simonmar]
simonmar [Tue, 25 Oct 2005 10:28:59 +0000 (10:28 +0000)]
[project @ 2005-10-25 10:28:59 by simonmar]
- include the contents of ghc/HACKING verbatim, as a "quick start"
  guide

- change the title to "Building and devleloping GHC", and make it a
  bit more GHC-centric.

18 years ago[project @ 2005-10-25 10:22:48 by simonmar]
simonmar [Tue, 25 Oct 2005 10:22:48 +0000 (10:22 +0000)]
[project @ 2005-10-25 10:22:48 by simonmar]
add info about actually doing the build

18 years ago[project @ 2005-10-25 09:35:57 by simonmar]
simonmar [Tue, 25 Oct 2005 09:35:57 +0000 (09:35 +0000)]
[project @ 2005-10-25 09:35:57 by simonmar]
Add a "getting started" guide to hacking on GHC.

18 years ago[project @ 2005-10-25 02:57:47 by wolfgang]
wolfgang [Tue, 25 Oct 2005 02:57:47 +0000 (02:57 +0000)]
[project @ 2005-10-25 02:57:47 by wolfgang]
Mac OS X/Darwin PowerPC: Fix a problem introduced by the recent Darwin/x86
commit.

Remember how we deliberately misaligned the .o file in memory to compensate
for Mach-O's lax alignment rules.
This should have been comitted along with Linker.c 1.203 about two weeks ago.

18 years ago[project @ 2005-10-24 12:23:44 by simonmar]
simonmar [Mon, 24 Oct 2005 12:23:44 +0000 (12:23 +0000)]
[project @ 2005-10-24 12:23:44 by simonmar]
define THREADED_RTS for the SMP way too

18 years ago[project @ 2005-10-24 09:37:08 by simonmar]
simonmar [Mon, 24 Oct 2005 09:37:08 +0000 (09:37 +0000)]
[project @ 2005-10-24 09:37:08 by simonmar]
Fix the build; none of this is actually used in THREADED_RTS or SMP,
but I haven't got around to fixing things so we can omit it from the
build completely yet.

18 years ago[project @ 2005-10-24 09:33:37 by simonmar]
simonmar [Mon, 24 Oct 2005 09:33:37 +0000 (09:33 +0000)]
[project @ 2005-10-24 09:33:37 by simonmar]
Fix a warning

18 years ago[project @ 2005-10-24 09:28:38 by simonmar]
simonmar [Mon, 24 Oct 2005 09:28:38 +0000 (09:28 +0000)]
[project @ 2005-10-24 09:28:38 by simonmar]
Fix build for way "u"

18 years ago[project @ 2005-10-21 15:23:59 by simonmar]
simonmar [Fri, 21 Oct 2005 15:23:59 +0000 (15:23 +0000)]
[project @ 2005-10-21 15:23:59 by simonmar]
more Win32 fixes

18 years ago[project @ 2005-10-21 15:18:54 by simonmar]
simonmar [Fri, 21 Oct 2005 15:18:54 +0000 (15:18 +0000)]
[project @ 2005-10-21 15:18:54 by simonmar]
Fix Win32 DEBUG warnings

18 years ago[project @ 2005-10-21 15:14:06 by simonmar]
simonmar [Fri, 21 Oct 2005 15:14:06 +0000 (15:14 +0000)]
[project @ 2005-10-21 15:14:06 by simonmar]
Fix Win32 build

18 years ago[project @ 2005-10-21 14:47:36 by simonmar]
simonmar [Fri, 21 Oct 2005 14:47:36 +0000 (14:47 +0000)]
[project @ 2005-10-21 14:47:36 by simonmar]
No need to import platform-specific stuff now.

18 years ago[project @ 2005-10-21 14:45:59 by simonmar]
simonmar [Fri, 21 Oct 2005 14:45:59 +0000 (14:45 +0000)]
[project @ 2005-10-21 14:45:59 by simonmar]
Itimer.h has moved into posix/

18 years ago[project @ 2005-10-21 14:42:47 by simonmar]
simonmar [Fri, 21 Oct 2005 14:42:47 +0000 (14:42 +0000)]
[project @ 2005-10-21 14:42:47 by simonmar]
wibble

18 years ago[project @ 2005-10-21 14:41:04 by simonmar]
simonmar [Fri, 21 Oct 2005 14:41:04 +0000 (14:41 +0000)]
[project @ 2005-10-21 14:41:04 by simonmar]
oops, remove old file

18 years ago[project @ 2005-10-21 14:38:18 by simonmar]
simonmar [Fri, 21 Oct 2005 14:38:18 +0000 (14:38 +0000)]
[project @ 2005-10-21 14:38:18 by simonmar]
wibble

18 years ago[project @ 2005-10-21 14:02:17 by simonmar]
simonmar [Fri, 21 Oct 2005 14:02:18 +0000 (14:02 +0000)]
[project @ 2005-10-21 14:02:17 by simonmar]
Big re-hash of the threaded/SMP runtime

This is a significant reworking of the threaded and SMP parts of
the runtime.  There are two overall goals here:

  - To push down the scheduler lock, reducing contention and allowing
    more parts of the system to run without locks.  In particular,
    the scheduler does not require a lock any more in the common case.

  - To improve affinity, so that running Haskell threads stick to the
    same OS threads as much as possible.

At this point we have the basic structure working, but there are some
pieces missing.  I believe it's reasonably stable - the important
parts of the testsuite pass in all the (normal,threaded,SMP) ways.

In more detail:

  - Each capability now has a run queue, instead of one global run
    queue.  The Capability and Task APIs have been completely
    rewritten; see Capability.h and Task.h for the details.

  - Each capability has its own pool of worker Tasks.  Hence, Haskell
    threads on a Capability's run queue will run on the same worker
    Task(s).  As long as the OS is doing something reasonable, this
    should mean they usually stick to the same CPU.  Another way to
    look at this is that we're assuming each Capability is associated
    with a fixed CPU.

  - What used to be StgMainThread is now part of the Task structure.
    Every OS thread in the runtime has an associated Task, and it
    can ask for its current Task at any time with myTask().

  - removed RTS_SUPPORTS_THREADS symbol, use THREADED_RTS instead
    (it is now defined for SMP too).

  - The RtsAPI has had to change; we must explicitly pass a Capability
    around now.  The previous interface assumed some global state.
    SchedAPI has also changed a lot.

  - The OSThreads API now supports thread-local storage, used to
    implement myTask(), although it could be done more efficiently
    using gcc's __thread extension when available.

  - I've moved some POSIX-specific stuff into the posix subdirectory,
    moving in the direction of separating out platform-specific
    implementations.

  - lots of lock-debugging and assertions in the runtime.  In particular,
    when DEBUG is on, we catch multiple ACQUIRE_LOCK()s, and there is
    also an ASSERT_LOCK_HELD() call.

What's missing so far:

  - I have almost certainly broken the Win32 build, will fix soon.

  - any kind of thread migration or load balancing.  This is high up
    the agenda, though.

  - various performance tweaks to do

  - throwTo and forkProcess still do not work in SMP mode

18 years ago[project @ 2005-10-20 14:00:36 by simonmar]
simonmar [Thu, 20 Oct 2005 14:00:36 +0000 (14:00 +0000)]
[project @ 2005-10-20 14:00:36 by simonmar]
Column numbers in SrcLocs are now counted as the number of characters,
rather than columns.  i.e. a tab always counts as 1.  This was
necessary for communication with Visual Studio interfaces which expect
character indices, but also it seems the majority of other compilers
also do things this way.

From: Krasimir Angelov <kr.angelov@gmail.com>

18 years ago[project @ 2005-10-20 11:45:19 by simonmar]
simonmar [Thu, 20 Oct 2005 11:45:19 +0000 (11:45 +0000)]
[project @ 2005-10-20 11:45:19 by simonmar]
changes to exitScheduler(): instead of waiting for all the tasks to
stop, which is unreasonable, we just wait for the run queue to drain.
This is much quicker, but not ideal (see comments).

18 years ago[project @ 2005-10-20 00:52:38 by sof]
sof [Thu, 20 Oct 2005 00:52:38 +0000 (00:52 +0000)]
[project @ 2005-10-20 00:52:38 by sof]
[mingw]delay flushing console buffer until last possible moment. Merge to STABLE

18 years ago[project @ 2005-10-19 16:04:38 by sof]
sof [Wed, 19 Oct 2005 16:04:38 +0000 (16:04 +0000)]
[project @ 2005-10-19 16:04:38 by sof]
ocGetNames_PEi386(): correctly allocate .bss sections in relocatable
 object files. See commit for details; fixes misc GHCi crashes reported
 against 6.4.1.

Merge to STABLE.

18 years ago[project @ 2005-10-18 11:04:28 by panne]
panne [Tue, 18 Oct 2005 11:04:28 +0000 (11:04 +0000)]
[project @ 2005-10-18 11:04:28 by panne]
For the 100th time: Fixed the DocBook XML. >:-( Please, please, please:
Everybody should do a "make validate" before checking in any XML stuff!

18 years ago[project @ 2005-10-17 11:11:15 by simonpj]
simonpj [Mon, 17 Oct 2005 11:11:15 +0000 (11:11 +0000)]
[project @ 2005-10-17 11:11:15 by simonpj]
Buglets in GADT record-syntax stuff, which killed the weekend builds

18 years ago[project @ 2005-10-17 11:10:36 by simonpj]
simonpj [Mon, 17 Oct 2005 11:10:36 +0000 (11:10 +0000)]
[project @ 2005-10-17 11:10:36 by simonpj]
Small simplifier bug in case optimisation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The simplifier eliminates redundant case branches, and panics if there
are no case alternatives.  But due to a slightly delayed instantiation
of a type constructor variable 'p' by a type constructor 'P', it turned
out that an inner case had no alternatives at all, becuase an outer case
had not pruned a branch as quickly as it should have.

This commit fixes both problems:

a) SimplUtils.mkCase1 now returns a call to 'error' (instead of panicing)
   when it gets an empty list of alternatives.   Somewhat analogous to
   the inaccessible GADT case in Simplify.simplifyAlt

b) In SimplUtils.prepareDefault, use the up-to-date scrutinee, rather than
   the less up-to-date case_bndr, to get the case type constructor.  That
   leads to slightly earlier pruning of inaccessible branches.

Fixes a bug reported by Ian Lynagh.

Test is simplCore/should_compile/simpl013

18 years ago[project @ 2005-10-17 11:09:51 by simonpj]
simonpj [Mon, 17 Oct 2005 11:09:51 +0000 (11:09 +0000)]
[project @ 2005-10-17 11:09:51 by simonpj]
Comments only

18 years ago[project @ 2005-10-17 10:47:10 by simonmar]
simonmar [Mon, 17 Oct 2005 10:47:10 +0000 (10:47 +0000)]
[project @ 2005-10-17 10:47:10 by simonmar]
merge rev. 1.13.2.12 from ghc-6-4-branch

18 years ago[project @ 2005-10-17 10:01:35 by simonmar]
simonmar [Mon, 17 Oct 2005 10:01:35 +0000 (10:01 +0000)]
[project @ 2005-10-17 10:01:35 by simonmar]
Fix a comment

18 years ago[project @ 2005-10-17 09:42:56 by simonmar]
simonmar [Mon, 17 Oct 2005 09:42:56 +0000 (09:42 +0000)]
[project @ 2005-10-17 09:42:56 by simonmar]
note about watching for/preventing overwrites of critical files in the
bootstrap process.

18 years ago[project @ 2005-10-17 09:36:39 by simonmar]
simonmar [Mon, 17 Oct 2005 09:36:39 +0000 (09:36 +0000)]
[project @ 2005-10-17 09:36:39 by simonmar]
if TARGETPLATFORM differs from HOSTPLATFORM, don't attempt to build
DerivedConstants,h, ghcautoconf.h and GHCConstants.h.  If these aren't
present, emit a message to remind the user to copy them from the
target system.  Hopefully this should make bootstrapping slightly less
error prone.

18 years ago[project @ 2005-10-14 13:11:21 by simonmar]
simonmar [Fri, 14 Oct 2005 13:11:21 +0000 (13:11 +0000)]
[project @ 2005-10-14 13:11:21 by simonmar]
StrHash doesn't appear to be used; remove it.  I think it was an
earlier version of the string hashing code in Hash.c.

18 years ago[project @ 2005-10-14 12:29:53 by simonmar]
simonmar [Fri, 14 Oct 2005 12:29:53 +0000 (12:29 +0000)]
[project @ 2005-10-14 12:29:53 by simonmar]
Some more informative diagnostics for ghc -v about what the package
system is doing.  This should help when diagnosing strange-looking
errors from GHC:

Using package config file: /home/simonmar/fp/lib/i386-unknown-linux/ghc-6.4.1/package.conf
package posix-1.0 will be ignored due to missing dependencies:
  lang-1.0
package util-1.0 will be ignored due to missing dependencies:
  lang-1.0
package data-1.0 will be ignored due to missing dependencies:
  lang-1.0
package text-1.0 will be ignored due to missing dependencies:
  lang-1.0
package Cabal-1.1.4 will be ignored due to missing dependencies:
  util-1.0
*** Deleting temp files
Deleting:
ghc-6.4.1: unknown package: Cabal-1.1.4

18 years ago[project @ 2005-10-14 11:48:56 by simonmar]
simonmar [Fri, 14 Oct 2005 11:48:56 +0000 (11:48 +0000)]
[project @ 2005-10-14 11:48:56 by simonmar]
Fix a couple of problems with the "unknown package" error message

18 years ago[project @ 2005-10-14 11:22:41 by simonpj]
simonpj [Fri, 14 Oct 2005 11:22:42 +0000 (11:22 +0000)]
[project @ 2005-10-14 11:22:41 by simonpj]
Add record syntax for GADTs
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Atrijus Tang wanted to add record syntax for GADTs and existential
types, so he and I worked on it a bit at ICFP.  This commit is the
result.  Now you can say

 data T a where
  T1 { x :: a }             :: T [a]
  T2 { x :: a, y :: Int }   :: T [a]
  forall b. Show b =>
  T3 { naughty :: b, ok :: Int } :: T Int
  T4 :: Eq a => a -> b -> T (a,b)

Here the constructors are declared using record syntax.

Still to come after this commit:
  - User manual documentation
  - More regression tests
  - Some missing cases in the parser (e.g. T3 won't parse)
Autrijus is going to do these.

Here's a quick summary of the rules.  (Atrijus is going to write
proper documentation shortly.)

Defnition: a 'vanilla' constructor has a type of the form
forall a1..an. t1 -> ... -> tm -> T a1 ... an
No existentials, no context, nothing.  A constructor declared with
Haskell-98 syntax is vanilla by construction.  A constructor declared
with GADT-style syntax is vanilla iff its type looks like the above.
(In the latter case, the order of the type variables does not matter.)

* You can mix record syntax and non-record syntax in a single decl

* All constructors that share a common field 'x' must have the
  same result type (T [a] in the example).

* You can use field names without restriction in record construction
  and record pattern matching.

* Record *update* only works for data types that only have 'vanilla'
  constructors.

* Consider the field 'naughty', which uses a type variable that does
  not appear in the result type ('b' in the example).  You can use the
  field 'naughty' in pattern matching and construction, but NO
  SELECTOR function is generated for 'naughty'.  [An attempt to use
  'naughty' as a selector function will elicit a helpful error
  message.]

* Data types declared in GADT syntax cannot have a context. So this
is illegal:
data (Monad m) => T a where
  ....

* Constructors in GADT syntax can have a context (t.g. T3, T4 above)
  and that context is stored in the constructor and made available
  when the constructor is pattern-matched on.  WARNING: not competely
  implemented yet, but that's the plan.

Implementation notes
~~~~~~~~~~~~~~~~~~~~
- Data constructors (even vanilla ones) no longer share the type
  variables of their parent type constructor.

- HsDecls.ConDecl has changed quite a bit

- TyCons don't record the field labels and type any more (doesn't
  make sense for existential fields)

- GlobalIdDetails records which selectors are 'naughty', and hence
  don't have real code.

18 years ago[project @ 2005-10-13 00:11:17 by sof]
sof [Thu, 13 Oct 2005 00:11:17 +0000 (00:11 +0000)]
[project @ 2005-10-13 00:11:17 by sof]
add protos for HeapStackCheck.cmm:stg_block_blackhole_* entry points

18 years ago[project @ 2005-10-12 14:10:12 by simonmar]
simonmar [Wed, 12 Oct 2005 14:10:12 +0000 (14:10 +0000)]
[project @ 2005-10-12 14:10:12 by simonmar]
- we should be acquiring the sm_lock around allocGroup()
- sanity check threads as they are pulled off the blackhole_queue

18 years ago[project @ 2005-10-12 13:31:12 by simonpj]
simonpj [Wed, 12 Oct 2005 13:31:12 +0000 (13:31 +0000)]
[project @ 2005-10-12 13:31:12 by simonpj]
MERGE TO STABLE

Fix a bug in TcUnify.unifyTyConApp that made a GADT program fail.
The trouble happens if the type that we are expecting to be
a TyConApp is of form (m a b), where 'm' is refined to a type
constructor.  Then we want to get nice rigid results, and we weren't.

18 years ago[project @ 2005-10-12 13:29:12 by simonpj]
simonpj [Wed, 12 Oct 2005 13:29:12 +0000 (13:29 +0000)]
[project @ 2005-10-12 13:29:12 by simonpj]
Small refactoring

18 years ago[project @ 2005-10-12 12:58:38 by simonmar]
simonmar [Wed, 12 Oct 2005 12:58:38 +0000 (12:58 +0000)]
[project @ 2005-10-12 12:58:38 by simonmar]
DEBUG_FILL_SLOP: don't do anything on SMP, zeroing slop words isn't safe

18 years ago[project @ 2005-10-12 12:57:23 by simonmar]
simonmar [Wed, 12 Oct 2005 12:57:23 +0000 (12:57 +0000)]
[project @ 2005-10-12 12:57:23 by simonmar]
checkHeap: just return on SMP, we can't do heap sanity checking
because we can't zero slop words safely.

18 years ago[project @ 2005-10-12 12:56:30 by simonmar]
simonmar [Wed, 12 Oct 2005 12:56:30 +0000 (12:56 +0000)]
[project @ 2005-10-12 12:56:30 by simonmar]
Fix assertion failure in memInventory() with SMP

18 years ago[project @ 2005-10-12 12:53:15 by simonmar]
simonmar [Wed, 12 Oct 2005 12:53:15 +0000 (12:53 +0000)]
[project @ 2005-10-12 12:53:15 by simonmar]
When blocking on a BLACKHOLE, we must wait until we have finished
manipulating the current thread's stack before we release sched_mutex,
otherwise another thread can pick up the thread from the
blackhole_queue and start running it.

18 years ago[project @ 2005-10-12 02:12:34 by wolfgang]
wolfgang [Wed, 12 Oct 2005 02:12:34 +0000 (02:12 +0000)]
[project @ 2005-10-12 02:12:34 by wolfgang]
Mac OS X/Darwin PowerPC: Fix a problem introduced by the recent Darwin/x86
commit.

Make the code that allocates jump islands for PowerPC aware of how we shift
.o files in memory to compensate for Mach-O's lax alignment rules.

18 years ago[project @ 2005-10-11 13:28:49 by simonpj]
simonpj [Tue, 11 Oct 2005 13:28:49 +0000 (13:28 +0000)]
[project @ 2005-10-11 13:28:49 by simonpj]
Small fixes to the Win32 build log

18 years ago[project @ 2005-10-10 10:32:09 by simonmar]
simonmar [Mon, 10 Oct 2005 10:32:09 +0000 (10:32 +0000)]
[project @ 2005-10-10 10:32:09 by simonmar]
Fix bug in previous commit (fixes recent seg faults in nightly stage2)