ghc-hetmet.git
22 years ago[project @ 2002-02-04 09:05:45 by chak]
chak [Mon, 4 Feb 2002 09:05:46 +0000 (09:05 +0000)]
[project @ 2002-02-04 09:05:45 by chak]
Conformed the FFI libraries to meet the FFI Addendum 1.0 specification (except
hs_init() and friends).

22 years ago[project @ 2002-02-04 03:40:31 by chak]
chak [Mon, 4 Feb 2002 03:40:33 +0000 (03:40 +0000)]
[project @ 2002-02-04 03:40:31 by chak]
Foreign import/export declarations now conform to FFI Addendum Version 1.0

* The old form of foreign declarations is still supported, but generates
  deprecation warnings.

* There are some rather exotic old-style declarations which have become
  invalid as they are interpreted differently under the new scheme and there
  is no (easy) way to determine which style the programmer had in mind (eg,
  importing a C function with the name `wrapper' where the external name is
  explicitly given will not work in some situations - depends on whether an
  `unsafe' was specified and similar things).

* Some "new" old-style forms have been introduced to make parsing a little bit
  easier (ie, avoid shift/reduce conflicts between new-style and old-style
  grammar rules), but they are few, arcane, and don't really hurt (and I won't
  tell what they are, you need to find that out by yourself ;-)

* The FFI Addendum doesn't specify whether a header file that is requested for
  inclusion by multiple foreign declarations should be included only once or
  multiple times.  GHC at the moment includes an header as often as it appears
  in a foreign declaration.  For properly written headers, it doesn't make a
  difference anyway...

* Library object specifications are currently silently ignored.  The feature
  was mainly requested for external calls in .NET (ie, calls which invoke C
  routines when Haskell is compiled to ILX), but those don't seem to be
  supported yet.

* Foreign label declarations are currently broken, but they were already
  broken before I started messing with the stuff.

The code is moderately tested.  All modules in lib/std/ and hslibs/lang/
(using old-style declarations) still compile fine and I have run a couple of
tests on the different forms of new-style declarations.

22 years ago[project @ 2002-02-03 17:08:55 by sof]
sof [Sun, 3 Feb 2002 17:08:55 +0000 (17:08 +0000)]
[project @ 2002-02-03 17:08:55 by sof]
document the environment variable expansion done in input package specifications

22 years ago[project @ 2002-02-03 17:06:12 by sof]
sof [Sun, 3 Feb 2002 17:06:12 +0000 (17:06 +0000)]
[project @ 2002-02-03 17:06:12 by sof]
Provide support for authors that want to distribute packages, by
expanding occurrences of "${foo}" in an input package spec with
the value of the 'foo' environment variable. This permits easy
configuration at install-time, e.g.,

  $ libdir=/opt/haskell/packages/lib ghc-pkg -a < NewPackage.pkg

[Clearly, a separate preprocessing pass using some other tool could
 provide identical functionality. However, the benefits to the
 package author of not having to depend on such a tool being present
 on a user's box was considered more important.
]

22 years ago[project @ 2002-02-03 04:44:07 by sof]
sof [Sun, 3 Feb 2002 04:44:07 +0000 (04:44 +0000)]
[project @ 2002-02-03 04:44:07 by sof]
recognize .ly as a happy extension

22 years ago[project @ 2002-02-02 06:47:38 by sof]
sof [Sat, 2 Feb 2002 06:47:38 +0000 (06:47 +0000)]
[project @ 2002-02-02 06:47:38 by sof]
pprFCall: avoid/reduce name-capture problem (as was, safe calling
the C function id() would break.)

22 years ago[project @ 2002-02-01 17:40:11 by sewardj]
sewardj [Fri, 1 Feb 2002 17:40:11 +0000 (17:40 +0000)]
[project @ 2002-02-01 17:40:11 by sewardj]
Add details clarifying the precise treatment of MagicIds in Stix.

22 years ago[project @ 2002-02-01 16:32:33 by sewardj]
sewardj [Fri, 1 Feb 2002 16:32:33 +0000 (16:32 +0000)]
[project @ 2002-02-01 16:32:33 by sewardj]
Some stuff I forgot.

22 years ago[project @ 2002-02-01 16:18:33 by sewardj]
sewardj [Fri, 1 Feb 2002 16:18:33 +0000 (16:18 +0000)]
[project @ 2002-02-01 16:18:33 by sewardj]
Finish off the NCG documentation.

22 years ago[project @ 2002-02-01 15:18:18 by simonmar]
simonmar [Fri, 1 Feb 2002 15:18:19 +0000 (15:18 +0000)]
[project @ 2002-02-01 15:18:18 by simonmar]
Include the patchlevel in the hi version number.

22 years ago[project @ 2002-02-01 11:38:32 by simonpj]
simonpj [Fri, 1 Feb 2002 11:38:33 +0000 (11:38 +0000)]
[project @ 2002-02-01 11:38:32 by simonpj]
More wibbles on deriving with -fallow-undecidable-instances

22 years ago[project @ 2002-02-01 11:31:27 by simonmar]
simonmar [Fri, 1 Feb 2002 11:31:27 +0000 (11:31 +0000)]
[project @ 2002-02-01 11:31:27 by simonmar]
Move showHex, showOct, showBin and showIntAtBase from NumExts to
Numeric as per recent changes to Haskell 98.

