1. 09 Feb, 2006 1 commit
  2. 28 Feb, 2006 2 commits
    • Simon Marlow's avatar
      pass arguments to unknown function calls in registers · 04db0e9f
      Simon Marlow authored
      We now have more stg_ap entry points: stg_ap_*_fast, which take
      arguments in registers according to the platform calling convention.
      This is faster if the function being called is evaluated and has the
      right arity, which is the common case (see the eval/apply paper for
      measurements).  
      
      We still need the stg_ap_*_info entry points for stack-based
      application, such as an overflows when a function is applied to too
      many argumnets.  The stg_ap_*_fast functions actually just check for
      an evaluated function, and if they don't find one, push the args on
      the stack and invoke stg_ap_*_info.  (this might be slightly slower in
      some cases, but not the common case).
      04db0e9f
    • simonpj@microsoft.com's avatar
      badd5d76
  3. 08 Feb, 2006 1 commit
    • Simon Marlow's avatar
      make the smp way RTS-only, normal libraries now work with -smp · beb5737b
      Simon Marlow authored
      We had to bite the bullet here and add an extra word to every thunk,
      to enable running ordinary libraries on SMP.  Otherwise, we would have
      needed to ship an extra set of libraries with GHC 6.6 in addition to
      the two sets we already ship (normal + profiled), and all Cabal
      packages would have to be compiled for SMP too.  We decided it best
      just to take the hit now, making SMP easily accessible to everyone in
      GHC 6.6.
      
      Incedentally, although this increases allocation by around 12% on
      average, the performance hit is around 5%, and much less if your inner
      loop doesn't use any laziness.
      beb5737b
  4. 23 Jan, 2006 1 commit
  5. 18 Jan, 2006 1 commit
  6. 15 Dec, 2005 1 commit
    • desrt's avatar
      [project @ 2005-12-15 23:32:29 by desrt] · 12694df2
      desrt authored
      (( PLEASE MERGE TO STABLE ))
      
      Linker.c: linux/ppc: We call mmap() to allocate additional pages to
                           create jump islands.  In the case where no
                           additional memory was needed the mmap call was
                           being made with a size of 0 which would fail.
                           The call is now conditionalised and documentation
                           has been added to the code.  Closes trac #439.
      12694df2
  7. 28 Oct, 2005 1 commit
  8. 27 Oct, 2005 2 commits
    • sof's avatar
      [project @ 2005-10-27 01:39:40 by sof] · 2909e6fb
      sof authored
      [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)
      2909e6fb
    • sof's avatar
      [project @ 2005-10-27 01:27:37 by sof] · 53068b73
      sof authored
      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.
      53068b73
  9. 21 Oct, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-10-21 14:02:17 by simonmar] · 03a9ff01
      simonmar authored
      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
      03a9ff01
  10. 19 Oct, 2005 1 commit
    • sof's avatar
      [project @ 2005-10-19 16:04:38 by sof] · 3d8a0867
      sof authored
      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.
      3d8a0867
  11. 12 Oct, 2005 1 commit
    • wolfgang's avatar
      [project @ 2005-10-12 02:12:34 by wolfgang] · 68f5bad2
      wolfgang authored
      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.
      68f5bad2
  12. 25 Jul, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-07-25 14:12:48 by simonmar] · e792bb84
      simonmar authored
      Remove the ForeignObj# type, and all its PrimOps.  The new efficient
      representation of ForeignPtr doesn't use ForeignObj# underneath, and
      there seems no need to keep it.
      e792bb84
  13. 15 Jul, 2005 1 commit
  14. 11 Jul, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-07-11 13:53:24 by simonmar] · 0af6ff59
      simonmar authored
      GHCi staggers to its feet on x86_64.
      
      The problem is that in the small code model on x86_64, all symbol
      relocations are 32-bit, because the program is assumed to fit into
      2Gb.  However, shared libraries are linked outside the 2Gb range, and
      the linker arranges that references to shared library symbols either
      go via a jump table (for code references) or are copied into the 2Gb
      area (for data references).
      
      In GHCi's linker, We can use a jump table for the function symbols,
      but we can't copy the data symbols because they've already been
      relocated to point to the shared library.  What's more, we can't tell
      whether a symbol reference is to code or data - this information is
      only available from the shared library itself.
      
      Fortunately, at least HSbase.o doesn't have any data references to
      shared libraries (at least on the Linux distro I'm using), so I can at
      least get GHCi up and limping.
      0af6ff59
  15. 09 Jul, 2005 1 commit
  16. 13 Jun, 2005 2 commits
    • wolfgang's avatar
      [project @ 2005-06-13 02:44:22 by wolfgang] · c26a153c
      wolfgang authored
      Darwin:
      Deal with the fact that the code and data in a .o file might not be
      16-byte aligned even if it contains instructions that require 16-byte
      alignment.
      This fixes floating point related crashes on Darwin/x86; there might
      also have been problems on Darwin/ppc if people load .o files with
      AltiVec code into GHCi.
      c26a153c
    • wolfgang's avatar
      [project @ 2005-06-13 00:16:44 by wolfgang] · cd22d3c7
      wolfgang authored
      Darwin/x86: support GHCi.
      cd22d3c7
  17. 07 Jun, 2005 1 commit
  18. 25 May, 2005 1 commit
  19. 18 May, 2005 1 commit
  20. 11 May, 2005 1 commit
  21. 05 May, 2005 1 commit
    • sof's avatar
      [project @ 2005-05-05 18:14:27 by sof] · e96f56a1
      sof authored
      ocResolve_PEi386():
          when fixing up REL32 relocations, _add_ displacement to value at the
          given offset. The existing value has so far been assumed to be zero
          (which we've asserted for), but curiously wxhaskell-0.9.4's wx.o
          contains lots of interesting non-zero values. Information / specifications
          are awfully thin on the ground as to how to precisely handle these
          relocations, but adding rather than overwriting seems to have a
          generally healthy effect; unable to crash wxhaskell-0.9.4 with a 6.4 build.
      
      Merge to STABLE.
      e96f56a1
  22. 29 Apr, 2005 1 commit
  23. 22 Apr, 2005 1 commit
    • sof's avatar
      [project @ 2005-04-22 17:00:48 by sof] · ecb1a539
      sof authored
      [mingw only]
      Better handling of I/O request abortions upon throwing an exception
      to a Haskell thread. As was, a thread blocked on an I/O request was
      simply unblocked, but its corresponding worker thread wasn't notified
      that the request had been abandoned.
      
      This manifested itself in GHCi upon Ctrl-C being hit at the prompt -- the
      worker thread blocked waiting for input on stdin prior to Ctrl-C would
      stick around even though its corresponding Haskell thread had been
      thrown an Interrupted exception. The upshot was that the worker would
      consume the next character typed in after Ctrl-C, but then just dropping
      it. Dealing with this turned out to be even more interesting due to
      Win32 aborting any console reads when Ctrl-C/Break events are delivered.
      
      The story could be improved upon (at the cost of portability) by making
      the Scheduler able to abort worker thread system calls; as is, requests
      are cooperatively abandoned. Maybe later.
      
      Also included are other minor tidyups to Ctrl-C handling under mingw.
      
      Merge to STABLE.
      ecb1a539
  24. 12 Apr, 2005 2 commits
  25. 07 Apr, 2005 2 commits
    • wolfgang's avatar
      [project @ 2005-04-07 06:25:54 by wolfgang] · 9761a5ec
      wolfgang authored
      Mac OS X: Work around a subtle bug/strangeness/"feature" in Apple's toolchain
      that affects machoInitSymbolsWithoutUnderscore().
      (The symbolsWithoutUnderscore symbol must be .globl, otherwise incorrect code
      will be generated to refer to it)
      
      This has already been MERGED TO STABLE as part of the previous commit.
      9761a5ec
    • wolfgang's avatar
      [project @ 2005-04-07 05:27:16 by wolfgang] · d79c1cb2
      wolfgang authored
      Set the keepCAFs flag (required for GHCi with dynamic libraries) from an
      __attribute__((constructor)) function linked to stage 2 ghc if GhcBuildDylibs
      is set in mk/build.mk.
      
      The previous hack (setting it from addDLL) didn't work, because a few CAFs
      from libHSbase_dyn were evaluated before the Linker was first invoked by
      GHCi.
      
      MERGE TO STABLE
      d79c1cb2
  26. 06 Apr, 2005 3 commits
  27. 05 Apr, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-04-05 12:19:54 by simonmar] · 16214216
      simonmar authored
      Some multi-processor hackery, including
      
        - Don't hang blocked threads off BLACKHOLEs any more, instead keep
          them all on a separate queue which is checked periodically for
          threads to wake up.
      
          This is good because (a) we don't have to worry about locking the
          closure in SMP mode when we want to block on it, and (b) it means
          the standard update code doesn't need to wake up any threads or
          check for a BLACKHOLE_BQ, simplifying the update code.
      
          The downside is that if there are lots of threads blocked on
          BLACKHOLEs, we might have to do a lot of repeated list traversal.
          We don't expect this to be common, though.  conc023 goes slower
          with this change, but we expect most programs to benefit from the
          shorter update code.
      
        - Fixing up the Capability code to handle multiple capabilities (SMP
          mode), and related changes to get the SMP mode at least building.
      16214216
  28. 27 Mar, 2005 1 commit
    • panne's avatar
      [project @ 2005-03-27 13:41:13 by panne] · 03dc2dd3
      panne authored
      * Some preprocessors don't like the C99/C++ '//' comments after a
        directive, so use '/* */' instead. For consistency, a lot of '//' in
        the include files were converted, too.
      
      * UnDOSified libraries/base/cbits/runProcess.c.
      
      * My favourite sport: Killed $Id$s.
      03dc2dd3
  29. 15 Mar, 2005 1 commit
  30. 09 Mar, 2005 1 commit
    • wolfgang's avatar
      [project @ 2005-03-09 08:51:31 by wolfgang] · abde5fdf
      wolfgang authored
      Retain all CAFs when dynamic Haskell libraries are used from GHCi.
      The Linker usually replaces references to newCAF with references to newDynCAF,
      but the system dynamic linker won't do that for us.
      
      Also, the situation is slightly different - we never want CAFs from dylibs
      to be reverted, because the dylibs might be used both by the interpreted
      program and by GHCi itself.
      
      So instead of just caf_list, there's now both caf_list and revertible_caf_list.
      newDynCAF adds a CAF to revertible_caf_list, and newCAF either adds the CAF
      to caf_list or to the mutable list, depending on whether we are in GHCi.
      
      This hack is only active when Linker.c has loaded libHSbase_dyn.[so|dylib],
      but for now, it applies to all CAFs, not just dynamically-linked ones.
      If that is worth fixing, we could do that by checking whether the the CAF
      closure or it's info pointer is in the main executable's address range.
      
      MERGE TO STABLE
      abde5fdf
  31. 08 Mar, 2005 2 commits
    • wolfgang's avatar
      [project @ 2005-03-08 04:45:29 by wolfgang] · f97dcf9f
      wolfgang authored
      Mac OS X:
      Kill HaskellSupport.framework.
      Instead, look for GMP.framework (a framework-version of libgmp), else look
      for a normal -lgmp as usual.
      The other part of HaskellSupport.framework, dlcompat, is no longer needed
      (as of Mac OS X 10.3, it's included in libSystem).
      It's enough to just use the normal configure tests for -ldl.
      
      MERGE TO STABLE
      f97dcf9f
    • wolfgang's avatar
      [project @ 2005-03-08 02:28:23 by wolfgang] · 04b5d01b
      wolfgang authored
      Mach-O Linker: eradicate some warnings
      
      MERGE TO STABLE
      04b5d01b
  32. 07 Mar, 2005 1 commit