1. 14 Aug, 2001 4 commits
    • simonpj's avatar
      [project @ 2001-08-14 15:37:55 by simonpj] · 2b09da89
      simonpj authored
      Wibbles to the checking-types commit
    • simonpj's avatar
      [project @ 2001-08-14 15:27:32 by simonpj] · 8731605f
      simonpj authored
      Yet another bug in lub
    • sewardj's avatar
      [project @ 2001-08-14 13:40:07 by sewardj] · bc5c8021
      sewardj authored
      Change the story about POSIX headers in C compilation.
      Until now, all C code in the RTS and library cbits has by default been
      compiled with settings for POSIXness enabled, that is:
         #define _POSIX_SOURCE   1
         #define _POSIX_C_SOURCE 199309L
         #define _ISOC9X_SOURCE
      If you wanted to negate this, you'd have to define NON_POSIX_SOURCE
      before including headers.
      This scheme has some bad effects:
      * It means that ccall-unfoldings exported via interfaces from a
        module compiled with -DNON_POSIX_SOURCE may not compile when
        imported into a module which does not -DNON_POSIX_SOURCE.
      * It overlaps with the feature tests we do with autoconf.
      * It seems to have caused borkage in the Solaris builds for some
        considerable period of time.
      The New Way is:
      * The default changes to not-being-in-Posix mode.
      * If you want to force a C file into Posix mode, #include as
        the **first** include the new file ghc/includes/PosixSource.h.
        Most of the RTS C sources have this include now.
      * NON_POSIX_SOURCE is almost totally expunged.  Unfortunately
        we have to retain some vestiges of it in ghc/compiler so that
        modules compiled via C on Solaris using older compilers don't
    • simonpj's avatar
      [project @ 2001-08-14 06:35:56 by simonpj] · 2767767f
      simonpj authored
      1. Arrange that w/w records unfoldings
         And that the simplifier preserves them
      2. Greatly improve structure of checking user types in the typechecker
         Main changes:
      	TcMType.checkValidType checks for a valid type
      	TcMonoType.tcHsSigType uses checkValidType
      	Type and class decls use TcMonoType.tcHsType (which does not
      		check for validity) inside the knot in TcTyClsDecls,
      		and then runs TcTyDecls.checkValidTyCon
      		or TcClassDcl.checkValidClass to check for validity
      		once the knot is tied
  2. 13 Aug, 2001 4 commits
    • simonmar's avatar
      [project @ 2001-08-13 15:49:37 by simonmar] · 9a3a6d71
      simonmar authored
      A bunch of changes (been waiting for the link to cvs.haskell.org to
      come back):
      - Two new flags -ignore-dot-ghci and -read-dot-ghci control the
        reading (or not) of ./.ghci and $HOME/.ghci.  This will be useful
        for automatic testing of GHCi.
      - A new option -package-conf <file> allows reading an additional
        package.conf file, which can be used to keep a per-user set of
      - GHCi now fails gracefully on startup if linking the libraries
        specified on the command-line fails.
    • simonmar's avatar
      [project @ 2001-08-13 15:44:38 by simonmar] · d246ceb8
      simonmar authored
      The compilation manager now continues gracefully (by unloading all the
      modules) if the link step fails.
    • simonmar's avatar
      [project @ 2001-08-13 15:43:36 by simonmar] · eb6fb4cf
      simonmar authored
      resolveObjs now returns a Bool, indicating success
    • sewardj's avatar
      [project @ 2001-08-13 11:58:04 by sewardj] · 25f9e913
      sewardj authored
      schemeR_wrk: look through tyapps when spotting top-level nullary
      constructor uses.  Fixes bug reported by Mark Tehver:
      <<loop>> in GHC 5.01 "Zarjaz"
  3. 10 Aug, 2001 2 commits
    • sof's avatar
      [project @ 2001-08-10 23:08:25 by sof] · 215dad7b
      sof authored
      Added SysTools.Option, which lets you identify what are
      file-path like options to SysTool.run<Foo>.
      Using this, we can now precisely control when to transform
      filepaths into a host-compatible format (i.e., we can DOSify
      just the right bits under Win32).
    • simonmar's avatar
      [project @ 2001-08-10 10:57:23 by simonmar] · 014805a3
      simonmar authored
      Fix another place where the maxHeapSize is set to the
      heapSizeSuggestion, now that maxHeapSize == 0 indicates "unbounded".
  4. 09 Aug, 2001 3 commits
  5. 08 Aug, 2001 9 commits
    • sewardj's avatar
      [project @ 2001-08-08 15:44:28 by sewardj] · 9ec88254
      sewardj authored
      Disable use of finalisers attached to UnlinkedBCOs, since finalisers
      attached to non-atomic objects may run too early :-(
    • sewardj's avatar
      [project @ 2001-08-08 14:40:01 by sewardj] · ad6b9745
      sewardj authored
      Attach finaliser for malloc'd blocks to the UnlinkedBCOs, not to
      linked really-really-really BCOs.  This is because an unlinked BCO
      may be copied many times to generated LinkedBCOs before it dies.
      Attaching finalisers to linked BCOs could mean multiple free()s on
      the same address.
    • sewardj's avatar
      [project @ 2001-08-08 14:11:58 by sewardj] · 5df78042
      sewardj authored
      Use the bytecode generator's monad to keep track of the malloc'd blocks
      created for each BCO.  Eventually use this info to generate a finaliser
      which is tied to the real, linked BCO
    • qrczak's avatar
      [project @ 2001-08-08 13:21:04 by qrczak] · 35900d2e
      qrczak authored
      Remove -H80M options introduced a week ago.
    • rrt's avatar
      [project @ 2001-08-08 12:27:37 by rrt] · da582343
      rrt authored
      Instead of copying the assemblies we need to this directory, write an
      app.exe.config file for each program we run.
    • sewardj's avatar
      [project @ 2001-08-08 12:06:28 by sewardj] · 4bb1b965
      sewardj authored
      Remove the last use of unsavouryPerformIO in this module.  What a lot
      of hassle.  Gimme a Von Neumann machine any day.
    • sewardj's avatar
      [project @ 2001-08-08 11:11:06 by sewardj] · 6d7e8b17
      sewardj authored
      "Greetings, earthlings.  Take us to your mutable variables."
      Build the bytecode generator's monad on top of IO, and as a result get
      rid of various unsafePerformIOs.
    • simonmar's avatar
      [project @ 2001-08-08 10:50:36 by simonmar] · 52c07834
      simonmar authored
      Had a brainwave on the way to work this morning, and realised that the
      garbage collector can handle "pinned objects" as long as they don't
      contain any pointers.
      This is absolutely ideal for doing temporary allocation in the FFI,
      because what we really want to do is allocate a pinned ByteArray and
      let the GC clean it up later.  So this set of changes adds the
      required framework.
      There are two new primops:
       newPinnedByteArray# :: Int# -> State# s -> (# State# s, MutByteArr# s #)
       byteArrayContents#  :: ByteArr# -> Addr#
      obviously byteArrayContents# is highly unsafe.
      Allocating a pinned ByteArr# isn't the default, because a pinned
      ByteArr# will hold an entire block (currently 4k) live until it is
      garbage collected (that doesn't mean each pinned ByteArr# requires
      4k of storage, just that if a block contains a single live pinned
      ByteArray, the whole block must be retained).
    • simonmar's avatar
      [project @ 2001-08-08 08:44:47 by simonmar] · 110a35dc
      simonmar authored
      Nuke the "Compilation had errors" message again.
  6. 07 Aug, 2001 7 commits
    • ken's avatar
      [project @ 2001-08-07 19:33:33 by ken] · 565a4494
      ken authored
      For now, let mkMarshalCode_wrk = undefined for non-i386 architectures.
    • sewardj's avatar
      [project @ 2001-08-07 17:07:11 by sewardj] · 59f79a33
      sewardj authored
      Rewrite the machinery for pushing args to CCalls so that it can
      suitably mangle those :: ForeignObj# and ByteArray# and PtrArray#.
    • simonmar's avatar
      [project @ 2001-08-07 10:54:01 by simonmar] · 4a950d42
      simonmar authored
      Back out the ExitException change; it's already taken into account by
      Sigbjorn: I'm not sure what was going on with your Win32 build, but it
      looks like it was a bug somewhere else.
    • simonmar's avatar
      [project @ 2001-08-07 10:11:05 by simonmar] · b36887cd
      simonmar authored
      Move RtsFlags.h into ghc/includes, so it's available in a binary
      installation.  RtsFlags.h was repository-copied behind the scenes to
      keep the revision history.
    • sewardj's avatar
      [project @ 2001-08-07 09:30:00 by sewardj] · 2c4f7329
      sewardj authored
      x86: remember to pop the floating-point stack when moving float/double
      results back to the Haskell stack.  Viz, use fstps/fstpl, not fsts/fstl.
    • sewardj's avatar
      [project @ 2001-08-07 09:16:15 by sewardj] · 0632467a
      sewardj authored
      This buffer is for notes you don't want to save, and for Lisp evaluation.
      If you want to create a file, visit that file with C-x C-f,
      then enter the text in that file's own buffer.
      Interpreter FFI improvements:
      * Support f-i dynamic.
      * Correctly handle fns which don't return anything.
      * Support x86 stdcall call-conv.
      Clean-up of FFI-related code in ByteCodeGen.lhs.
    • rrt's avatar
      [project @ 2001-08-07 08:16:48 by rrt] · 722e4595
      rrt authored
      Revert to System.system using the shell, hence need to use new rawSystem on
      Windows to launch GHC's sub-processes.
  7. 05 Aug, 2001 1 commit
    • ken's avatar
      [project @ 2001-08-05 00:25:41 by ken] · a6e4c7f7
      ken authored
      Steps towards getting GHCi working on alpha-dec-osf3 --
      Clean up ghci/ByteCodeItbls.lhs, and add code for generating
      a jump instruction on alpha.
  8. 04 Aug, 2001 1 commit
    • ken's avatar
      [project @ 2001-08-04 06:19:54 by ken] · ea138284
      ken authored
      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.
  9. 03 Aug, 2001 5 commits
    • ken's avatar
      [project @ 2001-08-03 23:38:50 by ken] · b17957ce
      ken authored
      Fixed: ExitException doesn't exist in __GLASGOW_HASKELL__ < 501,
      so references to ExitException should be preprocessed out.
    • sof's avatar
      [project @ 2001-08-03 20:40:43 by sof] · e8964a48
      sof authored
      - have the toplevel exception handler propagate ExitExceptions, don't flag
        them as panics. i.e., when the dynamic exception handler catches a
        PhaseFailed{}, it throws an ExitException. The outer/topmost handler
        catches this (on a Win32 box, but not my other (Linux) box for some
        reason...), and maps it to a panic, which is not what you want.
      - introduced the old 'Compilation had errors' message in case of a
        PhaseFailed{}; feel free to nuke that one (again).
    • sewardj's avatar
      [project @ 2001-08-03 15:11:10 by sewardj] · daf8e15b
      sewardj authored
      Fix enough bugs/incompletenesses so that foreign import (static) works
      fairly well on x86.
      Still ToDo:
      * f-i dynamic
      * save/restore GC/thread context around calls
      * stdcall support
      * pass/return of 64-bit integral quantities on x86
      * sparc implementation
    • sof's avatar
      [project @ 2001-08-03 07:44:47 by sof] · 65142ed3
      sof authored
      Make dependency generation work a little bit better
      (stage1 goes through OK; yet to do a stage2, but
      thought I'd commit before I hit the sack).
    • sof's avatar
      [project @ 2001-08-03 00:08:07 by sof] · a1d0f6b6
      sof authored
      Only define i_CCALL iff bci_CCALL is defined in WithHc's ByteCodes.h
  10. 02 Aug, 2001 4 commits
    • sewardj's avatar
      [project @ 2001-08-02 17:15:16 by sewardj] · 54afa8cb
      sewardj authored
      Haskell-side support for FFI (foreign import only).
      Since doing the FFI necessarily involves gruesome
      architecture-specific knowledge about calling conventions, I have
      chosen to put this knowledge in Haskell-land, in ByteCodeFFI.
      The general idea is: to do a ccall, the interpreter accumulates the
      args R to L on the stack, as is the normal case for tail-calls.
      However, it then calls a piece of machine code created by ByteCodeFFI
      and which is specific to this call site.  This glue code copies args
      off the Haskell stack, calls the target function, and places the
      result back into a dummy placeholder created on the Haskell stack
      prior to the call.  The interpreter then SLIDEs and RETURNs in the
      normal way.
      The magic glue code copies args off the Haskell stack and pushes them
      directly on the C stack (x86) and/or into regs (sparc et al).  Because
      the code is made up specifically for this call site, it can do all
      that non-interpretively.  The address (of the C fn to call) is
      presented as just another tagged Addr# on the Haskell stack.  This
      makes f-i-dynamic trivial since the first arg is the said Addr#.
      Presently ByteCodeFFI only knows how to generate x86 code sequences.
    • simonmar's avatar
      [project @ 2001-08-02 16:35:10 by simonmar] · e0521ba8
      simonmar authored
      Simplify the dependency analyser to use the Finder instead of doing
      its own directory searching.
    • simonmar's avatar
      [project @ 2001-08-02 16:30:41 by simonmar] · 6487214f
      simonmar authored
      Turn the strictness analyser back on again.
    • simonmar's avatar
      [project @ 2001-08-02 16:05:06 by simonmar] · 89cb459a
      simonmar authored
      Fix something that looks wrong in an attempt to get HEAD back on the
      rails again, whilst trying to get the award for the highest
      size-of-commit-message-to-number-of-lines-actually-changed ratio.
      The problem is this: a constructor defined as
      	data T = A !Int
      will cause a DataCon wrapper to be generated like this:
      	A = \x -> case x of x' { DEFAULT -> $wA x' }
      but the strictness on $wA says that it is strict in its first field.
      This is where the story gets a little hazy, but it seems that the
      compiler (5.00.2) happily removes the extra case thinking that x is
      going to get evaluated anyway, leaving us with
      	A = \x -> $wA x
      and the argument to A ends up not being evaluated at all.  Certain
      other parts of the compiler make use of the evaluatedness of fields in
      order to remove unnecessary cases, with the end result that we end up
      trying to dataToTag# an unevaluated thing, and certain derived Eq
      instances can give wrong results.  Phew.
      Now, here's the bit I *don't* understand: I can only see the bug with
      5.00.2, and only when the data type has more than one constructor:
      	data T = A !Int  |  B
      nevertheless, the HEAD compiler when bootstrapped displays symptoms of
      a broken Eq instance, so I'm trying this fix to see if it helps.
      The Attempted Fix: give the DataConId a fully-lazy strictness