22 years ago[project @ 2002-02-01 10:50:35 by simonmar]
simonmar [Fri, 1 Feb 2002 10:50:35 +0000 (10:50 +0000)]
[project @ 2002-02-01 10:50:35 by simonmar]
When distinguishing between code & data pointers, rather than testing
for membership of the text section, test for not membership of one of
the data sections.

The reason for this change is that testing for membership of the text
section was fragile:  we could only test whether a value was smaller
than the end address, because there doesn't appear to be a portable
way to find the beginning of the text section.  Indeed, the test
breaks on very recent Linux kernels which mmap() memory below the
program text.

In fact, the reversed test may be faster because the expected common
case is when the pointer is into the dynamic heap, and we eliminate
these case immediately in the new test.  A quick test shows no
measurable performance difference with the change.

MERGE TO STABLE

22 years ago[project @ 2002-02-01 02:05:52 by sof]
sof [Fri, 1 Feb 2002 02:05:52 +0000 (02:05 +0000)]
[project @ 2002-02-01 02:05:52 by sof]
Add URLs and other pointers to resources on the PE COFF format.

22 years ago[project @ 2002-01-31 23:04:15 by sof]
sof [Thu, 31 Jan 2002 23:04:30 +0000 (23:04 +0000)]
[project @ 2002-01-31 23:04:15 by sof]
Win32 implementation, first pass.

22 years ago[project @ 2002-01-31 18:01:34 by sewardj]
sewardj [Thu, 31 Jan 2002 18:01:34 +0000 (18:01 +0000)]
[project @ 2002-01-31 18:01:34 by sewardj]
Make a quite-large start on native code generator documentation.

22 years ago[project @ 2002-01-31 17:48:26 by simonpj]
simonpj [Thu, 31 Jan 2002 17:48:27 +0000 (17:48 +0000)]
[project @ 2002-01-31 17:48:26 by simonpj]
Wibbles to yesterdays changes

22 years ago[project @ 2002-01-31 14:32:04 by simonmar]
simonmar [Thu, 31 Jan 2002 14:32:04 +0000 (14:32 +0000)]
[project @ 2002-01-31 14:32:04 by simonmar]
Update the building guide w.r.t. the enhanced source-file-searching
mechanisms now in fptools/mk/paths.mk.

Also, add a small section on Makefile debugging while I'm here,
mentioning in particular 'make show'.

22 years ago[project @ 2002-01-31 13:46:38 by simonmar]
simonmar [Thu, 31 Jan 2002 13:46:38 +0000 (13:46 +0000)]
[project @ 2002-01-31 13:46:38 by simonmar]
Add test for GHCi w/ Happy-generated parsers.

22 years ago[project @ 2002-01-31 13:42:20 by simonmar]
simonmar [Thu, 31 Jan 2002 13:42:20 +0000 (13:42 +0000)]
[project @ 2002-01-31 13:42:20 by simonmar]
Fix a classic bug: copying a Haskell string with one of the C string
functions (in this case strncpy()) is wrong when the string contains
'\0' characters.

The symptom in this case is that Happy parsers created with -ag don't
work in GHCi, because the state tables are encoded as strings
containing lots of '\0' elements.

22 years ago[project @ 2002-01-31 12:20:13 by sewardj]
sewardj [Thu, 31 Jan 2002 12:20:13 +0000 (12:20 +0000)]
[project @ 2002-01-31 12:20:13 by sewardj]
fix markup bug

22 years ago[project @ 2002-01-31 11:18:06 by sof]
sof [Thu, 31 Jan 2002 11:18:07 +0000 (11:18 +0000)]
[project @ 2002-01-31 11:18:06 by sof]
First steps towards implementing better interop between
Concurrent Haskell and native threads.

- factored out Capability handling into a separate source file
  (only the SMP build uses multiple capabilities tho).
- factored out OS/native threads handling into a separate
  source file, OSThreads.{c,h}. Currently, just a pthreads-based
  implementation; Win32 version to follow.
- scheduler code now distinguishes between multi-task threaded
  code (SMP) and single-task threaded code ('threaded RTS'),
  but sharing code between these two modes whenever poss.

i.e., just a first snapshot; the bulk of the transitioning code
remains to be implemented.

22 years ago[project @ 2002-01-31 10:48:55 by sof]
sof [Thu, 31 Jan 2002 10:48:55 +0000 (10:48 +0000)]
[project @ 2002-01-31 10:48:55 by sof]
new define, RTS_SUPPORTS_THREADS - defined in SMP and 'threaded' modes of operation

22 years ago[project @ 2002-01-31 10:47:47 by sof]
sof [Thu, 31 Jan 2002 10:47:47 +0000 (10:47 +0000)]
[project @ 2002-01-31 10:47:47 by sof]
Pass -lpthread to linker when using a 'threaded' RTS

22 years ago[project @ 2002-01-31 10:42:27 by sof]
sof [Thu, 31 Jan 2002 10:42:28 +0000 (10:42 +0000)]
[project @ 2002-01-31 10:42:27 by sof]
- new option --enable-threaded-rts, which turns on
  RTS support for better interop with native threads.
- check for pthread.h
- new config.mk variable, GhcRtsThreaded (={YES,NO})

22 years ago[project @ 2002-01-31 07:04:27 by sof]
sof [Thu, 31 Jan 2002 07:04:27 +0000 (07:04 +0000)]
[project @ 2002-01-31 07:04:27 by sof]
got tired of seeing gcc trigraph warning

22 years ago[project @ 2002-01-30 17:19:15 by simonmar]
simonmar [Wed, 30 Jan 2002 17:19:15 +0000 (17:19 +0000)]
[project @ 2002-01-30 17:19:15 by simonmar]
Add a short section on modules & packages.

