Commit c848891a authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Merge branch 'master' of darcs.haskell.org:/home/darcs/ghc

parents 10377bba 55cdcc96
......@@ -27,6 +27,7 @@ import Panic
import Bag
import SrcLoc
import Data.Function
import Data.List
......@@ -194,11 +195,12 @@ processOneArg opt_kind rest arg args
findArg :: [Flag m] -> String -> Maybe (String, OptKind m)
findArg spec arg =
case [ (removeSpaces rest, optKind)
| flag <- spec,
let optKind = flagOptKind flag,
Just rest <- [stripPrefix (flagName flag) arg],
arg_ok optKind rest arg ]
case sortBy (compare `on` (length . fst)) -- prefer longest matching flag
[ (removeSpaces rest, optKind)
| flag <- spec,
let optKind = flagOptKind flag,
Just rest <- [stripPrefix (flagName flag) arg],
arg_ok optKind rest arg ]
of
[] -> Nothing
(one:_) -> Just one
......
......@@ -1118,11 +1118,16 @@ runPhase cc_phase input_fn dflags
then ["-mcpu=v9"]
else [])
-- GCC 4.6+ doesn't like -Wimplicit when compiling C++.
++ (if (cc_phase /= Ccpp && cc_phase /= Cobjcpp)
then ["-Wimplicit"]
else [])
++ (if hcc
then gcc_extra_viac_flags ++ more_hcc_opts
else [])
++ verbFlags
++ [ "-S", "-Wimplicit", cc_opt ]
++ [ "-S", cc_opt ]
++ [ "-D__GLASGOW_HASKELL__="++cProjectVersionInt ]
++ framework_paths
++ cc_opts
......
......@@ -432,7 +432,7 @@ addFamInsts :: [FamInst] -> TcM a -> TcM a
-- (b) the type envt with stuff from data type decls
addFamInsts fam_insts thing_inside
= tcExtendLocalFamInstEnv fam_insts $
tcExtendGlobalEnvImplicit things $
tcExtendGlobalEnv things $
do { traceTc "addFamInsts" (pprFamInsts fam_insts)
; tcg_env <- tcAddImplicits things
; setGblEnv tcg_env thing_inside }
......
......@@ -71,17 +71,18 @@ documentation</ulink> describes all the libraries that come with GHC.
<para>GHC is built on a raft of primitive data types and operations;
"primitive" in the sense that they cannot be defined in Haskell itself.
While you really can use this stuff to write fast code,
we generally find it a lot less painful, and more satisfying in the
long run, to use higher-level language features and libraries. With
any luck, the code you write will be optimised to the efficient
unboxed version in any case. And if it isn't, we'd like to know
about it.</para>
we generally find it a lot less painful, and more satisfying in the
long run, to use higher-level language features and libraries. With
any luck, the code you write will be optimised to the efficient
unboxed version in any case. And if it isn't, we'd like to know
about it.</para>
<para>All these primitive data types and operations are exported by the
library <literal>GHC.Prim</literal>, for which there is
<ulink url="&libraryGhcPrimLocation;/GHC-Prim.html">detailed online documentation</ulink>.
(This documentation is generated from the file <filename>compiler/prelude/primops.txt.pp</filename>.)
</para>
<para>
If you want to mention any of the primitive data types or operations in your
program, you must first import <literal>GHC.Prim</literal> to bring them
......@@ -94,8 +95,7 @@ and <link linkend="unboxed-tuples">unboxed tuples</link>, which
we briefly summarise here. </para>
<sect2 id="glasgow-unboxed">
<title>Unboxed types
</title>
<title>Unboxed types</title>
<para>
<indexterm><primary>Unboxed types (Glasgow extension)</primary></indexterm>
......@@ -202,8 +202,7 @@ since <literal>b</literal> has type <literal>Int#</literal>.
</sect2>
<sect2 id="unboxed-tuples">
<title>Unboxed Tuples
</title>
<title>Unboxed tuples</title>
<para>
Unboxed tuples aren't really exported by <literal>GHC.Exts</literal>;
......@@ -238,46 +237,19 @@ tuples to avoid unnecessary allocation during sequences of operations.
</para>
<para>
There are some pretty stringent restrictions on the use of unboxed tuples:
There are some restrictions on the use of unboxed tuples:
<itemizedlist>
<listitem>
<listitem>
<para>
Values of unboxed tuple types are subject to the same restrictions as
other unboxed types; i.e. they may not be stored in polymorphic data
structures or passed to polymorphic functions.
</para>
</listitem>
<listitem>
<para>
No variable can have an unboxed tuple type, nor may a constructor or function
argument have an unboxed tuple type. The following are all illegal:
<programlisting>
data Foo = Foo (# Int, Int #)
f :: (# Int, Int #) -&#62; (# Int, Int #)
f x = x
g :: (# Int, Int #) -&#62; Int
g (# a,b #) = a
h x = let y = (# x,x #) in ...
</programlisting>
</para>
</listitem>
<listitem>
<para>
Unboxed tuples may not be nested. So this is illegal:
<programlisting>
f :: (# Int, (# Int, Int #), Bool #)
</programlisting>
</para>
</listitem>
</itemizedlist>
</para>
<para>
The typical use of unboxed tuples is simply to return multiple values,
binding those multiple results with a <literal>case</literal> expression, thus:
<programlisting>
......@@ -298,6 +270,10 @@ above example desugars like this:
in ..body..
</programlisting>
Indeed, the bindings can even be recursive.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
......
......@@ -2035,7 +2035,9 @@ newDynFlags interactive_only minus_opts = do
-- the new packages.
dflags2 <- getDynFlags
when (packageFlags dflags2 /= packageFlags dflags0) $ do
liftIO $ hPutStrLn stderr "package flags have changed, resetting and loading new packages..."
when (verbosity dflags2 > 0) $
liftIO . putStrLn $
"package flags have changed, resetting and loading new packages..."
GHC.setTargets []
_ <- GHC.load LoadAllTargets
liftIO $ linkPackages dflags2 new_pkgs
......
......@@ -791,5 +791,10 @@ abiHash strs = do
-- Util
unknownFlagsErr :: [String] -> a
unknownFlagsErr fs = ghcError (UsageError ("unrecognised flags: " ++ unwords fs))
unknownFlagsErr fs = ghcError $ UsageError $ concatMap oneError fs
where
oneError f =
"unrecognised flag: " ++ f ++ "\n" ++
(case fuzzyMatch f (nub allFlags) of
[] -> ""
suggs -> "did you mean one of:\n" ++ unlines (map (" " ++) suggs))
......@@ -386,7 +386,7 @@ BIN_DIST_PREP_TAR_BZ2 = $(BIN_DIST_PREP_TAR).bz2
BIN_DIST_TAR_BZ2 = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
BIN_DIST_LIST = bindist-list
WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-i386-windows
WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TargetArch_CPP)-windows
WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
# -----------------------------------------------------------------------------
......
......@@ -70,11 +70,12 @@
#include <sys/wait.h>
#endif
#if !defined(powerpc_HOST_ARCH) && \
( defined(linux_HOST_OS ) || defined(freebsd_HOST_OS) || \
#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \
|| (!defined(powerpc_HOST_ARCH) && \
( defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || \
defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \
defined(openbsd_HOST_OS ) || defined(darwin_HOST_OS ) || \
defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS))
defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS)))
/* Don't use mmap on powerpc_HOST_ARCH as mmap doesn't support
* reallocating but we need to allocate jump islands just after each
* object images. Otherwise relative branches to jump islands can fail
......@@ -90,6 +91,16 @@
#endif
/* PowerPC has relative branch instructions with only 24 bit displacements
* and therefore needs jump islands contiguous with each object code module.
*/
#if (defined(USE_MMAP) && defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS))
#define USE_CONTIGUOUS_MMAP 1
#else
#define USE_CONTIGUOUS_MMAP 0
#endif
#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
# define OBJFORMAT_ELF
# include <regex.h> // regex is already used by dlopen() so this is OK
......@@ -1287,6 +1298,8 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(getMonotonicNSec) \
SymI_HasProto(lockFile) \
SymI_HasProto(unlockFile) \
SymI_NeedsProto(startProfTimer) \
SymI_NeedsProto(stopProfTimer) \
RTS_USER_SIGNALS_SYMBOLS \
RTS_INTCHAR_SYMBOLS
......@@ -2797,8 +2810,26 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
*/
if( m > n ) // we need to allocate more pages
{
oc->symbol_extras = mmapForLinker(sizeof(SymbolExtra) * count,
if (USE_CONTIGUOUS_MMAP)
{
/* Keep image and symbol_extras contiguous */
void *new = mmapForLinker(n + (sizeof(SymbolExtra) * count),
MAP_ANONYMOUS, -1);
if (new)
{
memcpy(new, oc->image, oc->fileSize);
munmap(oc->image, n);
oc->image = new;
oc->symbol_extras = (SymbolExtra *) (oc->image + n);
}
else
oc->symbol_extras = NULL;
}
else
{
oc->symbol_extras = mmapForLinker(sizeof(SymbolExtra) * count,
MAP_ANONYMOUS, -1);
}
}
else
{
......
......@@ -25,21 +25,21 @@ static int ticks_to_heap_profile;
// Time for a heap profile on the next context switch
rtsBool performHeapProfile;
#ifdef PROFILING
void
stopProfTimer( void )
{
#ifdef PROFILING
do_prof_ticks = rtsFalse;
#endif
}
void
startProfTimer( void )
{
#ifdef PROFILING
do_prof_ticks = rtsTrue;
}
#endif
}
void
stopHeapProfTimer( void )
......
......@@ -14,10 +14,8 @@
void initProfTimer ( void );
void handleProfTick ( void );
#ifdef PROFILING
void stopProfTimer ( void );
void startProfTimer ( void );
#endif
void stopHeapProfTimer ( void );
void startHeapProfTimer ( void );
......
......@@ -57,7 +57,8 @@ endif
$$(foreach opt,$$($1_$2_v_ALL_HC_OPTS),--optghc=$$(opt)) \
$$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS) \
$$($1_$2_HS_SRCS) \
$$($1_$2_EXTRA_HADDOCK_SRCS)
$$($1_$2_EXTRA_HADDOCK_SRCS) \
+RTS -t$$@.t --machine-readable
# --no-tmp-comp-dir above is important: it saves a few minutes in a
# validate. This flag lets Haddock use the pre-compiled object files
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment