1. 12 Apr, 2005 1 commit
  2. 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
  3. 06 Apr, 2005 3 commits
  4. 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
  5. 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
  6. 15 Mar, 2005 1 commit
  7. 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
  8. 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
  9. 07 Mar, 2005 1 commit
  10. 05 Mar, 2005 1 commit
    • panne's avatar
      [project @ 2005-03-05 16:19:14 by panne] · 9c5d640b
      panne authored
      Nuked dead code. Now the RTS is free of warnings, except for failed
      inlinings of thread_obj, processHeapClosureForDead, pop, and
      push. Should we remove their "inline" modifier?
      9c5d640b
  11. 19 Feb, 2005 1 commit
    • desrt's avatar
      [project @ 2005-02-19 18:51:19 by desrt] · 2384531d
      desrt authored
      Linker.c: ELF: Added two utility functions findElfSectionIndexByName
                     and findElfSectionByName that are used by the PPC64 linker
                     currently being worked on.  These functions should be used
                     in other (generic) ELF code too.
      2384531d
  12. 17 Feb, 2005 1 commit
    • desrt's avatar
      [project @ 2005-02-17 16:58:18 by desrt] · cfc30307
      desrt authored
      LinkerInternals.h: all platforms: changed 'image' pointer in ObjectCode
                                        from (void *) to (char *).
      
      Linker.c: linux/ppc: added mremap() support to unbreak the build when
                           USE_MMAP is defined on linux/ppc (as it now is.)
      cfc30307
  13. 10 Feb, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-02-10 13:01:52 by simonmar] · e7c3f957
      simonmar authored
      GC changes: instead of threading old-generation mutable lists
      through objects in the heap, keep it in a separate flat array.
      
      This has some advantages:
      
        - the IND_OLDGEN object is now only 2 words, so the minimum
          size of a THUNK is now 2 words instead of 3.  This saves
          some amount of allocation (about 2% on average according to
          my measurements), and is more friendly to the cache by
          squashing objects together more.
      
        - keeping the mutable list separate from the IND object
          will be necessary for our multiprocessor implementation.
      
        - removing the mut_link field makes the layout of some objects
          more uniform, leading to less complexity and special cases.
      
        - I also unified the two mutable lists (mut_once_list and mut_list)
          into a single mutable list, which lead to more simplifications
          in the GC.
      e7c3f957
  14. 29 Jan, 2005 1 commit
  15. 28 Jan, 2005 2 commits
    • krasimir's avatar
      [project @ 2005-01-28 23:33:51 by krasimir] · 6317d554
      krasimir authored
      - The output from uncaught exceptions handler is redirected to RTS's errorBelch.
      - The output from Debug.Trace is redirected to RTS's debugBelch
      - Usually errorBelch and debugBelch messages go to stderr except for
      Windows GUI applications. For GUI applications the Debug.Trace output is
      redirected to debug console and the exceptions message is displayed in message box.
      6317d554
    • simonmar's avatar
      [project @ 2005-01-28 12:55:17 by simonmar] · 153b9cb9
      simonmar authored
      Rationalise the BUILD,HOST,TARGET defines.
      
      Recall that:
      
        - build is the platform we're building on
        - host is the platform we're running on
        - target is the platform we're generating code for
      
      The change is that now we take these definitions as applying from the
      point of view of the particular source code being built, rather than
      the point of view of the whole build tree.
      
      For example, in RTS and library code, we were previously testing the
      TARGET platform.  But under the new rule, the platform on which this
      code is going to run is the HOST platform.  TARGET only makes sense in
      the compiler sources.
      
      In practical terms, this means that the values of BUILD, HOST & TARGET
      may vary depending on which part of the build tree we are in.
      
      Actual changes:
      
       - new file: includes/ghcplatform.h contains platform defines for
         the RTS and library code.
      
       - new file: includes/ghcautoconf.h contains the autoconf settings
         only (HAVE_BLAH).  This is so that we can get hold of these
         settings independently of the platform defines when necessary
         (eg. in GHC).
      
       - ghcconfig.h now #includes both ghcplatform.h and ghcautoconf.h.
      
       - MachRegs.h, which is included into both the compiler and the RTS,
         now has to cope with the fact that it might need to test either
         _TARGET_ or _HOST_ depending on the context.
      
       - the compiler's Makefile now generates
           stage{1,2,3}/ghc_boot_platform.h
         which contains platform defines for the compiler.  These differ
         depending on the stage, of course: in stage2, the HOST is the
         TARGET of stage1.  This was wrong before.
      
       - The compiler doesn't get platform info from Config.hs any more.
         Previously it did (sometimes), but unless we want to generate
         a new Config.hs for each stage we can't do this.
      
       - GHC now helpfully defines *_{BUILD,HOST}_{OS,ARCH} automatically
         in CPP'd Haskell source.
      
       - ghcplatform.h defines *_TARGET_* for backwards compatibility
         (ghcplatform.h is included by ghcconfig.h, which is included by
         config.h, so code which still #includes config.h will get the TARGET
         settings as before).
      
       - The Users's Guide is updated to mention *_HOST_* rather than
         *_TARGET_*.
      
       - coding-style.html in the commentary now contains a section on
         platform defines.  There are further doc updates to come.
      
      Thanks to Wolfgang Thaller for pointing me in the right direction.
      153b9cb9
  16. 18 Jan, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-01-18 16:28:43 by simonmar] · 9cb75205
      simonmar authored
      USE_MMAP on Linux too: this is needed for sparc64-unknown-linux at
      least, and since it seems to work on i386-unknown-linux too we might
      as well enable it.  We should probably use it on more arches/OSs too.
      9cb75205
  17. 06 Jan, 2005 1 commit
  18. 08 Dec, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-12-08 12:05:51 by simonmar] · c418e72f
      simonmar authored
      Fix bug #1073501: checkProddableBlock: invalid fixup in runtime linker
      
      The bug manifested when trying to load an object with debugging info
      (compiled with gcc -g) into GHCi.
      
      The problem was that the object loader was ignoring the sections
      containing debugging info, but then it was later trying to do
      relocations for those sections, and its own sanity checking code
      correctly detected that the relocations were in unknown parts of the
      object file.
      
      The fix is to ignore relocations whose target section isn't one of the
      sections that we're interested in, using the same test in both cases
      (the code to test section kind has been extracted).  The code could
      probably benefit from more refactoring: it looks like the list of
      sections we build up in the first phase isn't even used in the second
      phase, instead we traverse the section table in the image again.  This
      looks like cruft leftover from when the GC used to check whether an
      address was in text or data space.
      c418e72f
  19. 02 Dec, 2004 1 commit
  20. 19 Nov, 2004 1 commit
  21. 18 Nov, 2004 1 commit
  22. 07 Oct, 2004 1 commit
    • wolfgang's avatar
      [project @ 2004-10-07 15:54:03 by wolfgang] · b4d045ae
      wolfgang authored
      Position Independent Code and Dynamic Linking Support, Part 1
      
      This commit allows generation of position independent code (PIC) that fully supports dynamic linking on Mac OS X and PowerPC Linux.
      Other platforms are not yet supported, and there is no support for actually linking or using dynamic libraries - so if you use the -fPIC or -dynamic code generation flags, you have to type your (platform-specific) linker command lines yourself.
      
      
      nativeGen/PositionIndependentCode.hs:
      New file. Look here for some more comments on how this works.
      
      cmm/CLabel.hs:
      Add support for DynamicLinkerLabels and PIC base labels - for use inside the NCG.
      needsCDecl: Case alternative labels now need C decls, see the codeGen/CgInfoTbls.hs below for details
      
      cmm/Cmm.hs:
      Add CmmPicBaseReg (used in NCG),
      and CmmLabelDiffOff (used in NCG and for offsets in info tables)
      
      cmm/CmmParse.y:
      support offsets in info tables
      
      cmm/PprC.hs:
      support CmmLabelDiffOff
      Case alternative labels now need C decls (see the codeGen/CgInfoTbls.hs for details), so we need to pprDataExterns for info tables.
      
      cmm/PprCmm.hs:
      support CmmLabelDiffOff
      
      codeGen/CgInfoTbls.hs:
      no longer store absolute addresses in info tables, instead, we store offsets.
      Also, for vectored return points, emit the alternatives _after_ the vector table. This is to work around a limitation in Apple's as, which refuses to handle label differences where one label is at the end of a section. Emitting alternatives after vector info tables makes sure this never happens in GHC generated code. Case alternatives now require prototypes in hc code, though (see changes in PprC.hs, CLabel.hs).
      
      main/CmdLineOpts.lhs:
      Add a new option, -fPIC.
      
      main/DriverFlags.hs:
      Pass the correct options for PIC to gcc, depending on the platform. Only for powerpc for now.
      
      nativeGen/AsmCodeGen.hs:
      Many changes...
      Mac OS X-specific management of import stubs is no longer, it's now part of a general mechanism to handle such things for all platforms that need it (Darwin [both ppc and x86], Linux on ppc, and some platforms we don't support).
      Move cmmToCmm into its own monad which can accumulate a list of imported symbols. Make it call cmmMakeDynamicReference at the right places.
      
      nativeGen/MachCodeGen.hs:
      nativeGen/MachInstrs.hs:
      nativeGen/MachRegs.lhs:
      nativeGen/PprMach.hs:
      nativeGen/RegAllocInfo.hs:
      Too many changes to enumerate here, PowerPC specific.
      
      nativeGen/NCGMonad.hs:
      NatM still tracks imported symbols, as more labels can be created during code generation (float literals, jump tables; on some platforms all data access has to go through the dynamic linking mechanism).
      
      driver/mangler/ghc-asm.lprl:
      Mangle absolute addresses in info tables to offsets.
      Correctly pass through GCC-generated PIC for Mac OS X and powerpc linux.
      
      includes/Cmm.h:
      includes/InfoTables.h:
      includes/Storage.h:
      includes/mkDerivedConstants.c:
      rts/GC.c:
      rts/GCCompact.c:
      rts/HeapStackCheck.cmm:
      rts/Printer.c:
      rts/RetainerProfile.c:
      rts/Sanity.c:
      Adapt to the fact that info tables now contain offsets.
      
      rts/Linker.c:
      Mac-specific: change machoInitSymbolsWithoutUnderscore to support PIC.
      b4d045ae
  23. 04 Oct, 2004 1 commit
    • wolfgang's avatar
      [project @ 2004-10-04 03:37:22 by wolfgang] · 004ecb39
      wolfgang authored
      Mac OS X:
      Make the Linker deal properly with object files that lack a symbol table or
      a dynamic symbol table.
      Objects that don't import any symbols don't get a dynamic symbol table,
      which caused GHCi to crash.
      
      MERGE TO STABLE
      004ecb39
  24. 02 Oct, 2004 1 commit
    • dons's avatar
      [project @ 2004-10-02 07:32:25 by dons] · 20d697a1
      dons authored
      When linking against libpthreads, raise(3) can behave strangely on
      some platforms (OpenBSD at least, maybe other BSDs, not Linux). So use
      pthread_kill() to generate signals when running the threaded rts,
      instead of raise(), when System.Posix.Signals.raiseSignal is called.
      
      raiseSignal will call genericRaise, in the rts, which knows which
      function to use.
      20d697a1
  25. 29 Sep, 2004 1 commit
  26. 27 Sep, 2004 2 commits
  27. 09 Sep, 2004 1 commit
  28. 03 Sep, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-09-03 15:28:18 by simonmar] · 95ca6bff
      simonmar authored
      Cleanup: all (well, most) messages from the RTS now go through the
      functions in RtsUtils: barf(), debugBelch() and errorBelch().  The
      latter two were previously called belch() and prog_belch()
      respectively.  See the comments for the right usage of these message
      functions.
      
      One reason for doing this is so that we can avoid spurious uses of
      stdout/stderr by Haskell apps on platforms where we shouldn't be using
      them (eg. non-console apps on Windows).
      95ca6bff
  29. 31 Aug, 2004 1 commit
  30. 22 Aug, 2004 1 commit
    • panne's avatar
      [project @ 2004-08-22 15:50:39 by panne] · 47ff0630
      panne authored
      Removed a few "use of cast expressions as lvalues is deprecated"
      warnings. Note that gcc is really pedantic nowadays, so we have to go
      via a temporary to avoid "cast does not match function type" warnings.
      47ff0630
  31. 20 Aug, 2004 1 commit
  32. 13 Aug, 2004 1 commit
  33. 18 Jun, 2004 1 commit
    • dons's avatar
      [project @ 2004-06-18 09:02:40 by dons] · 5218cb82
      dons authored
      Have loadObj ignore requests to load an object more than once, instead
      of actually loading the object, then dying.
      
      This change lets user-land loaders safely work inside GHCi, when they
      would have no way to know what packages had already been loaded.
      
      Help from SimonM and Andre Pang.
      5218cb82
  34. 16 Jun, 2004 1 commit
    • dons's avatar
      [project @ 2004-06-16 10:47:48 by dons] · abad5596
      dons authored
      Add linker symbols into linker symbol table.
      This lets things that bind to the linker run in GHCi.
      Tested on OSX and OpenBSD.
      
      Thanks to Andre Pang.
      abad5596