22 years ago[project @ 2002-01-30 17:16:36 by simonpj]
simonpj [Wed, 30 Jan 2002 17:16:37 +0000 (17:16 +0000)]
[project @ 2002-01-30 17:16:36 by simonpj]
-----------------------------
Tidy up the top level of TcModule
-----------------------------

This commit started life as sorting out the TcInstDcls thing that
we got wrong a few weeks back, but it spiraled out of control.

However, the result is a nice tidy up of TcModule.

typecheckModule/tcModule compiles a module from source code
typecheckIface/tcIface   compiles a module from its interface file
typecheckStmt  compiles a Stmt
typecheckExpr  compiles a Expr

tcExtraDecls is used by typecheckStmt/typecheckExpr
to compile interface-file decls.
It is just a wrapper for:

tcIfaceImports, which is used by tcExtraDecls and tcIface
to compile interface file-file decls.

tcImports, is similar to tcIfaceImports, but is used only by tcModule

tcIfaceImports is used when compiling an interface, and can
therefore be quite a bit simpler

22 years ago[project @ 2002-01-30 17:16:04 by simonpj]
simonpj [Wed, 30 Jan 2002 17:16:04 +0000 (17:16 +0000)]
[project @ 2002-01-30 17:16:04 by simonpj]
Improved printing

22 years ago[project @ 2002-01-30 16:54:18 by simonmar]
simonmar [Wed, 30 Jan 2002 16:54:18 +0000 (16:54 +0000)]
[project @ 2002-01-30 16:54:18 by simonmar]
Fix markup bug.

22 years ago[project @ 2002-01-30 16:37:59 by simonmar]
simonmar [Wed, 30 Jan 2002 16:37:59 +0000 (16:37 +0000)]
[project @ 2002-01-30 16:37:59 by simonmar]
comsetic only: shorten some lines.

22 years ago[project @ 2002-01-30 16:37:14 by simonmar]
simonmar [Wed, 30 Jan 2002 16:37:18 +0000 (16:37 +0000)]
[project @ 2002-01-30 16:37:14 by simonmar]
Simplify the package story inside the compiler.  The new story is
this:

  The Finder no longer determines a module's package based on its
  filesystem location.  The filesystem location indicates only whether
  a given module is in the current package or not (i.e. found along
  the -i path ==> current package, found along the package path ==>
  other package).

  Hence a Module no longer contains a package name.  Instead it just
  contains PackageInfo, which is either ThisPackage or AnotherPackage.
  The compiler uses this information for generating cross-DLL calls
  and omitting certain version information from .hi files.

  The interface still contains the package name.  This isn't used for
  anything right now, but in the future (when we have hierarchical
  libraries) we might use it to automatically determine which packages
  a binary should be linked against.  When building a package, you
  should still use -package-name, but it won't be fatal if you don't.

The warning/error about package name mismatches has gone away.

22 years ago[project @ 2002-01-30 16:27:34 by simonmar]
simonmar [Wed, 30 Jan 2002 16:27:34 +0000 (16:27 +0000)]
[project @ 2002-01-30 16:27:34 by simonmar]
Set $(HC) *after* including boilerplate.mk, which re-defines it.

22 years ago[project @ 2002-01-30 16:25:20 by simonmar]
simonmar [Wed, 30 Jan 2002 16:25:20 +0000 (16:25 +0000)]
[project @ 2002-01-30 16:25:20 by simonmar]
Don't use :: rules for building HSstd.o, they cause it to be rebuilt
every time.  According to the GNU make manual, :: rules are vary
rarely actually useful, and I'm sure we use them too much.

22 years ago[project @ 2002-01-30 14:05:36 by simonmar]
simonmar [Wed, 30 Jan 2002 14:05:36 +0000 (14:05 +0000)]
[project @ 2002-01-30 14:05:36 by simonmar]
Minor cleanups.

22 years ago[project @ 2002-01-30 14:05:01 by simonmar]
simonmar [Wed, 30 Jan 2002 14:05:01 +0000 (14:05 +0000)]
[project @ 2002-01-30 14:05:01 by simonmar]
Cleanup sweep, we can now use more of the std fptools build system
machinery in here.

22 years ago[project @ 2002-01-30 14:01:29 by simonmar]
simonmar [Wed, 30 Jan 2002 14:01:29 +0000 (14:01 +0000)]
[project @ 2002-01-30 14:01:29 by simonmar]
- .hsc sources can generate .hc files too
- Fix the sense of a conditional

22 years ago[project @ 2002-01-30 13:23:25 by sewardj]
sewardj [Wed, 30 Jan 2002 13:23:25 +0000 (13:23 +0000)]
[project @ 2002-01-30 13:23:25 by sewardj]
Fix debug build.

22 years ago[project @ 2002-01-30 13:13:55 by simonmar]
simonmar [Wed, 30 Jan 2002 13:13:55 +0000 (13:13 +0000)]
[project @ 2002-01-30 13:13:55 by simonmar]
Oops, better not pre-compute PRE_SRCS in paths.mk, because ALL_DIRS is
not set yet.  Instead, defer it until we include target.mk.

22 years ago[project @ 2002-01-30 12:17:21 by simonmar]
simonmar [Wed, 30 Jan 2002 12:17:21 +0000 (12:17 +0000)]
[project @ 2002-01-30 12:17:21 by simonmar]
Clean up this Makefile:

  - Use the enhanced automatic source-finding machinery from
    paths.mk rather than rolling our own,

  - Turn on UseGhcForCc to get our C files compiled with GHC.
    This fixes some obscure bugs caused by the fact that we
    were re-initializing $(CC_OPTS) in this Makefile using
    :=, when it had previously already been set with = (apparently
    different versions of GNU make behave differently presented
    with this kind of mixed assigment).

22 years ago[project @ 2002-01-30 12:13:59 by simonmar]
simonmar [Wed, 30 Jan 2002 12:13:59 +0000 (12:13 +0000)]
[project @ 2002-01-30 12:13:59 by simonmar]
GHC_CC_OPTS is a derived version of CC_OPTS with -optc prepended to
each option.  This is used when $(UseGhcForCc) = "YES" (see suffix.mk).

22 years ago[project @ 2002-01-30 12:13:11 by simonmar]
simonmar [Wed, 30 Jan 2002 12:13:11 +0000 (12:13 +0000)]
[project @ 2002-01-30 12:13:11 by simonmar]
Introduce a new tweakable $(UseGhcForCc) which if set to "YES" enables
a different set of suffix rules which build C-ish files using $(HC)
instead of $(CC).  We'll use this to clean up the ghc/rts Makefile.

22 years ago[project @ 2002-01-30 12:11:35 by simonmar]
simonmar [Wed, 30 Jan 2002 12:11:35 +0000 (12:11 +0000)]
[project @ 2002-01-30 12:11:35 by simonmar]
- Consider .hc files as real sources unless they are derived from
  .hs/.lhs sources (using the existing "derived sources" mechanism").

- Set PRE_SRCS using := rather than =, to avoid re-expanding the
  $(wildcard) multiple times.  In a simple test I did, this can save
  a 1/4 second (depending on the size of the directores involved) per
  make!

22 years ago[project @ 2002-01-30 10:52:38 by sewardj]
sewardj [Wed, 30 Jan 2002 10:52:38 +0000 (10:52 +0000)]
[project @ 2002-01-30 10:52:38 by sewardj]
Fix syntax error in printing indirect calls in sparc assembly.

22 years ago[project @ 2002-01-30 10:30:34 by simonmar]
simonmar [Wed, 30 Jan 2002 10:30:34 +0000 (10:30 +0000)]
[project @ 2002-01-30 10:30:34 by simonmar]
- Allow sources from multiple subdirectories to be selected, by
  setting $(ALL_DIRS).

- Automatically detect Happy sources in the same way as other kinds
  of sources.

22 years ago[project @ 2002-01-30 01:06:14 by sof]
sof [Wed, 30 Jan 2002 01:06:15 +0000 (01:06 +0000)]
[project @ 2002-01-30 01:06:14 by sof]
cope with the fact that StgTickyHeader is no more

22 years ago[project @ 2002-01-29 19:26:38 by krasimir]
krasimir [Tue, 29 Jan 2002 19:26:38 +0000 (19:26 +0000)]
[project @ 2002-01-29 19:26:38 by krasimir]
Add ObjectIO to standard packages

22 years ago[project @ 2002-01-29 18:50:28 by sof]
sof [Tue, 29 Jan 2002 18:50:28 +0000 (18:50 +0000)]
[project @ 2002-01-29 18:50:28 by sof]
Add ProjectPatchLevel

22 years ago[project @ 2002-01-29 18:32:18 by sof]
sof [Tue, 29 Jan 2002 18:32:18 +0000 (18:32 +0000)]
[project @ 2002-01-29 18:32:18 by sof]
StgParHeader&StgTickyHeader vestige removal

22 years ago[project @ 2002-01-29 18:28:49 by sof]
sof [Tue, 29 Jan 2002 18:28:49 +0000 (18:28 +0000)]
[project @ 2002-01-29 18:28:49 by sof]
sigh, steer clear of mingw backquoting issues

22 years ago[project @ 2002-01-29 17:12:53 by simonmar]
simonmar [Tue, 29 Jan 2002 17:12:53 +0000 (17:12 +0000)]
[project @ 2002-01-29 17:12:53 by simonmar]
Add instance Eq Exception (and hence instance Eq IOError).

22 years ago[project @ 2002-01-29 16:54:41 by sewardj]
sewardj [Tue, 29 Jan 2002 16:54:41 +0000 (16:54 +0000)]
[project @ 2002-01-29 16:54:41 by sewardj]
x86 only: remove special ccall support for calling PerformGC_wrapper
using dodgy-looking calling convention.  PerformGC_wrapper was last
seen alive in GHC 3.X, AFAIK.

22 years ago[project @ 2002-01-29 16:52:46 by simonmar]
simonmar [Tue, 29 Jan 2002 16:52:46 +0000 (16:52 +0000)]
[project @ 2002-01-29 16:52:46 by simonmar]
Remove some empty structs that weren't used.  Apparently empty structs
are illegal C.

22 years ago[project @ 2002-01-29 16:52:25 by sewardj]
sewardj [Tue, 29 Jan 2002 16:52:32 +0000 (16:52 +0000)]
[project @ 2002-01-29 16:52:25 by sewardj]
sparc NCG fixes for f-i-dynamic.

22 years ago[project @ 2002-01-29 16:50:08 by simonmar]
simonmar [Tue, 29 Jan 2002 16:50:08 +0000 (16:50 +0000)]
[project @ 2002-01-29 16:50:08 by simonmar]
Remove StgParInfo - not used anywhere.

22 years ago[project @ 2002-01-29 16:49:42 by simonmar]
simonmar [Tue, 29 Jan 2002 16:49:42 +0000 (16:49 +0000)]
[project @ 2002-01-29 16:49:42 by simonmar]
Remove PAR_ITBL_SIZE - not used anywhere.

22 years ago[project @ 2002-01-29 16:24:08 by simonmar]
simonmar [Tue, 29 Jan 2002 16:24:08 +0000 (16:24 +0000)]
[project @ 2002-01-29 16:24:08 by simonmar]
Inline mpz_cmp_si() into cmpIntegerInt#, and mpz_cmp() into cmpInteger#
to offset recent performance degradation caused by outlining of these
primitives.

Also remove heap checks in these primitives: they don't do any
allocation, so no heap check is necessary.

22 years ago[project @ 2002-01-29 14:41:52 by simonmar]
simonmar [Tue, 29 Jan 2002 14:41:52 +0000 (14:41 +0000)]
[project @ 2002-01-29 14:41:52 by simonmar]
Fix highly obscure bug.

The heap check in cmpIntegerzh_fast was erroneously passing
cmpIntegerIntzh_fast as the resumption point instead of
cmpIntegerzh_fast, with the result that if a heap-check happened to
strike in cmpIntegerzh_fast then we would end up resuming in
cmpIntegerIntzh and returning an incorrect comparison result.  One
symptom is that very occasionally floating point numbers would print
incorrectly (ending in an 'a').

22 years ago[project @ 2002-01-29 13:22:28 by sewardj]
sewardj [Tue, 29 Jan 2002 13:22:29 +0000 (13:22 +0000)]
[project @ 2002-01-29 13:22:28 by sewardj]
Teach the NCG how to do f-i-dynamic.  Nothing unexpected.
sparc-side now needs fixing.

22 years ago[project @ 2002-01-29 11:07:26 by sewardj]
sewardj [Tue, 29 Jan 2002 11:07:26 +0000 (11:07 +0000)]
[project @ 2002-01-29 11:07:26 by sewardj]
Allow constructors with non-ptr fields to be allocated in-line.

22 years ago[project @ 2002-01-29 09:58:14 by simonpj]
simonpj [Tue, 29 Jan 2002 09:58:21 +0000 (09:58 +0000)]
[project @ 2002-01-29 09:58:14 by simonpj]
------------
Rule phasing
------------

This commit adds a little more control to when rules are enabled.

  {-# RULES
       "foo" [2] forall ...
       "baz" [~2] forall ...
  #-}

Rule "foo" is active in phase 2 and later.  The new thing is that the
"~2" means that Rule "baz" is active in phase 3 and earlier.
(Remember tha phases decrease towards zero.)

All the machinery was there to implement this, it just needed the syntax.

Why do this?  Peter Gammie (at UNSW) found that rules weren't firing
because of bindings of the form

M.f = f
f = ....

where the rules where on the M.f binding.  It turned out that an old
hack (which have for some time elicited the harmless "shortMeOut" debug
warnings) prevented this trivial construction from being correctly
simplified.  The hack in turn derived from a trick in the way the
foldr/build rule was implemented....and that hack is no longer necessary
now we can switch rules *off* as well as *on*.

There are consequential changes in the Prelude foldr/build RULE stuff.
It's a clean-up.... Instead of strange definitions like
map = mapList
which we had before, we have an ordinary recursive defn of map, together
with rules to convert first to foldr/build form, and then (if nothing
happens) back again.

There's a fairly long comment about the general plan of attack in
PrelBase, near the defn of map.

22 years ago[project @ 2002-01-29 06:15:03 by sof]
sof [Tue, 29 Jan 2002 06:15:03 +0000 (06:15 +0000)]
[project @ 2002-01-29 06:15:03 by sof]
Update comments re: reloc overflow. A careful re-read of the PE
spec did prove useful; Sec 4.1 (last para) describes how overflow
is handled.

22 years ago[project @ 2002-01-29 02:41:21 by sof]
sof [Tue, 29 Jan 2002 02:41:21 +0000 (02:41 +0000)]
[project @ 2002-01-29 02:41:21 by sof]
PEi386/COFF: handle relocation overflows, i.e., if a section is
marked with the flag (MY)IMAGE_SCN_LNK_NRELOC_OVFL, then
the first entry in the relocation table holds the 32-bit
relocation count rather than 16-bit number in the section header.
Apparently, a version of the MS PE spec exists that spells this
out, but haven't been able to locate it (perhaps people on the
'inside' could try to locate an up-to-date version...?) winnt.h
is clear enough about it though (as is the GNU libbfd sources).

This is the Right Way to compute the relocation count, but
unfortunately libbfd / GNU ld is generating bogus output
when the reloc field overflows (causing objdump/nm etc. to
crash when trying to read the generated output!) Looking into it.

Once this has been cleared up/fixed, the splitting up of HSstd.o
(and HSwin32.o) should be a thing of the past. I've taken the
liberty of disabling the suspiciously-large-reloc-section test
already.

22 years ago[project @ 2002-01-28 17:22:45 by sewardj]
sewardj [Mon, 28 Jan 2002 17:22:45 +0000 (17:22 +0000)]
[project @ 2002-01-28 17:22:45 by sewardj]
Generate better code for lets whose RHS is a simple fn or constructor
application.  Details are in comment in code.

22 years ago[project @ 2002-01-28 17:09:05 by simonmar]
simonmar [Mon, 28 Jan 2002 17:09:05 +0000 (17:09 +0000)]
[project @ 2002-01-28 17:09:05 by simonmar]
Catch up with recent changes in the middle end that changed the
assumptions about constructor applications: it is not necessarily the
case any more that constructor applications are always saturated in
the output from CorePrep.

For a non-saturated constructor application there is always a curried
worker function that can be called instead.  This change updates the
byte code generator to use the curried worker when necessary.

Also: a couple of micro-optimisations/cleanups.

22 years ago[project @ 2002-01-28 16:52:37 by simonpj]
simonpj [Mon, 28 Jan 2002 16:52:37 +0000 (16:52 +0000)]
[project @ 2002-01-28 16:52:37 by simonpj]
----------------------
Zero-constructor types
----------------------

If we have

data T
data S = MkS !T

we were getting a crash in the compiler because ctrlRetConvAlg
didn't know what to do for zero-constructor types.

This fix arbitrarily says that they use a non-vectored return,
which fixes the crash.  (Since they only have bottom values,
the return never gets exercised, but GC and exception handling
should work.)

What is still unclear is how we handle data types that are defined
with zero constructors in an hi-boot file.  I think that Bad Things
may well happen if you do a 'seq' on them before we get up to the
definition.  (e.g. as a result of this fix we'll say "unvectored"
whereas the truth may be "vectored".)  This obviously doesn't happen
much (because at present we'd get a compiler crash in ctrlRetConvAlg,
but we should look into it.

22 years ago[project @ 2002-01-28 13:47:05 by simonmar]
simonmar [Mon, 28 Jan 2002 13:47:05 +0000 (13:47 +0000)]
[project @ 2002-01-28 13:47:05 by simonmar]
Never close std file descriptors.  This works around a "problem" in
GHCi: if the program reaches EOF on stdin, it might close it, which in
turn causes the interactive shell to fall over with a "bad file
descriptor" error when it tries to read from stdin.

22 years ago[project @ 2002-01-28 13:34:10 by simonmar]
simonmar [Mon, 28 Jan 2002 13:34:10 +0000 (13:34 +0000)]
[project @ 2002-01-28 13:34:10 by simonmar]
Set stdin to unbuffered, so that GHCi doesn't accidentally buffer any
input that might be intended for the program.

22 years ago[project @ 2002-01-28 12:01:12 by simonmar]
simonmar [Mon, 28 Jan 2002 12:01:12 +0000 (12:01 +0000)]
[project @ 2002-01-28 12:01:12 by simonmar]
Make GHCi silent in "unverbose" mode (-v0).  Now you can get a crude
runhugs-style behaviour like this:

   echo main | ghci -v0 Main

22 years ago[project @ 2002-01-27 10:53:26 by panne]
panne [Sun, 27 Jan 2002 10:53:26 +0000 (10:53 +0000)]
[project @ 2002-01-27 10:53:26 by panne]
Unbreak 2nd stage build by tracking recent RTS naming changes
(ATTENTION: I'm not quite sure what I'm doing here exactly,
 but things seem to work... :-}

22 years ago[project @ 2002-01-26 18:04:48 by rje]
rje [Sat, 26 Jan 2002 18:04:48 +0000 (18:04 +0000)]
[project @ 2002-01-26 18:04:48 by rje]
Minor tweak to use the new names.

X_ret_info -> X_info.

Just so the mangler finds things more easily.

For more info, see the commit to HeapStackCheck.hc

22 years ago[project @ 2002-01-26 18:02:05 by rje]
rje [Sat, 26 Jan 2002 18:02:05 +0000 (18:02 +0000)]
[project @ 2002-01-26 18:02:05 by rje]
Change to declarations of info tables of the form X_ret_info to syncronise with my previous commit to HeapStackCheck.hc

22 years ago[project @ 2002-01-26 17:58:47 by rje]
rje [Sat, 26 Jan 2002 17:58:47 +0000 (17:58 +0000)]
[project @ 2002-01-26 17:58:47 by rje]
This is a simple fix for a rather obscure bug.

In the heap/stack checking code, we were creating info tables with names of the form stg_gc_X_ret_info, and giving them entry points with names of the form stg_gc_X_ret.

Unfortunately, the mangler expects that if an info table is called Y_info, the entry point should be called Y_ret or Y_entry.

In this case, the mangler thus looks for stg_gc_X_ret_ret and stg_gc_X_ret_entry, neither of which exists.

As a result, the entry points aren't placed directly after the info tables.

Fortunately, the code for the entry points was defined emmediately after the info table definition, and so was *usually* in the right place already.

However, in certain circumstances (that can result from some tweaks on my private tree, and might possibly occur by other means), this was not happening, and thus any attempts to enter the entry point for this info table will cause problems.

The fix is quite simple: rename the info tables so that the mangler finds the entry points and puts them in the right places.

I don't think this commit is likely to have a notable effect on anything else.

22 years ago[project @ 2002-01-25 16:46:53 by simonmar]
simonmar [Fri, 25 Jan 2002 16:46:54 +0000 (16:46 +0000)]
[project @ 2002-01-25 16:46:53 by simonmar]
In GHCi, if we are currently using a compiled version of a module and
the user compiles a new version of the module, allow the new version
to be linked in during a :reload.  (as suggested by Koen Claessen).

We can't go all the way and allow a newly compiled module to replace
an existing interpreted version, because the version numbers in the
interface file will be out-of-sync with our internal copy of the
interface.  To link in a newly compiled version of an interpreted
module, you still have to do :load.

22 years ago[project @ 2002-01-25 16:35:29 by simonmar]
simonmar [Fri, 25 Jan 2002 16:35:29 +0000 (16:35 +0000)]
[project @ 2002-01-25 16:35:29 by simonmar]
Fix bit-rot in TICKY_TICKY

22 years ago[project @ 2002-01-25 12:22:27 by simonmar]
simonmar [Fri, 25 Jan 2002 12:22:27 +0000 (12:22 +0000)]
[project @ 2002-01-25 12:22:27 by simonmar]
Fix tryTakeMVar - amazingly it only worked with an empty MVar, and
this was the only case I tested.  oops.

Merge to stable.

22 years ago[project @ 2002-01-25 10:28:12 by simonmar]
simonmar [Fri, 25 Jan 2002 10:28:15 +0000 (10:28 +0000)]
[project @ 2002-01-25 10:28:12 by simonmar]
Convert -fno-monomorphism-restriction into a dynamic flag.  Fixes bug
#508177.

22 years ago[project @ 2002-01-25 09:54:00 by simonpj]
simonpj [Fri, 25 Jan 2002 09:54:00 +0000 (09:54 +0000)]
[project @ 2002-01-25 09:54:00 by simonpj]
Typo

22 years ago[project @ 2002-01-24 16:55:35 by simonmar]
simonmar [Thu, 24 Jan 2002 16:55:37 +0000 (16:55 +0000)]
[project @ 2002-01-24 16:55:35 by simonmar]
Add support for Hugs's :browse (or :b) command.  There are two forms:

- :b M   (interpreted modules only) shows everything
          defined in M - the types of top-level functions,
  and definitions of classes and datatypes.

- :b *M  shows everything exported from module M.
  Available for both compiled and interpreted modules.

The user interface is subject to change, but for now it is consistent
with the new semantics of the :module command.

The implementation is a little tricky, since for a package module we
have to be sure to slurp in all the required declarations first.

22 years ago[project @ 2002-01-24 16:55:04 by sewardj]
sewardj [Thu, 24 Jan 2002 16:55:04 +0000 (16:55 +0000)]
[project @ 2002-01-24 16:55:04 by sewardj]
This is one of those commits where the commit message is hundreds of
times, in bytes, larger than the fix.  If you count pixels, it's
probably more like thousands of times larger, since the fix involves
adding a missing apostrophe.

In compiling let bindings, when filtering the free vars of each RHS
against the supplied on-stack environment p, filter against p after it
has been augmented with the binders in this let (viz, p'), rather than
before.  Without this, letrec-bound binders can never "get started" in
the environment.

This fixes the HEAD crash for [(i,1) | i <- [1]].  Stable branch
is ok since the free-var machinery works a different way there.

22 years ago[project @ 2002-01-24 07:50:01 by sof]
sof [Thu, 24 Jan 2002 07:50:02 +0000 (07:50 +0000)]
[project @ 2002-01-24 07:50:01 by sof]
SMP: misc tasks timing stats fixes

22 years ago[project @ 2002-01-24 02:15:19 by sof]
sof [Thu, 24 Jan 2002 02:15:19 +0000 (02:15 +0000)]
[project @ 2002-01-24 02:15:19 by sof]
SMP: hack-and-slash to bring BaseReg into scope

22 years ago[project @ 2002-01-24 02:06:48 by sof]
sof [Thu, 24 Jan 2002 02:06:49 +0000 (02:06 +0000)]
[project @ 2002-01-24 02:06:48 by sof]
SMP: disable spark support (only a little bit of header file re-jigging is reqd to get it going again, I suspect.)

22 years ago[project @ 2002-01-24 01:45:55 by sof]
sof [Thu, 24 Jan 2002 01:45:55 +0000 (01:45 +0000)]
[project @ 2002-01-24 01:45:55 by sof]
SMP: bunch of triv. changes to account for the fact that a Capability is no longer just a RegTable

22 years ago[project @ 2002-01-24 00:53:18 by sof]
sof [Thu, 24 Jan 2002 00:53:18 +0000 (00:53 +0000)]
[project @ 2002-01-24 00:53:18 by sof]
Way 's': add -DSMP to HC_ and CC_OPTS

22 years ago[project @ 2002-01-24 00:40:28 by sof]
sof [Thu, 24 Jan 2002 00:40:28 +0000 (00:40 +0000)]
[project @ 2002-01-24 00:40:28 by sof]
SMP: move link field from StgRegTable to Capability

22 years ago[project @ 2002-01-23 23:53:54 by sof]
sof [Wed, 23 Jan 2002 23:53:54 +0000 (23:53 +0000)]
[project @ 2002-01-23 23:53:54 by sof]
make it compile when GHCI aint

22 years ago[project @ 2002-01-23 17:51:46 by lewie]
lewie [Wed, 23 Jan 2002 17:51:46 +0000 (17:51 +0000)]
[project @ 2002-01-23 17:51:46 by lewie]
Add special case for installing shared libs (which need the execute bit set).

22 years ago[project @ 2002-01-23 16:50:46 by simonmar]
simonmar [Wed, 23 Jan 2002 16:50:52 +0000 (16:50 +0000)]
[project @ 2002-01-23 16:50:46 by simonmar]
- Implement an alternative :module syntax so we can play around with it.

- Implement ':show bindings' and ':show modules'

- Fix a bug whereby doing :info on a local binding would cause a panic
  (this needs to be merged to STABLE - the change is part of the patch
  to HscMain).

- Some cleanups in InteractiveUI.hs

22 years ago[project @ 2002-01-23 11:29:12 by sewardj]
sewardj [Wed, 23 Jan 2002 11:29:12 +0000 (11:29 +0000)]
[project @ 2002-01-23 11:29:12 by sewardj]
Fix two problems with the ELF linker:

1.  Determine section attributes by examining various bits in the
    section header tables, rather than from the section names.  This
    makes it robust against future changes / additions to the set of
    section names.

2.  Handle local symbols differently.  Do not add them to our own
    local symbol table for this object, since that's

    (a) wrong -- multiple local symbols can have the same name so long
        as each is in a different section, so if we just dump them into
        the local symbol table we'll wind up with apparently duplicate
        symbols

    (b) totally unnecessary, since the relocations against local symbols
        simply specify an index into the ELF symbol table for the object,
        from whence the address can be calculated without reference to the
        name.

TODO: Test on sparc-solaris
      Investigate whether PEi386 linker needs fixing similarly
and then
MERGE TO STABLE

22 years ago[project @ 2002-01-23 11:11:13 by simonmar]
simonmar [Wed, 23 Jan 2002 11:11:13 +0000 (11:11 +0000)]
[project @ 2002-01-23 11:11:13 by simonmar]
Revert to running command-line statements in the context of the
current thread, so that ^C exceptions get delivered to the right
place.

Now that a deadlock generates an exception this is not so bad, but it
would be nice to do it the "right" way so I've left the old code in a
comment for now.

22 years ago[project @ 2002-01-22 16:58:37 by simonmar]
simonmar [Tue, 22 Jan 2002 16:58:37 +0000 (16:58 +0000)]
[project @ 2002-01-22 16:58:37 by simonmar]
More wibbles, sigh.  Must have been typing with my elbows when I made
that change.

22 years ago[project @ 2002-01-22 16:50:29 by simonmar]
simonmar [Tue, 22 Jan 2002 16:50:29 +0000 (16:50 +0000)]
[project @ 2002-01-22 16:50:29 by simonmar]
CmRunDeadlocked no longer exists

22 years ago[project @ 2002-01-22 15:55:59 by simonmar]
simonmar [Tue, 22 Jan 2002 15:55:59 +0000 (15:55 +0000)]
[project @ 2002-01-22 15:55:59 by simonmar]
Fix wibbles in previous commit.

22 years ago[project @ 2002-01-22 14:47:52 by simonmar]
simonmar [Tue, 22 Jan 2002 14:47:52 +0000 (14:47 +0000)]
[project @ 2002-01-22 14:47:52 by simonmar]
Strip whitespace from the beginning of the line when looking for
OPTIONS pragmas.

22 years ago[project @ 2002-01-22 13:54:22 by simonmar]
simonmar [Tue, 22 Jan 2002 13:54:23 +0000 (13:54 +0000)]
[project @ 2002-01-22 13:54:22 by simonmar]
Deadlock is now an exception instead of a return status from
rts_evalIO().

The current behaviour is as follows, and can be changed if necessary:
in the event of a deadlock, the top main thread is taken from the main
thread queue, and if it is blocked on an MVar or an Exception (for
throwTo), then it receives a Deadlock exception.  If it is blocked on
a BLACKHOLE, we instead send it the NonTermination exception.  Note
that only the main thread gets the exception: it is the responsibility
of the main thread to unblock other threads if necessary.

There's a slight difference in the SMP build: *all* the main threads
get an exception, because clearly none of them may make progress
(compared to the non-SMP situation, where all but the top main thread
are usually blocked).

22 years ago[project @ 2002-01-22 13:35:36 by simonmar]
simonmar [Tue, 22 Jan 2002 13:35:37 +0000 (13:35 +0000)]
[project @ 2002-01-22 13:35:36 by simonmar]
Attempt to fix the problems with missing instances once more.

The current problem is that in the case where a ModDetails is being
constructed from its interface (in compilation manager modes) we
weren't getting any instances because the instances are gotten from
the [InstInfo] returned from tcInstDecls1, which only contains
*source* instance declarations.  Fix: return a list of DFuns defined
in the current module from tcInstDecls1, to be plugged into the
ModDetails later.

Also: revert the previous change to the isLocalThing predicate,
because now we really want to know which dfuns come from the current
module.  The comment about the iface_dfuns containing only package and
local instances is incorrect in batch-compile mode, because we also
demand-load stuff from home package interfaces, so I deleted this
comment and fixed up some of the other commentary.

22 years ago[project @ 2002-01-22 13:09:36 by simonmar]
simonmar [Tue, 22 Jan 2002 13:09:37 +0000 (13:09 +0000)]
[project @ 2002-01-22 13:09:36 by simonmar]
Fix for a change in CPP's behaviour in gcc 2.96 relative to 2.95.
Unlit used to inject '# <line> <file>' at the beginning of the output
file, but in gcc 2.96 this is ignored.  Instead we have to inject
'#line <line> <file>', which in turn means that GHC's lexer has to
understand this kind of pragma in addition to the plain '#' form, in
the case when we aren't running CPP after unlitting.

22 years ago[project @ 2002-01-22 13:04:13 by simonmar]
simonmar [Tue, 22 Jan 2002 13:04:13 +0000 (13:04 +0000)]
[project @ 2002-01-22 13:04:13 by simonmar]
Import wibbles

22 years ago[project @ 2002-01-21 19:56:20 by sof]
sof [Mon, 21 Jan 2002 19:56:20 +0000 (19:56 +0000)]
[project @ 2002-01-21 19:56:20 by sof]
assume bash (and not ash) is used with mingw