[commit: ghc] master: add docs for :showi language (#7501) (f838d2f)

2013-01-09 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f838d2f3d4ee8876647f190da3b2c858c6a669d4

---

commit f838d2f3d4ee8876647f190da3b2c858c6a669d4
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Jan 9 09:29:42 2013 +

add docs for :showi language (#7501)

---

 docs/users_guide/ghci.xml |   17 ++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index f3e93a3..93ab62b 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -2808,11 +2808,22 @@ bar
 
   varlistentry
term
-  literal:show languages/literal
-  indextermprimaryliteral:show 
languages/literal/primary/indexterm
+  literal:show language/literal
+  indextermprimaryliteral:show 
language/literal/primary/indexterm
 /term
listitem
-paraShow the currently active language flags./para
+paraShow the currently active language flags for source files./para
+   /listitem
+  /varlistentry
+
+  varlistentry
+   term
+  literal:showi language/literal
+  indextermprimaryliteral:showi 
language/literal/primary/indexterm
+/term
+   listitem
+  paraShow the currently active language flags for
+  expressions typed at the prompt (see also 
literal:seti/literal)./para
/listitem
   /varlistentry
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: remove unnecessary size field in BCO (#7518) (0c42e30)

2013-01-09 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/0c42e301337bdefa94d0c288bb6d689ac33baa4d

---

commit 0c42e301337bdefa94d0c288bb6d689ac33baa4d
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Jan 9 11:51:58 2013 +

remove unnecessary size field in BCO (#7518)

---

 compiler/ghci/ByteCodeAsm.lhs |8 ++--
 rts/Interpreter.c |4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/compiler/ghci/ByteCodeAsm.lhs b/compiler/ghci/ByteCodeAsm.lhs
index 17b3042..9631add 100644
--- a/compiler/ghci/ByteCodeAsm.lhs
+++ b/compiler/ghci/ByteCodeAsm.lhs
@@ -129,10 +129,7 @@ assembleBCO dflags (ProtoBCO nm instrs bitmap bsize arity 
_origin _malloced) = d
   -- pass 1: collect up the offsets of the local labels.
   let asm = mapM_ (assembleI dflags) instrs
 
-  -- Remember that the first insn starts at offset
-  -- sizeOf Word / sizeOf Word16
-  -- since offset 0 (eventually) will hold the total # of insns.
-  initial_offset = largeArg16s dflags
+  initial_offset = 0
 
   -- Jump instructions are variable-sized, there are long and short 
variants
   -- depending on the magnitude of the offset.  However, we can't tell what
@@ -153,8 +150,7 @@ assembleBCO dflags (ProtoBCO nm instrs bitmap bsize arity 
_origin _malloced) = d
 (Map.lookup lbl lbl_map)
 
   -- pass 2: run assembler and generate instructions, literals and pointers
-  let initial_insns = addListToSS emptySS $ largeArg dflags n_insns
-  let initial_state = (initial_insns, emptySS, emptySS)
+  let initial_state = (emptySS, emptySS, emptySS)
   (final_insns, final_lits, final_ptrs) - execState initial_state $ runAsm 
dflags long_jumps env asm
 
   -- precomputed size should be equal to final size
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index 809f0ab..f4fe816 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -788,9 +788,7 @@ run_BCO:
register StgPtr*   ptrs   = (StgPtr*)(bco-ptrs-payload[0]);
 #ifdef DEBUG
int bcoSize;
-bcoSize = BCO_READ_NEXT_WORD;
-#else
-BCO_NEXT_WORD;
+bcoSize = bco-instrs-bytes / sizeof(StgWord16);
 #endif
IF_DEBUG(interpreter,debugBelch(bcoSize = %d\n, bcoSize));
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix disassembler after removal of size field in bco-instrs (#7518) (343548d)

2013-01-09 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/343548da7274cd15aaeabe72c6b37bce78e9af9c

---

commit 343548da7274cd15aaeabe72c6b37bce78e9af9c
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Jan 9 14:46:03 2013 +

fix disassembler after removal of size field in bco-instrs  (#7518)

---

 rts/Disassembler.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/Disassembler.c b/rts/Disassembler.c
index bcc0858..44f487d 100644
--- a/rts/Disassembler.c
+++ b/rts/Disassembler.c
@@ -283,11 +283,11 @@ void disassemble( StgBCO *bco )
nat i, j;
StgWord16* instrs= (StgWord16*)(bco-instrs-payload);
StgMutArrPtrs* ptrs  = bco-ptrs;
-   natnbcs  = (int)instrs[0];
+   natnbcs  = (int)(bco-instrs-bytes / sizeof(StgWord16));
natpc= 1;
 
debugBelch(BCO\n );
-   pc = 1;
+   pc = 0;
while (pc = nbcs) {
   debugBelch(\t%2d:  , pc );
   pc = disInstr ( bco, pc );



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix some incorrect narrowing rules (#7361) (3af022f)

2013-01-09 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3af022f3ae6ff3adceb2318cf50549d954e8bbe7

---

commit 3af022f3ae6ff3adceb2318cf50549d954e8bbe7
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Jan 9 16:52:16 2013 +

Fix some incorrect narrowing rules (#7361)

e.g. narrow8Int# subsumes narrow16Int#, not the other way around.

---

 compiler/prelude/PrelRules.lhs |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs
index b58eb0a..b21d546 100644
--- a/compiler/prelude/PrelRules.lhs
+++ b/compiler/prelude/PrelRules.lhs
@@ -142,28 +142,28 @@ primOpRules nm Int2WordOp = mkPrimOpRule nm 1 [ 
liftLitDynFlags int2WordLit
   , inversePrimOp Word2IntOp ]
 primOpRules nm Narrow8IntOp   = mkPrimOpRule nm 1 [ liftLit narrow8IntLit
   , subsumedByPrimOp 
Narrow8IntOp
-  , subsumedByPrimOp 
Narrow16IntOp
-  , subsumedByPrimOp 
Narrow32IntOp ]
+  , Narrow8IntOp 
`subsumesPrimOp` Narrow16IntOp
+  , Narrow8IntOp 
`subsumesPrimOp` Narrow32IntOp ]
 primOpRules nm Narrow16IntOp  = mkPrimOpRule nm 1 [ liftLit narrow16IntLit
-  , Narrow16IntOp 
`subsumesPrimOp` Narrow8IntOp
+  , subsumedByPrimOp 
Narrow8IntOp
   , subsumedByPrimOp 
Narrow16IntOp
-  , subsumedByPrimOp 
Narrow32IntOp ]
+  , Narrow16IntOp 
`subsumesPrimOp` Narrow32IntOp ]
 primOpRules nm Narrow32IntOp  = mkPrimOpRule nm 1 [ liftLit narrow32IntLit
-  , Narrow32IntOp 
`subsumesPrimOp` Narrow8IntOp
-  , Narrow32IntOp 
`subsumesPrimOp` Narrow16IntOp
+  , subsumedByPrimOp 
Narrow8IntOp
+  , subsumedByPrimOp 
Narrow16IntOp
   , subsumedByPrimOp 
Narrow32IntOp
   , removeOp32 ]
 primOpRules nm Narrow8WordOp  = mkPrimOpRule nm 1 [ liftLit narrow8WordLit
   , subsumedByPrimOp 
Narrow8WordOp
-  , subsumedByPrimOp 
Narrow16WordOp
-  , subsumedByPrimOp 
Narrow32WordOp ]
+  , Narrow8WordOp 
`subsumesPrimOp` Narrow16WordOp
+  , Narrow8WordOp 
`subsumesPrimOp` Narrow32WordOp ]
 primOpRules nm Narrow16WordOp = mkPrimOpRule nm 1 [ liftLit narrow16WordLit
-  , Narrow16WordOp 
`subsumesPrimOp` Narrow8WordOp
+  , subsumedByPrimOp 
Narrow8WordOp
   , subsumedByPrimOp 
Narrow16WordOp
-  , subsumedByPrimOp 
Narrow32WordOp ]
+  , Narrow16WordOp 
`subsumesPrimOp` Narrow32WordOp ]
 primOpRules nm Narrow32WordOp = mkPrimOpRule nm 1 [ liftLit narrow32WordLit
-  , Narrow32WordOp 
`subsumesPrimOp` Narrow8WordOp
-  , Narrow32WordOp 
`subsumesPrimOp` Narrow16WordOp
+  , subsumedByPrimOp 
Narrow8WordOp
+  , subsumedByPrimOp 
Narrow16WordOp
   , subsumedByPrimOp 
Narrow32WordOp
   , removeOp32 ]
 primOpRules nm OrdOp  = mkPrimOpRule nm 1 [ liftLit char2IntLit



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: Add test for #7361 (a443715)

2013-01-09 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a443715e79d6713cc0a9d9d36713e8c891b87079

---

commit a443715e79d6713cc0a9d9d36713e8c891b87079
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Jan 9 16:51:19 2013 +

Add test for #7361

---

 tests/codeGen/should_run/T7361.hs |   12 
 tests/codeGen/should_run/T7361.stdout |1 +
 tests/codeGen/should_run/all.T|2 ++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/codeGen/should_run/T7361.hs 
b/tests/codeGen/should_run/T7361.hs
new file mode 100644
index 000..81301e4
--- /dev/null
+++ b/tests/codeGen/should_run/T7361.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE MagicHash #-}
+import GHC.Exts
+
+main = print $ map f [1,256,65536,minBound,maxBound]
+
+f (I# x#) =
+  [ I# (narrow8Int#  (narrow16Int# x#))
+  , I# (narrow8Int#  (narrow32Int# x#))
+  , I# (narrow16Int# (narrow8Int#  x#))
+  , I# (narrow16Int# (narrow32Int# x#))
+  , I# (narrow32Int# (narrow8Int#  x#))
+  , I# (narrow32Int# (narrow16Int# x#))]
diff --git a/tests/codeGen/should_run/T7361.stdout 
b/tests/codeGen/should_run/T7361.stdout
new file mode 100644
index 000..3b6bc30
--- /dev/null
+++ b/tests/codeGen/should_run/T7361.stdout
@@ -0,0 +1 @@
+[[1,1,1,1,1,1],[0,0,0,256,0,256],[0,0,0,0,0,0],[0,0,0,0,0,0],[-1,-1,-1,-1,-1,-1]]
diff --git a/tests/codeGen/should_run/all.T b/tests/codeGen/should_run/all.T
index 1a5733d..456f2c2 100644
--- a/tests/codeGen/should_run/all.T
+++ b/tests/codeGen/should_run/all.T
@@ -102,3 +102,5 @@ test('T7319', [ extra_ways(['prof']), only_ways(['prof']), 
exit_code(1),
 extra_run_opts('+RTS -xc') ], compile_and_run, [''])
 test('Word2Float32', unless_wordsize(32, skip), compile_and_run, [''])
 test('Word2Float64', unless_wordsize(64, skip), compile_and_run, [''])
+
+test('T7361', normal, compile_and_run, [''])



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Question about extensible-exceptions (to official extensible-exceptions maintainer - GHC HQ)

2013-01-08 Thread Simon Marlow

On 07/01/13 23:27, Pavel Zelinsky wrote:

Hi Ian,

As you suggested, maybe it is possible to consider code from report as a
modified report, but it does not solve the problem unless the
condition of Haskell 98 Report (Haskell FFI) license is satisfied:

Modified versions of this Report may also be copied and distributed for
any purpose, provided that the _modified version is clearly presented as
such, and that it does not claim to_*_ be a definition of the Haskell 98
Language_**.*


I know, it might sound awkward, but to satisfy this condition of the
license you have to make such _required _statement in the code! That is
why the second question I asked was:
  2) If the derived code was compiled with the following language in the
  license: modified version is clearly presented as such, and that it does
  not claim to be a definition of the Haskell 98 Language?
  Same questions about the Haskell Foreign... license.


Taking those two requirements separately:

  modified version is clearly presented as such

The license already clearly states that:

  This library [...] is derived from code from several
  sources:

  [...]

  * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
and freely redistributable (but see the full license for
restrictions).

and the second requirement:

  does not claim to be a definition of the Haskell 98 Language

There certainly aren't any such claims, so the requirement is satisfied. 
 But are you saying that there needs to be an explicit statement 
asserting the absence of such a claim?


Cheers,
Simon





Thanks,

Pavel


*Pavel Zelinsky*
Senior Manager and Group Leader, DemandTec Softlines Science
IBM Enterprise Marketing Management

*Phone:* 1-303-800-4562*
E-mail:*_pzeli...@us.ibm.com_ mailto:t...@us.ibm.com
IBM

1 Franklin Parkway
San Mateo, CA 94403
United States



Inactive hide details for Ian Lynagh ---01/07/2013 04:07:47 PM---On Mon,
Jan 07, 2013 at 03:51:57PM -0700, Pavel Zelinsky wroteIan Lynagh
---01/07/2013 04:07:47 PM---On Mon, Jan 07, 2013 at 03:51:57PM -0700,
Pavel Zelinsky wrote: 

From: Ian Lynagh i...@well-typed.com
To: Pavel Zelinsky/Boulder/IBM@IBMUS,
Cc: Simon Marlow marlo...@gmail.com, cvs-ghc@haskell.org
cvs-ghc@haskell.org, Simon Peyton-Jones simo...@microsoft.com
Date: 01/07/2013 04:07 PM
Subject: Re: Question about extensible-exceptions (to official
extensible-exceptions maintainer - GHC HQ)





On Mon, Jan 07, 2013 at 03:51:57PM -0700, Pavel Zelinsky wrote:
 
  Thank you all for your attention to the problem! I appreciate it!
 
  Let me try to clarify the question I asked.
 
  First of all, the same question was raised with Haskell_Containers
package
  and response from Milan Straka has completely resolved the problem, I
hope
  to receive similar response on the Extensible-Exceptions if
  possible/applicable.
 
  Problem is quite simple:
  - Extensible-Exceptions (similar to Containers) license claims that
code is
  derived from multiple sources including Haskell 98 Report and Haskell FFI
  - Full license of Haskell 98 Report and Haskell FFI does not contain any
  code license, but speaks only about entire report or modified report
  - So this represents a problem for our attorneys, because license of
  Extensible-Exceptions in unclear

I'm still not a lawyer, but I would imagine that:
* The Haskell 98 report licence applies to the whole report, including
  any code it contains, any APIs it defines, etc
* If you take some code or an API from the report, then you have a
  modified version of the report
* You will have the same problem with the base package


Thanks
Ian
--
Ian Lynagh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/





___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Question about extensible-exceptions (to official extensible-exceptions maintainer - GHC HQ)

2013-01-07 Thread Simon Marlow

On 07/01/13 09:08, Simon Peyton-Jones wrote:

Which code is being discussed here, specifically?  The Cabal file for 'base' 
specifies a BSD3 license.


The question was about the extensible-exceptions package: 
http://hackage.haskell.org/package/extensible-exceptions


Cheers,
Simon



Simon

| -Original Message-
| From: cvs-ghc-boun...@haskell.org [mailto:cvs-ghc-boun...@haskell.org]
| On Behalf Of Ian Lynagh
| Sent: 06 January 2013 23:21
| To: Pavel Zelinsky
| Cc: Simon Marlow; cvs-ghc@haskell.org
| Subject: Re: Question about extensible-exceptions (to official
| extensible-exceptions maintainer - GHC HQ)
|
|
| [full mail quoted as it doesn't look like the original made it to the
| list]
|
| Hi Pavel,
|
| On Fri, Jan 04, 2013 at 05:08:15PM -0700, Pavel Zelinsky wrote:
| 
|  Dear Ian Lynagh and Simon Marlow,
| 
|  I working with our attorneys an clarifying the Extensible-Exceptions
|  license and I have a question.
| 
|  The license clearly states that code derived from Haskell 98 Report is
|  distributed under the Report license. At the same time, the Report
|  license and report itself does not specify code license, but rather
|  entire report license and modified report.
| 
|  So what we are trying to understand:
|  1) What specifically code was derived from the Report if any?
|
| I'm not a lawyer, so can't offer legal advice (and certainly I'm not
| qualified to say whether the extensible exceptions code would be
| considered to be derived from the more primitive exceptions API in the
| Haskell 98 report).
|
| But I wonder why it matters whether the extensible-exceptions code is
| under that licence, when anything using it presumably also uses base or
| haskell98, which both have the same licence? Unless perhaps you're
| porting it to a different language or something?
|
|  2) If the derived code was compiled with the following language in the
|  license: modified version is clearly presented as such, and that it
|  does not claim to be a definition of the Haskell 98 Language?
|  Same questions about the Haskell Foreign... license.
|
| I didn't follow that. Did you mean complies with rather than was
| compiled with? If so, I don't think that anyone would say that
| extensible-exceptions claims to be a definition of the Haskell 98
| Language (but again, I'm not a lawyer etc).
|
|  I'm attaching below excerpts from your license for your convenience.
| 
|  Also I'm copying you (see below) on the similar communication with
|  Milan Straka on Haskell_Containers license. Essentially Milan
|  responded that there is no part of source code of containers that is
|  derived from the Report or from Haskell Foreign Function Interface.
|  Also he changed the license, so it does not mention neither Haskell
|  Report nor Haskell FFI. I hope it is the same case with
|  Extensible-Exceptions, so confusion can be resolved.
| 
|  Thank you!
| 
|  Pavel Zelinsky
| 
|  Pavel Zelinsky
|  Senior Manager and Group Leader, DemandTec Softlines Science IBM
|  Enterprise Marketing Management
| 
| 
| 
| Phone: 1-303-800-4562
| IBM
| E-mail: pzeli...@us.ibm.com
|1 Franklin
| Parkway
|   San Mateo, CA
| 94403
| United
|  States
| 
| 
| 
|  Extensible-Exceptions license:
|  --
| ---
|* Code from the Haskell 98 Report which is (c) Simon Peyton Jones
|  and freely redistributable (but see the full license for
|  restrictions).
| 
|* Code from the Haskell Foreign Function Interface specification,
|  which is (c) Manuel M. T. Chakravarty and freely redistributable
|  (but see the full license for restrictions).
| 
|  --
|  ---
| 
|  Code from the Haskell 98 Report which is (c) Simon Peyton Jones
|  and freely redistributable (but see the full license for
|  restrictions).
| 
|* Code from the Haskell Foreign Function Interface specification,
|  which is (c) Manuel M. T. Chakravarty and freely redistributable
|  (but see the full license for restrictions).Code derived from the
|  document Report on the Programming Language Haskell 98, is
|  distributed under the following license:
| 
|Copyright (c) 2002 Simon Peyton Jones
| 
|The authors intend this Report to belong to the entire Haskell
|community, and so we grant permission to copy and distribute it for
|any purpose, provided that it is reproduced in its entirety,
|including this Notice.  Modified versions of this Report may also be
|copied and distributed for any purpose, provided that the modified
|version is clearly presented as such, and that it does not claim to
|be a definition of the Haskell 98 Language

[commit: ghc] master: make ./sync-all -r path remote set-url origin work (7d1216a)

2013-01-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/7d1216ab9b7e80a860de0498854883761d6e7d33

---

commit 7d1216ab9b7e80a860de0498854883761d6e7d33
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 21 15:06:11 2012 +

make ./sync-all -r path remote set-url origin work

---

 sync-all |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sync-all b/sync-all
index ce61346..0b29903 100755
--- a/sync-all
+++ b/sync-all
@@ -417,15 +417,21 @@ sub scmall {
 }
 elsif ($command eq remote) {
 my @scm_args;
+my $rpath;
 $ignore_failure = 1;
+if ($remotepath eq '-') {
+$rpath = $repo_base/$localpath;
+} else {
+$rpath = $path;
+}
 if ($subcommand eq 'add') {
-@scm_args = (remote, add, $branch_name, $path);
+@scm_args = (remote, add, $branch_name, $rpath);
 } elsif ($subcommand eq 'rm') {
 @scm_args = (remote, rm, $branch_name);
 } elsif ($subcommand eq 'set-branches') {
 @scm_args = (remote, set-branches, $branch_name);
 } elsif ($subcommand eq 'set-url') {
-@scm_args = (remote, set-url, $branch_name, $path);
+@scm_args = (remote, set-url, $branch_name, $rpath);
 }
 scm ($localpath, $scm, @scm_args, @args);
 }



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix bugs in allocMoreStack (#7498, #7510) (03d360f)

2013-01-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/03d360f289a1c7e93fedf8cfa274cbe5929cd32c

---

commit 03d360f289a1c7e93fedf8cfa274cbe5929cd32c
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Jan 7 12:26:29 2013 +

Fix bugs in allocMoreStack (#7498, #7510)

There were four bugs here.  Clearly I didn't test this enough to
expose the bugs - it appeared to work on x86/Linux, but completely by
accident it seems.

1. the delta was wrong by a factor of the slot size (as noted on #7498)

2. we weren't correctly aligning the stack pointer (sp needs to be
16-byte aligned on x86/x86_64)

3. we were doing the adjustment multiple times in the case of a block
that was both a return point and a local branch target.  To fix this I
had to add new shim blocks to adjust the stack pointer, and retarget
the original branches.  See comment for details.

4. we were doing the adjustment for CALL instructions, which is
unnecessary and wrong; only JMPs should be preceded by a stack
adjustment.

(Someone with a PPC box will need to update the PPC version of
allocMoreStack to fix the above bugs, using the x86 version as a
guide.)

 compiler/nativeGen/AsmCodeGen.lhs |   10 ++--
 compiler/nativeGen/PPC/Instr.hs   |7 +-
 compiler/nativeGen/X86/Instr.hs   |  124 +++--
 3 files changed, 99 insertions(+), 42 deletions(-)


Diff suppressed because of size. To see it, use:

git show 03d360f289a1c7e93fedf8cfa274cbe5929cd32c

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: STM faiure

2012-12-21 Thread Simon Marlow

On 21/12/12 12:15, Simon Peyton-Jones wrote:

Simon, I’m getting this validation failure on Linux.  Should I?


Sorry - fix coming. I have stm in my validate tree so it didn't fail for me.

Cheers,
Simon



Simon

Unexpected failures:

../../libraries/base/tests  qsemn001 [exit code non-0] (normal)

= qsemn001(normal) 3440 of 3517 [0, 0, 0]

cd ../../libraries/base/tests 
'/5playpen/simonpj/HEAD/inplace/bin/ghc-stage2' -fforce-recomp
-dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts
-fno-ghci-history -o qsemn001 qsemn001.hsqsemn001.comp.stderr 21

cd ../../libraries/base/tests  ./qsem001/dev/null
 qsem001.run.stdout 2qsem001.run.stderr

Compile failed (status 256) errors were:

qsemn001.hs:5:8:

 Could not find module `Control.Concurrent.STM'

 Perhaps you meant

   Control.Concurrent.QSem (from base)

   Control.Concurrent (from base)

   Control.Concurrent.Chan (from base)

 Use -v to see a list of the files searched for.




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Redirect asynchronous exceptions to the sandbox thread in runStmt (#1381) (02c4ab0)

2012-12-20 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/02c4ab049adeb77b8ee0e3b98fbf0f3026eee453

---

commit 02c4ab049adeb77b8ee0e3b98fbf0f3026eee453
Author: Simon Marlow marlo...@gmail.com
Date:   Thu Dec 20 09:18:49 2012 +

Redirect asynchronous exceptions to the sandbox thread in runStmt (#1381)

See comment for details.

We no longer use pushInterruptTargetThread/popInterruptTargetThread,
so these could go away in due course.

---

 compiler/main/InteractiveEval.hs |   43 -
 1 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index c5f35e5..7fa156a 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -333,9 +333,10 @@ traceRunStatus expr bindings final_ids
  status -
  withBreakAction True (hsc_dflags hsc_env)
   breakMVar statusMVar $ do
-   liftIO $ withInterruptsSentTo tid $ do
+   liftIO $ mask_ $ do
putMVar breakMVar ()  -- awaken the stopped thread
-   takeMVar statusMVar   -- and wait for the result
+   redirectInterrupts tid $
+ takeMVar statusMVar   -- and wait for the result
  traceRunStatus expr bindings final_ids
 breakMVar statusMVar status history'
  _other -
@@ -385,14 +386,39 @@ sandboxIO dflags statusMVar thing =
  in if gopt Opt_GhciSandbox dflags
 then do tid - forkIO $ do res - runIt
putMVar statusMVar res -- empty: can't block
-withInterruptsSentTo tid $ takeMVar statusMVar
+redirectInterrupts tid $
+  takeMVar statusMVar
+
 else -- GLUT on OS X needs to run on the main thread. If you
  -- try to use it from another thread then you just get a
  -- white rectangle rendered. For this, or anything else
  -- with such restrictions, you can turn the GHCi sandbox off
  -- and things will be run in the main thread.
+ --
+ -- BUT, note that the debugging features (breakpoints,
+ -- tracing, etc.) need the expression to be running in a
+ -- separate thread, so debugging is only enabled when
+ -- using the sandbox.
  runIt
 
+--
+-- While we're waiting for the sandbox thread to return a result, if
+-- the current thread receives an asynchronous exception we re-throw
+-- it at the sandbox thread and continue to wait.
+--
+-- This is for two reasons:
+--
+--  * So that ^C interrupts runStmt (e.g. in GHCi), allowing the
+--computation to run its exception handlers before returning the
+--exception result to the caller of runStmt.
+--
+--  * clients of the GHC API can terminate a runStmt in progress
+--without knowing the ThreadId of the sandbox thread (#1381)
+--
+redirectInterrupts :: ThreadId - IO a - IO a
+redirectInterrupts target wait
+  = wait `catch` \e - do throwTo target (e :: SomeException); wait
+
 -- We want to turn ^C into a break when -fbreak-on-exception is on,
 -- but it's an async exception and we only break for sync exceptions.
 -- Idea: if we catch and re-throw it, then the re-throw will trigger
@@ -417,12 +443,6 @@ rethrow dflags io = Exception.catch io $ \se - do
 
 Exception.throwIO se
 
-withInterruptsSentTo :: ThreadId - IO r - IO r
-withInterruptsSentTo thread get_result = do
-  bracket (pushInterruptTargetThread thread)
-  (\_ - popInterruptTargetThread)
-  (\_ - get_result)
-
 -- This function sets up the interpreter for catching breakpoints, and
 -- resets everything when the computation has stopped running.  This
 -- is a not-very-good way to ensure that only the interactive
@@ -495,10 +515,11 @@ resume canLogSpan step
withVirtualCWD $ do
 withBreakAction (isStep step) (hsc_dflags hsc_env)
 breakMVar statusMVar $ do
-status - liftIO $ withInterruptsSentTo tid $ do
+status - liftIO $ mask_ $ do
  putMVar breakMVar ()
   -- this awakens the stopped thread...
- takeMVar statusMVar
+ redirectInterrupts tid $
+   takeMVar statusMVar
   -- and wait for the result
 let prevHistoryLst = fromListBL 50 hist
 hist' = case info of



___
Cvs-ghc mailing list
Cvs-ghc

[commit: ghc] master: 'sync-all get -q' also passes -q to 'git submodule' (54a3963)

2012-12-20 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/54a3963196cc3146f01543514882efaa8506c543

---

commit 54a3963196cc3146f01543514882efaa8506c543
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Dec 19 10:13:09 2012 +

'sync-all get -q' also passes -q to 'git submodule'

---

 sync-all |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sync-all b/sync-all
index 225ad36..ce61346 100755
--- a/sync-all
+++ b/sync-all
@@ -773,21 +773,23 @@ sub main {
 
 scmall ($command, @_);
 
+my @submodule_args = grep(/^-q/,@_);
+
 if ($command eq get) {
-scm(., git, submodule, init);
+scm(., git, submodule, init, @submodule_args);
 }
 if ($command eq pull) {
 my $gitConfig = tryReadFile(.git/config);
 if ($gitConfig !~ /submodule/) {
-scm(., git, submodule, init);
+scm(., git, submodule, init, @submodule_args);
 }
 }
 if ($command eq get or $command eq pull) {
 my $gitConfig = tryReadFile(.git/config);
 if ($gitConfig !~ /submodule/) {
-scm(., git, submodule, init);
+scm(., git, submodule, init, @submodule_args);
 }
-scm(., git, submodule, update);
+scm(., git, submodule, update, @submodule_args);
 }
 }
 }



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: How to start with GHC development?

2012-12-19 Thread Simon Marlow

I like it, the table is much easier to understand.

I slightly preferred having the how to modify material on a separate 
page and under WorkingConventions, but as long as we link to these pages 
from the right places under WorkingConventions it should be ok.


Cheers,
Simon

On 19/12/12 12:40, Simon Peyton-Jones wrote:

Simon, Ian

OK, I have spent a much longer time than I intended editing our wiki pages.  
Can you look at

http://hackage.haskell.org/trac/ghc/wiki/Repositories
http://hackage.haskell.org/trac/ghc/wiki/Repositories/Upstream

The former is supposed to be the summary; the latter focuses on upstream repos.

They are supposed to subsume the current
WorkingConventions/Repositories
which I have not yet deleted.

I'm not 100% sure of the yes/no in the columns.


Thanks

Simon

| -Original Message-
| From: Simon Marlow [mailto:marlo...@gmail.com]
| Sent: 18 December 2012 16:40
| To: Simon Peyton-Jones
| Cc: Jan Stolarek; Ian Lynagh; glasgow-haskell-us...@haskell.org
| Subject: Re: How to start with GHC development?
|
| On 18/12/12 15:51, Simon Peyton-Jones wrote:
|  |  It seems that many informations in the wiki are duplicated. There
|  |  are two pages about
|  |  repositories:
|  |  http://hackage.haskell.org/trac/ghc/wiki/Repositories
|  |  http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions/Reposi
|  |  tori es (after reading the first one source tree started to make
|  |  much more sense - this is one of the informations *I* would like
|  |  to get first).
|  |
|  | The first page lists the repositories and where the upstreams and
|  | mirrors are.  The second page contains the conventions for working
|  | on other repositories (which is why it's under WorkingConventions).
| 
|  Simon, I don't find that a clear distinction. Looking at the two, I'm
| a bit confused too!
|
| So Repositories is what repositories there are, and
| WorkingConventions/Repositories is how to work on them.  Isn't that a
| clear distinction?
|
|  * The lists on WorkingConventions/Repositories duplicates the table in
| Repositories.
|
| There are two separate workflows, so we have to say which libraries each
| workflow applies to.  I'd be fine with merging this info with the other
| table - it might be slightly more awkward having the info on a separate
| page, but there would be only one list of repositories.
|
|  * I believe that perhaps WorkingConventions/Repositories is solely
| concerned with how to *modify* a library; it opening para says as much.
| Fine; but it shouldn't duplicate the info.
|
| Right.
|
|  Maybe the table could do with a column saying GHC or Upstream to
| specify the how to modify convention?  (I wish the table could somehow
| be narrower.  And that the library name was the first column.)  Perhaps
| the master table can look like this:
| 
|  What   GHC repo locationUpstream repo exists?
|  http://darcs.haskell.org/
| 
|  GHCghc.git
|  ghc-tarballs   ghc-tarballs.git
|  ...etc...
|  binary binary.git   YES
|  ...etc...
| 
|  Then we can deal with the complexities of upstream repos in another
| page.  I think that might put the info in a way that's easier to grok.
| I can do it if Simon and Ian agree; or Ian could.
|
| Ok by me.
|
| Cheers,
|   Simon




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Revert Fix a bug in the handling of nested orElse (55c55f1)

2012-12-18 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/55c55f141b8b312512cce1d7e0fbd3a8088de964

---

commit 55c55f141b8b312512cce1d7e0fbd3a8088de964
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Dec 18 08:43:29 2012 +

Revert Fix a bug in the handling of nested orElse

This reverts commit f184d9caffa09750ef6a374a7987b9213d6db28e.

The next commit will fix it in a better way.

---

 rts/STM.c |   24 +++-
 1 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/rts/STM.c b/rts/STM.c
index e7232b7..0a4d0b2 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -1460,28 +1460,10 @@ StgBool stmCommitNestedTransaction(Capability *cap, 
StgTRecHeader *trec) {

StgTVar *s;
s = e - tvar;
-
-// Careful! We might have a read entry here that we don't want
-// to spam over the update entry in the enclosing TRec.  e.g. in
-//
-//   t - newTVar 1
-//   writeTVar t 2
-//   ((readTVar t  retry) `orElse` return ()) `orElse` return ()
-//
-// - the innermost txn first aborts, giving us a read-only entry
-//   with e-expected_value == e-new_value == 1
-// - the inner orElse commits into the outer orElse, which
-//   lands us here.  If we unconditionally did
-//   merge_update_into(), then we would overwrite the outer
-//   TRec's update, so we must check whether the entry is an
-//   update or not, and if not, just do merge_read_into.
-//
-if (entry_is_update(e)) {
+   if (entry_is_update(e)) {
 unlock_tvar(cap, trec, s, e - expected_value, FALSE);
-merge_update_into(cap, et, s, e - expected_value, e - new_value);
-} else {
-merge_read_into(cap, et, s, e - expected_value);
-}
+   }
+   merge_update_into(cap, et, s, e - expected_value, e - new_value);
ACQ_ASSERT(s - current_value != (StgClosure *)trec);
   });
 } else {



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: A better fix for #7493 (see comment for details) (a006ecd)

2012-12-18 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a006ecdfd381fa75ab16ddb66c3a2b247f359eb8

---

commit a006ecdfd381fa75ab16ddb66c3a2b247f359eb8
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Dec 18 09:10:26 2012 +

A better fix for #7493 (see comment for details)

---

 rts/STM.c |   60 ++--
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/rts/STM.c b/rts/STM.c
index 0a4d0b2..62ced25 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -705,32 +705,56 @@ static void merge_update_into(Capability *cap,
 /*..*/
 
 static void merge_read_into(Capability *cap,
-   StgTRecHeader *t,
+StgTRecHeader *trec,
StgTVar *tvar,
-   StgClosure *expected_value) {
+StgClosure *expected_value)
+{
   int found;
+  StgTRecHeader *t;
   
-  // Look for an entry in this trec
   found = FALSE;
-  FOR_EACH_ENTRY(t, e, {
-StgTVar *s;
-s = e - tvar;
-if (s == tvar) {
-  found = TRUE;
-  if (e - expected_value != expected_value) {
-// Must abort if the two entries start from different values
-TRACE(%p : read entries inconsistent at %p (%p vs %p), 
-  t, tvar, e - expected_value, expected_value);
-t - state = TREC_CONDEMNED;
+
+  //
+  // See #7493
+  //
+  // We need to look for an existing entry *anywhere* in the stack of
+  // nested transactions.  Otherwise, in stmCommitNestedTransaction()
+  // we can't tell the difference between
+  //
+  //   (1) a read-only entry
+  //   (2) an entry that writes back the original value
+  //
+  // Since in both cases e-new_value == e-expected_value. But in (1)
+  // we want to do nothing, and in (2) we want to update e-new_value
+  // in the outer transaction.
+  //
+  // Here we deal with the first possibility: we never create a
+  // read-only entry in an inner transaction if there is an existing
+  // outer entry; so we never have an inner read and an outer update.
+  // So then in stmCommitNestedTransaction() we know we can always
+  // write e-new_value over the outer entry, because the inner entry
+  // is the most up to date.
+  //
+  for (t = trec; !found  t != NO_TREC; t = t - enclosing_trec)
+  {
+FOR_EACH_ENTRY(t, e, {
+  if (e - tvar == tvar) {
+found = TRUE;
+if (e - expected_value != expected_value) {
+// Must abort if the two entries start from different values
+TRACE(%p : read entries inconsistent at %p (%p vs %p),
+  t, tvar, e - expected_value, expected_value);
+t - state = TREC_CONDEMNED;
+}
+BREAK_FOR_EACH;
   } 
-  BREAK_FOR_EACH;
-}
-  });
+});
+  }
 
   if (!found) {
-// No entry so far in this trec
+// No entry found
 TRecEntry *ne;
-ne = get_new_entry(cap, t);
+ne = get_new_entry(cap, trec);
 ne - tvar = tvar;
 ne - expected_value = expected_value;
 ne - new_value = expected_value;



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Suggested policy: use declarative names for tests instead of increasing integers

2012-12-18 Thread Simon Marlow

On 18/12/12 12:33, Roman Cheplyaka wrote:

* Simon Peyton-Jones simo...@microsoft.com [2012-12-18 10:32:39+]

(This belongs on cvs-ghc, or the upcoming ghc-devs.)

| I find our tests to be quite hard to navigate, as the majority have
| names like tc12345.hs or some such. I suggest we instead use descriptive
| names like GADT.hs or PrimOps.hs instead. What do people think?

We've really moved to a naming convention connected to tickets. Thus test T7490 
is a test for Trac ticket #7490.  This is fantastic.  It eliminates the need 
for elaborate comments in the test to say what is being tested... just look at 
the ticket.

The old serially number tests tc032 etc are history.

If there isn't a corresponding ticket, it'd be a good idea to create one.

Increasingly we refer to tickets in source-code comments.  They are incredibly 
valuable resource to give the detail of what went wrong.

OK?  We should document this convention somewhere.


It is sort of documented at 
http://hackage.haskell.org/trac/ghc/wiki/Building/RunningTests/Adding

   Having found a suitable place for the test case, give the test case a
   name. For regression test cases, we often just name the test case
   after the bug number (e.g. T2047). Alternatively, follow the
   convention for the directory in which you place the test case: for
   example, in typecheck/should_compile, test cases are named tc001,
   tc002, and so on.

But I wonder what if one wants to create a test preventively (say, for a
new feature), and there isn't actually any bug to create a ticket for?


It wouldn't hurt to be more descriptive with test names than we are 
currently in e.g. codeGen and typechecker.  Some parts of the testsuite 
are better, e.g. see libraries/base/tests where the tests are named 
after the function being tested (sort of), or in codeGen/should_run_asm:


test('memcpy',
 unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
test('memcpy-unroll',
 unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
test('memcpy-unroll-conprop',
 unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])

ticket numbers are good names for regression tests, but for other tests 
more descriptive names would help. There isn't always a good name for a 
test, but often there is.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: PATCH: Rename cmmz flags for consistency

2012-12-18 Thread Simon Marlow
Ok with me too.  I should have cleaned this up at the time, but got into 
the habit of using -ddump-cmmz.


Cheers,
Simon

On 17/12/12 21:46, Simon Peyton-Jones wrote:

ok with me

|  -Original Message-
|  From: cvs-ghc-boun...@haskell.org [mailto:cvs-ghc-boun...@haskell.org] On
|  Behalf Of Austin Seipp
|  Sent: 17 December 2012 17:35
|  To: cvs-ghc
|  Subject: PATCH: Rename cmmz flags for consistency
|
|  Hi,
|
|  The attached patch renames the various '*-cmmz-*' flags to '*-cmm-*'
|  now that the new backend is live. It also fixes some inconsistencies; 
namely, there
|  were flags like -ddump-cmmz-rewrite, vs -ddump-cps-cmm, etc. Also, since the
|  new backend went live, '-ddump-cmm' was terribly
|  broken: it was only used when dumping out parsed C--, as the new pipeline 
used
|  -ddump-cmmz exclusively.
|
|  This patch mostly just makes all the flags consistent and removes the 
needless 'z'
|  suffix. It doesn't update the manual; the sub-flags were never mentioned, 
and -
|  ddump-cmm implies them all anyway.
|
|  --
|  Regards,
|  Austin


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Hoopl vs LLVM?

2012-12-13 Thread Simon Marlow

On 12/12/12 17:06, Greg Fitzgerald wrote:

On Wed, Dec 12, 2012 at 4:35 AM, Simon Marlow marlo...@gmail.com
mailto:marlo...@gmail.com wrote:

Now, all that LLVM knows is that z was read from Sp[8], it has no
more information about its value.


Are you saying Hoopl can deduce the original form from the CPS-version?
  Or that LLVM can't encode the original form?  Or within GHC, LLVM is
thrown in late in the game, where neither Hoopl nor LLVM can be of much use.


We can run Hoopl passes on the pre-CPS code, but LLVM only sees the 
post-CPS code.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Hoopl vs LLVM?

2012-12-13 Thread Simon Marlow

On 12/12/12 17:37, Johan Tibell wrote:

On Wed, Dec 12, 2012 at 4:35 AM, Simon Marlow marlo...@gmail.com wrote:

On 11/12/12 21:33, Johan Tibell wrote:

I'd definitely be interesting in understanding why as it, like you
say, makes it harder for LLVM to understand what our code does and
optimize it well.



The example that Simon gave is a good illustration:

snip


My question was more: why do we CPS transform? I guess it's because we
manage our own stack?


Right.  In fact, LLVM does its own CPS transform (but doesn't call it 
that) when the code contains non-tail function calls.  We give LLVM code 
with tail-calls only.


The choice about whether to manage our own stack is *very* deep, and has 
ramifications all over the system.  Changing it would mean a completely 
new backend and replacing a lot of the RTS, that is if you could find a 
good scheme for tracking pointers in the stack - I'm not sure LLVM is up 
to the job without more work.  It could probably be done, but it's a 
huge undertaking and it's not at all clear that you could do any better 
than GHC currently does.  We generate very good code from idiomatic 
Haskell; where we fall down is in heavy numerical and loopy code, where 
LLVM does a much better job.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: autoconfi warnings

2012-12-13 Thread Simon Marlow

On 13/12/12 10:30, Simon Peyton-Jones wrote:

| Is installing a newer version of msys/mingw an option? The version I
| have here has autoreconf version 2.68, which I expect would just work.

Interesting.  I had assumed that we used autoreconf from inplace/mingw/bin.  
But there is no autoreconf there.  So in fact the build system is using it from 
c:/mys/1.0/bin.  Is that right?

We had all these version-skew problems between MSYS and our build
system, which we beautifully resolved by including a tar-ball of
guaranteed-compatible msys binaries in the GHC source repo (and GHC
distributions).  The C compiler is there, the linker.  Why not
autoreconf??


All the build tools are installed separately, we only have the compiler 
tools in the repository.



I have been to the msys/mingw install page 
http://www.mingw.org/wiki/Getting_Started, downloaded mingw-get-inst, and run 
it.  It lets you decide what to install.

If you choose MSYS basic system you don't get autoreconf.
If you choose MSYS developer toolkit you do get autoreconf, in c:/mingw/bin. 
But you get a lot of other developer-toolkit stuff too.


The wiki page is up to date I think:

http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation/Windows

it tells you what to select, including the developer toolkit.  The 
installation process is pretty smooth (much better than it used to be).


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: autoconfi warnings

2012-12-13 Thread Simon Marlow

On 13/12/12 12:13, Simon Peyton-Jones wrote:

|  We had all these version-skew problems between MSYS and our build
|  system, which we beautifully resolved by including a tar-ball of
|  guaranteed-compatible msys binaries in the GHC source repo (and GHC
|  distributions).  The C compiler is there, the linker.  Why not
|  autoreconf??
|
| All the build tools are installed separately, we only have the compiler
| tools in the repository.

What build tools do you have in mind?  Apart from 'autoreconf'?

For example, the in-tree tarball (unpacked to inplace/mingw/bin) includes
gcc
ld
ar
as
cpp 
nm
ranlib
strip

What build tools do you expect to use from the user's mingw installation?  What 
is the downside of including all stuff that suffers version skew (of which 
autoreconf is an example), thus removing a road-block?  For example, maybe 
cygwin's autoreconf behaves slightly differently.


So the reason things are done this way is that you can choose your build 
environment between MSYS or Cygwin, but regardless which one of those 
you choose we always need the MinGW compiler tools, so we have tarballs 
of those in the tree.  Historically there were lots of problems with the 
build system picking up the wrong bits of MinGW from various places, so 
having fixed versions in the tree solves all that.


The tools that come from MSYS or Cygwin include make, autoconf, and of 
course the shell and all the shell tools.  It might be possible to put 
some of these as tarballs in the tree, and maybe that would be a good 
idea, though we would have to be careful about mixing Cygwin and MSYS 
tools since they use different pathname conventions.  Maybe you want to 
grab a complete MSYS and put it all in the tree, and forget about 
Cygwin.  That's a possibility, though I think we hang onto Cygwin 
because MSYS can't build the docs properly (I don't remember the details 
of this).


It is definitely a version problem you have?  I don't remember having 
any version difficulties with autoconf for quite a while, since around 
version 2.5.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Make enabled_capabilities visible (fixes dynamic linking) (265af43)

2012-12-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/265af43ffd4411f4fced30ac866ef6bb49efec6c

---

commit 265af43ffd4411f4fced30ac866ef6bb49efec6c
Author: Simon Marlow marlo...@gmail.com
Date:   Thu Dec 13 22:18:49 2012 +

Make enabled_capabilities visible (fixes dynamic linking)

---

 includes/rts/Threads.h |3 +++
 rts/Capability.h   |3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/includes/rts/Threads.h b/includes/rts/Threads.h
index 60d9bc4..2ebc542 100644
--- a/includes/rts/Threads.h
+++ b/includes/rts/Threads.h
@@ -57,6 +57,9 @@ HsBool rtsSupportsBoundThreads (void);
 // The number of Capabilities
 extern unsigned int n_capabilities;
 
+// The number of Capabilities that are not disabled
+extern nat enabled_capabilities;
+
 #if !IN_STG_CODE
 extern Capability MainCapability;
 #endif
diff --git a/rts/Capability.h b/rts/Capability.h
index 1b3c06f..3348f88 100644
--- a/rts/Capability.h
+++ b/rts/Capability.h
@@ -207,8 +207,7 @@ INLINE_HEADER void releaseCapability_ (Capability* cap 
STG_UNUSED,
 
 // declared in includes/rts/Threads.h:
 // extern nat n_capabilities;
-
-extern nat enabled_capabilities;
+// extern nat enabled_capabilities;
 
 // Array of all the capabilities
 //



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Remove most of TailCalls.h (2b977d9)

2012-12-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2b977d98a0f15416721633f14f9f551ce9ad30f0

---

commit 2b977d98a0f15416721633f14f9f551ce9ad30f0
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Dec 11 16:53:24 2012 +

Remove most of TailCalls.h

it was only needed for registerised compilation.

---

 includes/Stg.h   |7 +-
 includes/stg/TailCalls.h |  185 --
 2 files changed, 3 insertions(+), 189 deletions(-)

diff --git a/includes/Stg.h b/includes/Stg.h
index ba0c4cf..c451cbc 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -217,12 +217,11 @@ typedef StgFunPtr   F_;
 
 /* 
-
Tail calls
-
-   This needs to be up near the top as the register line on alpha needs
-   to be before all procedures (inline  out-of-line).
-- 
*/
 
-#include stg/TailCalls.h
+#define JMP_(cont) return((StgFunPtr)(cont))
+#define FB_
+#define FE_
 
 /* 
-
Other Stg stuff...
diff --git a/includes/stg/TailCalls.h b/includes/stg/TailCalls.h
deleted file mode 100644
index 77ceb0c..000
--- a/includes/stg/TailCalls.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/* 
-
- *
- * (c) The GHC Team, 1998-2009
- *
- * Stuff for implementing proper tail jumps.
- *
- * Do not #include this file directly: #include Rts.h instead.
- *
- * To understand the structure of the RTS headers, see the wiki:
- *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
- *
- * 
---*/
-
-#ifndef TAILCALLS_H
-#define TAILCALLS_H
-
-/* 
-
-   Unmangled tail-jumping: use the mini interpretter.
-   -- 
*/
-
-#ifdef USE_MINIINTERPRETER
-
-#define JMP_(cont) return((StgFunPtr)(cont))
-#define FB_
-#define FE_
-
-#else
-
-extern void __DISCARD__(void);
-
-/* 
-
-   Tail calling on x86
-   -- 
*/
-
-#if i386_HOST_ARCH
-
-/* Note about discard: possibly there to fool GCC into clearing up
-   before we do the jump eg. if there are some arguments left on the C
-   stack that GCC hasn't popped yet.  Also possibly to fool any
-   optimisations (a function call often acts as a barrier).  Not sure
-   if any of this is necessary now -- SDM
-
-   Comment to above note: I don't think the __DISCARD__() in JMP_ is 
-   necessary.  Arguments should be popped from the C stack immediately
-   after returning from a function, as long as we pass -fno-defer-pop
-   to gcc.  Moreover, a goto to a first-class label acts as a barrier 
-   for optimisations in the same way a function call does. 
-   -= chak
-   */
-
-/* The goto here seems to cause gcc -O2 to delete all the code after
-   it - including the FE_ marker and the epilogue code - exactly what
-   we want! -- SDM
-   */
-
-#define JMP_(cont) \
-{  \
-  void *__target;  \
-  __DISCARD__();   \
-  __target = (void *)(cont);   \
-  goto *__target;  \
-}
-
-#endif /* i386_HOST_ARCH */
-
-/* 
-
-   Tail calling on x86_64
-   -- 
*/
-
-#if x86_64_HOST_ARCH
-
-/*
-  NOTE about __DISCARD__():
-
-  On x86_64 this is necessary to work around bugs in the register
-  variable support in gcc.  Without the __DISCARD__() call, gcc will
-  silently throw away assignements to global register variables that
-  happen before the jump.
-
-  Here's the example:
-
-  extern void g(void);
-  static void f(void) {
-R1 = g;
-__DISCARD__()
-goto *R1;
-  }
-
-  without the dummy function call, gcc throws away the assignment to R1
-  (gcc 3.4.3) gcc bug #20359.
-*/
-
-#define JMP_(cont) \
-{  \
-  __DISCARD__();   \
-  goto *(void *)(cont);\
-}
-
-#endif /* x86_64_HOST_ARCH */
-
-/* 
-
-   Tail calling on Sparc
-   -- 
*/
-
-#ifdef sparc_HOST_ARCH
-
-#define JMP_(cont) ((F_) (cont

Re: Hoopl vs LLVM?

2012-12-12 Thread Simon Marlow

On 11/12/12 21:33, Johan Tibell wrote:

On Tue, Dec 11, 2012 at 11:16 AM, Simon Peyton-Jones
simo...@microsoft.com wrote:

Notice that the stack is now *explicit* rather than implicit, and LLVM has no 
hope of moving the assignment to z past the call to g (which is trivial in the 
original).  I can explain WHY we do this (there is stuff on the wiki) but the 
fact is that we do, and it's no accident.


I'd definitely be interesting in understanding why as it, like you
say, makes it harder for LLVM to understand what our code does and
optimize it well.


The example that Simon gave is a good illustration:

f() {
x = blah
z = blah2
p,q = g(x)
res = z + p - q
return res
}

In this function, for example, a Hoopl pass would be able to derive 
something about the value of z from its assignment (blah2), and use that 
information in the assignment to res, e.g. for constant propagation, or 
more powerful partial value optimisations.


However, the code that LLVM sees will look like this:

f () {
x = blah
z = blah2
Sp[8] = z
jump g(x)
}

fr1( p,q ) {
z = Sp[8];
res = z + p - q
return res
}

Now, all that LLVM knows is that z was read from Sp[8], it has no more 
information about its value.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Which of the following PrimTyCons have a pointer-sized representations

2012-12-12 Thread Simon Marlow

On 11/12/12 21:31, Johan Tibell wrote:

On Tue, Dec 11, 2012 at 1:02 PM, Simon Peyton-Jones
simo...@microsoft.com wrote:

|  data T = MkT !S
|  data S = MkS Int
|  
|   then my impl will unbox the S field of MkT because the result is only one 
field
|  wide, namely an Int.
|
|  Wouldn't Johan's have unboxed S too?  (if not, I misunderstood what he did)

No, that would change the semantics!  We don't want to do that.


I think Simon M meant that my change would have unpacked the field of
*type* S in the MkT constructor. We must not unpack the field in the
MkS constructor.


Correct, sorry for not being clear enough.


|  I'm happy to call this -funbox-strict-small-fields. However, I'd like
|  the documentation to talk about pointer-sized things as that, even
|  though a bit operational sounding, has a clear meaning in my mind.

I'm somewhat inclined to *change* the current flag so that

 -funbox-strict-fields means unbox small fields
 -funbox-all-strict-fields means unbox ALL strict fields


Lets go with -funbox-small-strict-fields to avoid unnecessary
breakages. If we end up enabling this flag by default eventually it
doesn't really matter what the name is as people will never type it
out explicitly.


+1

There are lots of users of the existing flag, we don't want to change 
its meaning.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Which of the following PrimTyCons have a pointer-sized representations

2012-12-11 Thread Simon Marlow

On 11/12/12 12:29, Simon Peyton-Jones wrote:

Johan,

Well, I started to review your patch.  And then I re-discovered how horribly 
messy that code is; with independent decisions taken in the desugarer, MkId, 
and TcTyClsDcls, all of which must line up.

So I totally refactored everything which cost me a couple of days (because it 
has quite wide span).  I'm validating now.

I realise that unbox-strict-fields means unbox it if it's strict, whereas your new 
unbox-strict-primitive-fields is the same but a bit less aggressive:
unbox it if it's strict, AND the unboxed version
 is at most one word wide
Where a Float or Double count as one word.

So I changed it to ...AND the unboxed version is at most one field wide.  
That is we get one field not 2 or 10.  So consider


What is a field?



data T = MkT !S
data S = MkS Int

then my impl will unbox the S field of MkT because the result is only one field 
wide, namely an Int.


Wouldn't Johan's have unboxed S too?  (if not, I misunderstood what he did)


It would be easy to also restrict to *primitive* types, but it seems mildly 
beneficial not to.

However the flag is then a mis-nomer.


Right, I had been wondering whether -funbox-strict-small-fields or 
something would make a better name, since it isn't restricted to 
primitive types.


Cheers,
Simon





I'll commit shortly and you can look

Simon

| -Original Message-
| From: Johan Tibell [mailto:johan.tib...@gmail.com]
| Sent: 07 December 2012 22:10
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-users
| Subject: Re: Which of the following PrimTyCons have a pointer-sized
| representations
|
| On Fri, Dec 7, 2012 at 10:48 AM, Johan Tibell johan.tib...@gmail.com
| wrote:
|  On Fri, Dec 7, 2012 at 3:36 AM, Simon Peyton-Jones
|  simo...@microsoft.com wrote:
|  You can use TyCon.tyConPrimRep, followed by primRepSizeW
| 
|  Looking at primRepSizeW I see that the only PrimRep that is bigger
|  than one word is Doubles, Int64s, and Word64s on 32-bit platforms.
|  Manuel (I think wisely) suggested that we should make an exception for
|  these types and unpack them on 32-bit platforms if
|  -funbox-strict-primitive-fields is set, even thought technically they
|  will occupy more space than a pointer. The reasoning is that we want
|  to avoid surprising behavior when users move code between 32-bit and
|  64-bit platforms, as e.g. unpacking vs not-unpacking Doubles can make
|  a large difference in certain tight loops.
| 
|  But this means that checking the size in can_unbox_prim is no longer
|  necessary, so I could remove that check. This does mean that if we
|  ever add a new PrimTyCon that has a size that's larger than a pointer,
|  the implementation of -funbox-strict-primitive-fields has to change.
| 
|  The alternative would be for me to add
| 
|  primRepSizeForUnboxW :: PrimRep - Int
|  primRepSizeForUnboxW IntRep   = 1
|  primRepSizeForUnboxW WordRep  = 1
|  primRepSizeForUnboxW Int64Rep = 1-- [Note: Primitive size
| exception]
|  primRepSizeForUnboxW Word64Rep= 1-- [Note: Primitive size
| exception]
|  primRepSizeForUnboxW FloatRep = 1-- NB. might not take a full word
|  primRepSizeForUnboxW DoubleRep= 1-- [Note: Primitive size
| exception]
|  primRepSizeForUnboxW AddrRep  = 1
|  primRepSizeForUnboxW PtrRep   = 1
|  primRepSizeForUnboxW VoidRep  = 0
| 
|  And use that function in can_unbox_prim. That way we'd get a pattern
|  match warning if we ever add a new PrimRep (and thus need to evaluate
|  if PrimTyCons with that PrimRep should be unpacked by
|  -funbox-strict-primitive-fields).
|
| I went with the latter approach as it seems safer.
|
| -- Johan

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: document special this syntax for PackageImports (#7409) (b0339aa)

2012-12-11 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b0339aa1e298c700c849813fbd16b29c92e27055

---

commit b0339aa1e298c700c849813fbd16b29c92e27055
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Dec 11 09:20:24 2012 +

document special this syntax for PackageImports (#7409)

---

 docs/users_guide/glasgow_exts.xml |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/docs/users_guide/glasgow_exts.xml 
b/docs/users_guide/glasgow_exts.xml
index 6d549b8..825ef65 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -1999,6 +1999,9 @@ import network Network.Socket
 available from multiple packages, or is present in both the
 current package being built and an external package./para
 
+  paraThe special package name literalthis/literal can be used to
+refer to the current package being built./para
+
   paraNote: you probably don't need to use this feature, it was
 added mainly so that we can build backwards-compatible versions of
 packages when APIs change.  It can lead to fragile dependencies in



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: add enabled_capabilities (#7491) (d684114)

2012-12-11 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d68411496b1cad0e2e912875f32457372b5c2fcd

---

commit d68411496b1cad0e2e912875f32457372b5c2fcd
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Dec 11 15:38:00 2012 +

add enabled_capabilities (#7491)

---

 rts/Linker.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index 3e169fd..fa1de89 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1310,6 +1310,7 @@ typedef struct _RtsSymbolVal {
   SymI_NeedsProto(rts_stop_on_exception)\
   SymI_HasProto(stopTimer)  \
   SymI_HasProto(n_capabilities) \
+  SymI_HasProto(enabled_capabilities)   \
   SymI_HasProto(stg_traceCcszh) \
   SymI_HasProto(stg_traceEventzh)   \
   SymI_HasProto(stg_traceMarkerzh)  \



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix a bug in the handling of nested orElse (f184d9c)

2012-12-10 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f184d9caffa09750ef6a374a7987b9213d6db28e

---

commit f184d9caffa09750ef6a374a7987b9213d6db28e
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Dec 10 12:00:54 2012 +

Fix a bug in the handling of nested orElse

Exposed by the following snippet, courtesy of Bas van Dijk and Patrick
Palka on librar...@haskell.org:

import Control.Concurrent.STM
main = do
  x - atomically $ do
 t - newTVar 1
 writeTVar t 2
 ((readTVar t  retry) `orElse` return ()) `orElse` return ()
 readTVar t
  print x

---

 rts/STM.c |   24 +---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/rts/STM.c b/rts/STM.c
index 0a4d0b2..e7232b7 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -1460,10 +1460,28 @@ StgBool stmCommitNestedTransaction(Capability *cap, 
StgTRecHeader *trec) {

StgTVar *s;
s = e - tvar;
-   if (entry_is_update(e)) {
+
+// Careful! We might have a read entry here that we don't want
+// to spam over the update entry in the enclosing TRec.  e.g. in
+//
+//   t - newTVar 1
+//   writeTVar t 2
+//   ((readTVar t  retry) `orElse` return ()) `orElse` return ()
+//
+// - the innermost txn first aborts, giving us a read-only entry
+//   with e-expected_value == e-new_value == 1
+// - the inner orElse commits into the outer orElse, which
+//   lands us here.  If we unconditionally did
+//   merge_update_into(), then we would overwrite the outer
+//   TRec's update, so we must check whether the entry is an
+//   update or not, and if not, just do merge_read_into.
+//
+if (entry_is_update(e)) {
 unlock_tvar(cap, trec, s, e - expected_value, FALSE);
-   }
-   merge_update_into(cap, et, s, e - expected_value, e - new_value);
+merge_update_into(cap, et, s, e - expected_value, e - new_value);
+} else {
+merge_read_into(cap, et, s, e - expected_value);
+}
ACQ_ASSERT(s - current_value != (StgClosure *)trec);
   });
 } else {



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Make nativeCodeGen return the rest of its UniqSupply (6bdac1c)

2012-12-07 Thread Simon Marlow

On 06/12/12 21:52, Ian Lynagh wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6bdac1c375dc754ad3a540f704437650b43474c1


---


commit 6bdac1c375dc754ad3a540f704437650b43474c1
Author: Ian Lynagh i...@well-typed.com
Date:   Thu Dec 6 19:34:27 2012 +

 Make nativeCodeGen return the rest of its UniqSupply


I just wanted to mention I think it's important to do the code 
generation on a function-by-function basis, ie. generate both static  
dynamic code for one CmmGroup, before going onto the next one.  This way 
we keep the heap profile flat.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: testsuite] master: Add test for -funbox-strict-primitive-fields (b2c5047)

2012-12-07 Thread Simon Marlow

On 07/12/12 05:31, Johan Tibell wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b2c5047da15f0b6441db7e615a84ce64d0f77890


---


commit b2c5047da15f0b6441db7e615a84ce64d0f77890
Author: Johan Tibell johan.tib...@gmail.com
Date:   Thu Dec 6 11:26:38 2012 -0800

 Add test for -funbox-strict-primitive-fields


---


  .../should_compile/UnboxStrictPrimitiveFields.hs   |   28 
  tests/typecheck/should_compile/all.T   |1 +
  2 files changed, 29 insertions(+), 0 deletions(-)

diff --git 
a/tests/ghc-regress/typecheck/should_compile/UnboxStrictPrimitiveFields.hs 
b/tests/ghc-regress/typecheck/should_compile/UnboxStrictPrimitiveFields.hs


I don't think you wanted to add this file to 
tests/ghc-regress/typecheck/..., it should go in tests/typecheck/...


Cheers,
Simon



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix description of ghci instance env bug (e4feb52)

2012-12-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/e4feb52d88d7c1ba44f3ebbdc94d7c909b81ac71

---

commit e4feb52d88d7c1ba44f3ebbdc94d7c909b81ac71
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 7 10:35:13 2012 +

fix description of ghci instance env bug

---

 docs/users_guide/bugs.xml |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/docs/users_guide/bugs.xml b/docs/users_guide/bugs.xml
index ca0f65f..4ff99e2 100644
--- a/docs/users_guide/bugs.xml
+++ b/docs/users_guide/bugs.xml
@@ -514,17 +514,6 @@ checking for duplicates.  The reason for this is 
efficiency, pure and simple.
   /listitem
 
   listitem
-   paraGHC does not keep careful track of
-   what instance declarations are 'in scope' if they come from other 
packages.
-Instead, all instance declarations that GHC has seen in other
-packages are all in scope everywhere, whether or not the
-module from that package is used by the command-line
-expression.  This bug affects only the option--make/option mode and
- GHCi./para
-  /listitem
-
-
-  listitem
 paraOn 32-bit x86 platforms when using the native code
 generator, the
 
option-fexcess-precision/optionindextermprimaryoption-fexcess-precision/option/primary/indexterm
 option
@@ -588,6 +577,17 @@ Loading package javavm ... linking ... WARNING: Overflown 
relocation field (# re
   your package into two or more .o's, along the lines of
   how the base package does it./para
   /listitem
+
+  listitem
+para
+  GHCi does not keep careful track of what instance
+  declarations are 'in scope' if they come from other
+  packages.  Instead, all instance declarations that GHC has
+  seen in other packages are all available at the prompt,
+  whether or not the instance really ought to be in visible
+  given the current set of modules in scope.
+/para
+  /listitem
 /itemizedlist
   /sect2
   /sect1



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix code in library initialisation example (#7471) (250f026)

2012-12-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/250f02687eb6dc56394f1c6e9c4cc0aaa34b

---

commit 250f02687eb6dc56394f1c6e9c4cc0aaa34b
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 7 10:35:40 2012 +

fix code in library initialisation example (#7471)

---

 docs/users_guide/ffi-chap.xml |   28 
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/docs/users_guide/ffi-chap.xml b/docs/users_guide/ffi-chap.xml
index e778c03..a2fe177 100644
--- a/docs/users_guide/ffi-chap.xml
+++ b/docs/users_guide/ffi-chap.xml
@@ -446,21 +446,25 @@ typedef enum {
   implemented in C or C++.  For example:/para
 
 programlisting
- HsBool mylib_init(void){
-   int argc = ...
-   char *argv[] = ...
+#include lt;stdlib.hgt;
+#include HsFFI.h
+
+HsBool mylib_init(void){
+  int argc = 2;
+  char *argv[] = { +RTS, -A32m, NULL };
+  char **pargv = argv;
 
-   // Initialize Haskell runtime
-   hs_init(amp;argc, amp;argv);
+  // Initialize Haskell runtime
+  hs_init(amp;argc, amp;pargv);
 
-   // do any other initialization here and
-   // return false if there was a problem
-   return HS_BOOL_TRUE;
- }
+  // do any other initialization here and
+  // return false if there was a problem
+  return HS_BOOL_TRUE;
+}
 
- void mylib_end(void){
-   hs_exit();
- }
+void mylib_end(void){
+  hs_exit();
+}
 /programlisting
 
 paraThe initialisation routine, literalmylib_init/literal, calls



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Invalidate the ModSummary cache in setSessionDynFlags (#7478) (27770ae)

2012-12-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/27770ae5c5ebd16d9f6cc4574e0f75c395e12720

---

commit 27770ae5c5ebd16d9f6cc4574e0f75c395e12720
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 7 12:05:29 2012 +

Invalidate the ModSummary cache in setSessionDynFlags (#7478)

---

 compiler/main/GHC.hs |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index bdfe5e6..008a38d 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -498,6 +498,7 @@ setSessionDynFlags dflags = do
   (dflags', preload) - liftIO $ initPackages dflags
   modifySession $ \h - h{ hsc_dflags = dflags'
  , hsc_IC = (hsc_IC h){ ic_dflags = dflags' } }
+  invalidateModSummaryCache
   return preload
 
 -- | Sets the program 'DynFlags'.
@@ -505,8 +506,34 @@ setProgramDynFlags :: GhcMonad m = DynFlags - m 
[PackageId]
 setProgramDynFlags dflags = do
   (dflags', preload) - liftIO $ initPackages dflags
   modifySession $ \h - h{ hsc_dflags = dflags' }
+  invalidateModSummaryCache
   return preload
 
+-- When changing the DynFlags, we want the changes to apply to future
+-- loads, but without completely discarding the program.  But the
+-- DynFlags are cached in each ModSummary in the hsc_mod_graph, so
+-- after a change to DynFlags, the changes would apply to new modules
+-- but not existing modules; this seems undesirable.
+--
+-- Furthermore, the GHC API client might expect that changing
+-- log_action would affect future compilation messages, but for those
+-- modules we have cached ModSummaries for, we'll continue to use the
+-- old log_action.  This is definitely wrong (#7478).
+--
+-- Hence, we invalidate the ModSummary cache after changing the
+-- DynFlags.  We do this by tweaking the date on each ModSummary, so
+-- that the next downsweep will think that all the files have changed
+-- and preprocess them again.  This won't necessarily cause everything
+-- to be recompiled, because by the time we check whether we need to
+-- recopmile a module, we'll have re-summarised the module and have a
+-- correct ModSummary.
+--
+invalidateModSummaryCache :: GhcMonad m = m ()
+invalidateModSummaryCache =
+  modifySession $ \h - h { hsc_mod_graph = map inval (hsc_mod_graph h) }
+ where
+  inval ms = ms { ms_hs_date = addUTCTime (-1) (ms_hs_date ms) }
+
 -- | Returns the program 'DynFlags'.
 getProgramDynFlags :: GhcMonad m = m DynFlags
 getProgramDynFlags = getSessionDynFlags



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: add test for #7478 (fd681c4)

2012-12-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/fd681c4ff2f82c7d40ed09ec6dd8d39577ab9f24

---

commit fd681c4ff2f82c7d40ed09ec6dd8d39577ab9f24
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 7 12:08:28 2012 +

add test for #7478

---

 tests/ghc-api/T7478/A.hs |6 
 tests/ghc-api/T7478/B.hs |4 ++
 tests/ghc-api/T7478/C.hs |4 ++
 tests/ghc-api/T7478/Makefile |   11 +++
 tests/ghc-api/T7478/T7478.hs |   61 ++
 tests/ghc-api/T7478/T7478.stdout |8 +
 tests/ghc-api/T7478/all.T|2 +
 7 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/tests/ghc-api/T7478/A.hs b/tests/ghc-api/T7478/A.hs
new file mode 100644
index 000..bea1b1a
--- /dev/null
+++ b/tests/ghc-api/T7478/A.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import B
+
+main :: IO ()
+main = B.b  42
diff --git a/tests/ghc-api/T7478/B.hs b/tests/ghc-api/T7478/B.hs
new file mode 100644
index 000..2c71d18
--- /dev/null
+++ b/tests/ghc-api/T7478/B.hs
@@ -0,0 +1,4 @@
+module B where
+
+b :: IO ()
+b = return ()
diff --git a/tests/ghc-api/T7478/C.hs b/tests/ghc-api/T7478/C.hs
new file mode 100644
index 000..d82a4bd
--- /dev/null
+++ b/tests/ghc-api/T7478/C.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = return ()
diff --git a/tests/ghc-api/T7478/Makefile b/tests/ghc-api/T7478/Makefile
new file mode 100644
index 000..1afb16d
--- /dev/null
+++ b/tests/ghc-api/T7478/Makefile
@@ -0,0 +1,11 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean:
+   rm -f *.o *.hi
+
+T7478: clean
+   '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T7478.hs
+   ./T7478 `'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`
+
diff --git a/tests/ghc-api/T7478/T7478.hs b/tests/ghc-api/T7478/T7478.hs
new file mode 100644
index 000..15c3559
--- /dev/null
+++ b/tests/ghc-api/T7478/T7478.hs
@@ -0,0 +1,61 @@
+{-# LANGUAGE NamedFieldPuns #-}
+module Main (main) where
+
+import Data.List ((\\))
+import Control.Monad (void)
+import System.Environment
+
+import GHC
+import qualified Config as GHC
+import qualified Outputable as GHC
+import GhcMonad (liftIO)
+import Outputable (PprStyle, qualName, qualModule)
+
+compileInGhc :: [FilePath]  -- ^ Targets
+ - (String - IO ())   -- ^ handler for each SevOutput message
+ - Ghc ()
+compileInGhc targets handlerOutput = do
+-- Set flags
+flags0 - getSessionDynFlags
+let flags = flags0 {verbosity = 1, log_action = collectSrcError 
handlerOutput}
+setSessionDynFlags flags
+-- Set up targets.
+oldTargets - getTargets
+let oldFiles = map fileFromTarget oldTargets
+mapM_ addSingle (targets \\ oldFiles)
+mapM_ (removeTarget . targetIdFromFile) $ oldFiles \\ targets
+-- Load modules to typecheck
+void $ load LoadAllTargets
+  where
+targetIdFromFile file = TargetFile file Nothing
+
+addSingle filename =
+  addTarget Target
+{ targetId   = targetIdFromFile filename
+, targetAllowObjCode = True
+, targetContents = Nothing
+}
+
+fileFromTarget Target{targetId} =
+  case targetId of
+TargetFile file Nothing - file
+_ - error fileFromTarget: not a known target
+
+collectSrcError handlerOutput flags SevOutput _srcspan style msg
+  = handlerOutput $ GHC.showSDocForUser flags (qualName style,qualModule 
style) msg
+collectSrcError _ _ _ _ _ _
+  = return ()
+
+main :: IO ()
+main = do
+  [libdir] - getArgs
+  runGhc (Just libdir) $ do
+
+  liftIO $ putStrLn - 0 --
+  compileInGhc [A.hs, B.hs] $ \msg - print (0 :: Int, msg)
+
+  liftIO $ putStrLn - 1 --
+  compileInGhc [A.hs, B.hs] $ \msg - print (1 :: Int, msg)
+
+  liftIO $ putStrLn - 2 --
+  compileInGhc [C.hs] $ \msg - print (2 :: Int, msg)
diff --git a/tests/ghc-api/T7478/T7478.stdout b/tests/ghc-api/T7478/T7478.stdout
new file mode 100644
index 000..372cf9b
--- /dev/null
+++ b/tests/ghc-api/T7478/T7478.stdout
@@ -0,0 +1,8 @@
+- 0 --
+(0,[1 of 2] Compiling B( B.hs, B.o ))
+(0,[2 of 2] Compiling Main ( A.hs, A.o ))
+- 1 --
+(1,[2 of 2] Compiling Main ( A.hs, A.o ))
+- 2 --
+(2,[1 of 1] Compiling Main ( C.hs, C.o ))
+(2,Linking A ...)
diff --git a/tests/ghc-api/T7478/all.T b/tests/ghc-api/T7478/all.T
new file mode 100644
index 000..5ba40f0
--- /dev/null
+++ b/tests/ghc-api/T7478/all.T
@@ -0,0 +1,2 @@
+test('T7478', extra_clean(['A','A.exe','B.o','B.hi','C.o','C.hi']), 
run_command, ['$MAKE -s --no-print-directory T7478'])
+



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org

[commit: testsuite] master: delete stray file (e0ba47a)

2012-12-07 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/e0ba47a68f095a8f563eaab9717754ec0fd8761c

---

commit e0ba47a68f095a8f563eaab9717754ec0fd8761c
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Dec 7 12:08:37 2012 +

delete stray file

---

 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/ghci/T5545.stdout b/tests/ghci/T5545.stdout
deleted file mode 100644
index e69de29..000



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: HEAD can't find stg_gc_ut

2012-12-06 Thread Simon Marlow
It looks like you have an old syb package installed in your .cabal/lib, 
getting rid of that should fix it.


Cheers,
Simon

On 06/12/12 13:53, Simon Peyton-Jones wrote:

Simon, Ian, anyone

I’m getting this on today’s  HEAD:

~/5builds/HEAD/inplace/bin/ghc-stage2 --make T7445.hs -package syb

[1 of 2] Compiling T7445a   ( T7445a.hs, T7445a.o )

[2 of 2] Compiling T7445( T7445.hs, T7445.o )

Loading package ghc-prim ... linking ... done.

Loading package integer-gmp ... linking ... done.

Loading package base ... linking ... done.

Loading package syb-0.3.7 ... linking ... ghc-stage2:
/home/simonpj/.cabal/lib/syb-0.3.7/ghc-7.7/HSsyb-*0.3.7.o: unknown
symbol `stg_gc_ut'*

ghc-stage2: unable to load package `syb-0.3.7'

simonpj@cam-05-unx:~/tmp$

Indeed, that symbol is generated in StgCmmHeap (line 631). But it
doesn’t seem to be defined anywhere in the RTS.  Things like stg_gc_pp
are defined in Linker.c

Any ideas?

Simon




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: HEAD can't find stg_gc_ut

2012-12-06 Thread Simon Marlow
One thing you can do to make this less likely to happen is to make sure 
the build system can see your .git directory, then it will give your 
build a dated version like 7.7.20121206 instead of just 7.7.  Then any 
packages you install won't clash with older ones.  Or alternatively use 
cabal-dev to install packages in a sandbox.


Cheers,
Simon

On 06/12/12 15:17, Simon Peyton-Jones wrote:

OK SimonM helped me past this.  Just for your info

* The code generator does not actually mention stg_gc_ut; that
   is in commented-out code.

* TH was loading HSsyb-0.3.7.o, which was an old .o file created back in
   August.  I'd just installed syb, but cabal had created libHSsyb-0.3.7.a.
   Sadly TH ignored the new .a and took the old .o.

Solution: delete the out of date .o file.

Simon

| -Original Message-
| From: Simon Marlow [mailto:marlo...@gmail.com]
| Sent: 06 December 2012 14:41
| To: Simon Peyton-Jones
| Cc: cvs-ghc@haskell.org
| Subject: Re: HEAD can't find stg_gc_ut
|
| It looks like you have an old syb package installed in your .cabal/lib,
| getting rid of that should fix it.
|
| Cheers,
|   Simon
|
| On 06/12/12 13:53, Simon Peyton-Jones wrote:
|  Simon, Ian, anyone
| 
|  I'm getting this on today's  HEAD:
| 
|  ~/5builds/HEAD/inplace/bin/ghc-stage2 --make T7445.hs -package syb
| 
|  [1 of 2] Compiling T7445a   ( T7445a.hs, T7445a.o )
| 
|  [2 of 2] Compiling T7445( T7445.hs, T7445.o )
| 
|  Loading package ghc-prim ... linking ... done.
| 
|  Loading package integer-gmp ... linking ... done.
| 
|  Loading package base ... linking ... done.
| 
|  Loading package syb-0.3.7 ... linking ... ghc-stage2:
|  /home/simonpj/.cabal/lib/syb-0.3.7/ghc-7.7/HSsyb-*0.3.7.o: unknown
|  symbol `stg_gc_ut'*
| 
|  ghc-stage2: unable to load package `syb-0.3.7'
| 
|  simonpj@cam-05-unx:~/tmp$
| 
|  Indeed, that symbol is generated in StgCmmHeap (line 631). But it
|  doesn't seem to be defined anywhere in the RTS.  Things like stg_gc_pp
|  are defined in Linker.c
| 
|  Any ideas?
| 
|  Simon
| 




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: The end of an era, and the dawn of a new one

2012-12-06 Thread Simon Marlow

On 06/12/12 15:08, Johan Tibell wrote:

On Dec 6, 2012 4:39 AM, Simon Peyton-Jones simo...@microsoft.com
mailto:simo...@microsoft.com wrote:
 
  (Narrowing to cvs-ghc for now.)
 
  Speaking for myself, I would welcome a code-ownership model along the
lines that Ben suggests. If it works well it would
a) spread the load
b) broaden a genuine sense of ownership
c) because of (a) and (b), perhaps encourage more people to participate
 
  What do others think?

Sounds like a good idea.


Yes, I think it's a great idea.  I'm happy to be listed as the owner for 
my bits for the time being, until/unless others are able to take over.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Stop attempting to trim data types in interface files (9a20e54)

2012-12-06 Thread Simon Marlow

On 06/12/12 16:03, Simon Peyton Jones wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9a20e540754fc2af74c2e7392f2786a81d8d5f11


---


commit 9a20e540754fc2af74c2e7392f2786a81d8d5f11
Author: Simon Peyton Jones simo...@microsoft.com
Date:   Thu Dec 6 16:03:16 2012 +

 Stop attempting to trim data types in interface files

 Without -O, we previously tried to make interface files smaller
 by not including the data constructors of data types.  But
 there are a lot of exceptions, notably when Template Haskell is
 involved or, more recently, DataKinds.

 However Trac #7445 shows that even without TemplateHaskell, using
 the Data class and invoking Language.Haskell.TH.Quote.dataToExpQ
 is enough to require us to expose the data constructors.

 So I've given up on this optimisation -- it's probably not
 important anyway.  Now I'm simply not attempting to trim off
 the data constructors.  The gain in simplicity is worth the
 modest cost in interface file growth, which is limited to the
 bits reqd to describe those data constructors.


That's a shame - it wasn't so much a reduction in interface file size we 
gained by doing this, but less recompilation.  Oh well...


Cheers,
Simon



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Add :info! to GHCi. This shows all instances without filtering first. (2ec32a8)

2012-12-04 Thread Simon Marlow

On 03/12/12 20:13, Iavor Diatchki wrote:

Hello,

On Mon, Dec 3, 2012 at 8:44 AM, Simon Marlow marlo...@gmail.com
mailto:marlo...@gmail.com wrote:

OI know that Accessor has an Applicative instace because the operations

work.  I'd like to find the instance, so I can see how it works,
so I try:


Ok, so this is a bug: you shouldn't be able to use the instance
because it isn't in scope.  If this was a source file, then GHC
would complain that the instance was not in scope.

The bug is (sort of) documented in the Known Bugs section of the
user guide, although the documentation incorrectly says that it also
affects --make, which it doesn't (I'll fix it).


I don't think that this is the bug to blame: the instance is in scope,
it is just that it is being filtered by :info.
Here is an example:

module Test where

import Control.Applicative (pure)
import Control.Lens

example :: Accessor () ()
example = pure ()

This works just fine.  I think the issue is as follows.  The
`Applicative` instance for `Accessor` is like this:

instance Monoid r = Applicative (Accessor r)

Now, on the GHCi command line `Accessor` and `Applicative` are in scope
but `Monoid` is not.  However, there are instances of `Monoid` for
various datatypes (e.g., ()) that are also in scope, so that instance is
actually usable.


Ah, I see.  Sp that suggests a better fix: the new :info! should display 
all instances that are in scope, in contrast to the ordinary :info which 
displays only instances involving types and classes that are in scope.



As far as I understand, the current plausiblity check filters out any
instances that contain tycons that are not in-scope, which is why this
particular instance does not show up.  It looks like in some cases this
is too aggressive.

So I don't really object to having this feature, as long as we say
clearly in the documentation that it doesn't have a well-specified
behaviour, and the instances it shows may or may not actually be
available. (if we fix the bug, many of them won't be available, but
it might be useful to find out where to get them from).

Would you mind updating the docs, and close #5998?

Yeah, I'd be happy to do that.  Which documentation should I update?


The GHCi docs (docs/users_guide/ghci.xml) to add the new command.

Cheers,
Simon




-Iavor




Cheers,
 Simon



Prelude Control.Applicative Control.Lens :i Accessor
newtype Accessor r a
= Control.Lens.Internal.Accessor
{Control.Lens.Internal.__runAccessor :: r}
-- Defined in `Control.Lens.Internal'
instance Functor (Accessor r) -- Defined in `Control.Lens.Internal'
instance Gettable (Accessor r)
-- Defined in `Control.Lens.Internal’

Weird, it doesn’t show up, so what are the instances of
`Applicative`?

Prelude Control.Applicative Control.Lens :i Applicative
class Functor f = Applicative f where
pure :: a - f a
(*) :: f (a - b) - f a - f b
(*) :: f a - f b - f b
(*) :: f a - f b - f a
-- Defined in `Control.Applicative'
instance Applicative [] -- Defined in `Control.Applicative'
instance Applicative ZipList -- Defined in `Control.Applicative'
instance Monad m = Applicative (WrappedMonad m)
-- Defined in `Control.Applicative'
instance Applicative Maybe -- Defined in `Control.Applicative'
instance Applicative IO -- Defined in `Control.Applicative'
instance Applicative (Either e) -- Defined in `Control.Applicative'
instance Applicative ((-) a) -- Defined in `Control.Applicative'
instance Applicative Mutator -- Defined in `Control.Lens.Internal'
instance Applicative (Bazaar a b)
-- Defined in `Control.Lens.Internal’

It does not show up, but I'm sure that there is an instance as the
operations seem to work! It turns out that the only way to find the
instance is to not only already know that there is one and
import the
appropriate module, but to also import the modules used in the
context.
But if I already knew all of this I wouldn't have asked GHCi.

Prelude Control.Applicative Control.Lens import Data.Monoid
Prelude Control.Applicative Control.Lens Data.Monoid :i Accessor
newtype Accessor r a
= Control.Lens.Internal.Accessor
{Control.Lens.Internal.__runAccessor :: r}
-- Defined in `Control.Lens.Internal'
instance Functor (Accessor r) -- Defined in `Control.Lens.Internal'
*instance Monoid r = Applicative (Accessor r)*

-- Defined in `Control.Lens.Internal'
instance Gettable (Accessor r)
-- Defined in `Control.Lens.Internal'

In contrast, with :info! we get everything that GHCi knows
about, so
it is quite easy

Re: Include a new boot library

2012-12-04 Thread Simon Marlow

On 03/12/12 17:30, Mattias Lundell wrote:

Hi,

I have spent a couple of hours this weekend trying to include an extra
boot library to GHC. My aim is to experiment with the LLVM FFI
bindings as code generator instead of the text representation.


Great!


Unfortunately I am stuck in the build process. I am able to build GHC
HEAD from git and I am able to build the LLVM FFI bindings. The
problem begins when the GHC's build process tries to build the LLVM
FFI bindings. I have separated the llvm-base library and put it into
the libraries directory of GHC, I have imported a module that is
exported from the llvm-base package, I have added llvm-base to the
files: 'compiler/ghc.cabal.in http://ghc.cabal.in/', 'packages' and
'ghc.mk http://ghc.mk/'.

But I am stuck with the message:

make[1]: *** No rule to make target `cbits/extra.cpp', needed by
`libraries/llvm-base/dist-install/build/libHSllvm-base-3.0.1.0.a'.  Stop.

This is my first time hacking on GHC and the build process is new to
me.  My question is if I have forgotten something or if the problem is
in llvm-base.


Is cbits/extra.cpp built from something else?  Does llvm-base have some 
custom Cabal stuff that the GHC build system doesn't know about, maybe?


Something you'll probably run into is that the build system doesn't have 
rules for building .cpp files (C++).  You can add these by cut and 
pasting from the .c rules, which can be found in 
rules/c-suffix-rules.mk.  I'm not sure whether the .cpp files will make 
it into the *_C_SRCS variable, if not there might be other changes 
needed.  Have a look in your libraries/llvm-base/dist-install/package.mk.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Make sync-all pull --rebase work (3a40456)

2012-12-03 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3a40456f9befa1f3c4a83480f76f44f2babfafb9

---

commit 3a40456f9befa1f3c4a83480f76f44f2babfafb9
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Dec 3 09:35:37 2012 +

Make sync-all pull --rebase work

By filtering out the --rebase when fetching submodules

---

 sync-all |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sync-all b/sync-all
index efb84a6..9aa40d5 100755
--- a/sync-all
+++ b/sync-all
@@ -380,15 +380,19 @@ sub scmall {
 }
 elsif ($command eq pull) {
 my $realcmd;
+my @realargs;
 if ($remotepath eq -) {
 # Only fetch for the submodules. git submodule update
 # will take care of making us point to the right commit.
 $realcmd = fetch;
+# we like sync-all pull --rebase to work:
+@realargs = grep(!/--rebase/,@args);
 }
 else {
 $realcmd = pull;
+@realargs = @args;
 }
-scm ($localpath, $scm, $realcmd, @args);
+scm ($localpath, $scm, $realcmd, @realargs);
 }
 elsif ($command eq new-workdir) {
 gitNewWorkdir ($localpath, @args);



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Add :info! to GHCi. This shows all instances without filtering first. (2ec32a8)

2012-12-03 Thread Simon Marlow

On 30/11/12 18:25, Iavor Diatchki wrote:

Hello Simon,
there was no discussion because I thought that this would be completely
uncontroversial since: (i) it does not change the current behavior, and
(ii) it adds new functionality which is quite useful.
Here is the use case that motivated me to implement this (described by
Eric Mertens, cc-ed on this e-mail).  The example uses the `lens` package.

I know that Accessor has an Applicative instace because the operations
work.  I'd like to find the instance, so I can see how it works, so I try:


Ok, so this is a bug: you shouldn't be able to use the instance because 
it isn't in scope.  If this was a source file, then GHC would complain 
that the instance was not in scope.


The bug is (sort of) documented in the Known Bugs section of the user 
guide, although the documentation incorrectly says that it also affects 
--make, which it doesn't (I'll fix it).


So I don't really object to having this feature, as long as we say 
clearly in the documentation that it doesn't have a well-specified 
behaviour, and the instances it shows may or may not actually be 
available. (if we fix the bug, many of them won't be available, but it 
might be useful to find out where to get them from).


Would you mind updating the docs, and close #5998?

Cheers,
Simon




Prelude Control.Applicative Control.Lens :i Accessor
newtype Accessor r a
   = Control.Lens.Internal.Accessor {Control.Lens.Internal.runAccessor :: r}
-- Defined in `Control.Lens.Internal'
instance Functor (Accessor r) -- Defined in `Control.Lens.Internal'
instance Gettable (Accessor r)
   -- Defined in `Control.Lens.Internal’

Weird, it doesn’t show up, so what are the instances of `Applicative`?

Prelude Control.Applicative Control.Lens :i Applicative
class Functor f = Applicative f where
   pure :: a - f a
   (*) :: f (a - b) - f a - f b
   (*) :: f a - f b - f b
   (*) :: f a - f b - f a
-- Defined in `Control.Applicative'
instance Applicative [] -- Defined in `Control.Applicative'
instance Applicative ZipList -- Defined in `Control.Applicative'
instance Monad m = Applicative (WrappedMonad m)
   -- Defined in `Control.Applicative'
instance Applicative Maybe -- Defined in `Control.Applicative'
instance Applicative IO -- Defined in `Control.Applicative'
instance Applicative (Either e) -- Defined in `Control.Applicative'
instance Applicative ((-) a) -- Defined in `Control.Applicative'
instance Applicative Mutator -- Defined in `Control.Lens.Internal'
instance Applicative (Bazaar a b)
   -- Defined in `Control.Lens.Internal’

It does not show up, but I'm sure that there is an instance as the
operations seem to work! It turns out that the only way to find the
instance is to not only already know that there is one and import the
appropriate module, but to also import the modules used in the context.
But if I already knew all of this I wouldn't have asked GHCi.

Prelude Control.Applicative Control.Lens import Data.Monoid
Prelude Control.Applicative Control.Lens Data.Monoid :i Accessor
newtype Accessor r a
   = Control.Lens.Internal.Accessor {Control.Lens.Internal.runAccessor :: r}
-- Defined in `Control.Lens.Internal'
instance Functor (Accessor r) -- Defined in `Control.Lens.Internal'
*instance Monoid r = Applicative (Accessor r)*
   -- Defined in `Control.Lens.Internal'
instance Gettable (Accessor r)
   -- Defined in `Control.Lens.Internal'

In contrast, with :info! we get everything that GHCi knows about, so
it is quite easy to figure out what's going on.

-Iavor





On Fri, Nov 30, 2012 at 3:42 AM, Simon Marlow marlo...@gmail.com
mailto:marlo...@gmail.com wrote:

On 30/11/12 02:03, Iavor Diatchki wrote:

Repository : ssh://darcs.haskell.org//srv/__darcs/ghc
http://darcs.haskell.org//srv/darcs/ghc

On branch  : master


http://hackage.haskell.org/__trac/ghc/changeset/__2ec32a8e1cb323b230b0c228dbee31__3647892bf4

http://hackage.haskell.org/trac/ghc/changeset/2ec32a8e1cb323b230b0c228dbee313647892bf4

--__--__---


commit 2ec32a8e1cb323b230b0c228dbee31__3647892bf4
Author: Iavor S. Diatchki diatc...@galois.com
mailto:diatc...@galois.com
Date:   Thu Nov 29 17:14:48 2012 -0800

  Add :info! to GHCi.  This shows all instances without
filtering first.

  The default behavior of :info is to show only those
instances of
  for a type, where all relevant type constructor names are
in scope.
  This keeps down the number of instances shown to the user.

  In some cases, it is nice to be able to see all instances
for a type.
  This patch implements this with the :info! command.


Was there some discussion about this?  The last I remember was this:

http://hackage.haskell.org/__trac/ghc/ticket/5998
http://hackage.haskell.org/trac/ghc/ticket/5998

where we decided

Re: [commit: ghc] master: Add :info! to GHCi. This shows all instances without filtering first. (2ec32a8)

2012-11-30 Thread Simon Marlow

On 30/11/12 02:03, Iavor Diatchki wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2ec32a8e1cb323b230b0c228dbee313647892bf4


---


commit 2ec32a8e1cb323b230b0c228dbee313647892bf4
Author: Iavor S. Diatchki diatc...@galois.com
Date:   Thu Nov 29 17:14:48 2012 -0800

 Add :info! to GHCi.  This shows all instances without filtering first.

 The default behavior of :info is to show only those instances of
 for a type, where all relevant type constructor names are in scope.
 This keeps down the number of instances shown to the user.

 In some cases, it is nice to be able to see all instances for a type.
 This patch implements this with the :info! command.


Was there some discussion about this?  The last I remember was this:

http://hackage.haskell.org/trac/ghc/ticket/5998

where we decided not to implement this because it is essentially a 
random UI: the behaviour can't be described sensibly because it depends 
on which interface files GHC happens to have seen so far.


There's also this:

http://hackage.haskell.org/trac/ghc/ticket/3080

which looks like a duplicate (I just closed it).

Cheers,
Simon



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix #7231: don't unload stable modules when there is an error later (086d7c5)

2012-11-27 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/086d7c54f5bddbc9e5d94a9ae9c4b5aeeab53a35

---

commit 086d7c54f5bddbc9e5d94a9ae9c4b5aeeab53a35
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Nov 27 08:55:31 2012 +

Fix #7231: don't unload stable modules when there is an error later

---

 compiler/main/GhcMake.hs |   17 -
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 62ac63f..cc51e05 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -239,11 +239,18 @@ load how_much = do
 stable_mg = 
 [ AcyclicSCC ms
 | AcyclicSCC ms - full_mg,
-  ms_mod_name ms `elem` stable_obj++stable_bco,
-  ms_mod_name ms `notElem` [ ms_mod_name ms' | 
-AcyclicSCC ms' - partial_mg ] ]
-
-mg = stable_mg ++ partial_mg
+  ms_mod_name ms `elem` stable_obj++stable_bco ]
+ 
+-- the modules from partial_mg that are not also stable
+-- NB. also keep cycles, we need to emit an error message later
+unstable_mg = filter not_stable partial_mg
+  where not_stable (CyclicSCC _) = True
+not_stable (AcyclicSCC ms)
+   = ms_mod_name ms `notElem` stable_obj++stable_bco
+
+-- Load all the stable modules first, before attempting to load
+-- an unstable module (#7231).
+mg = stable_mg ++ unstable_mg
 
 -- clean up between compilations
 let cleanup hsc_env = intermediateCleanTempFiles dflags



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: test for #7231 (7326c95)

2012-11-27 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/7326c95b12c414084b69328429a38ac666876a21

---

commit 7326c95b12c414084b69328429a38ac666876a21
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Nov 27 08:54:38 2012 +

test for #7231

---

 tests/ghci/prog012/Bar1.hs |1 +
 tests/ghci/prog012/Bar2.hs |3 +++
 tests/ghci/prog012/Foo.hs  |3 +++
 tests/ghci/prog012/Main.hs |4 
 .../should_compile = ghci/prog012}/Makefile   |0 
 tests/ghci/prog012/all.T   |2 ++
 tests/ghci/prog012/prog012.script  |   18 ++
 tests/ghci/prog012/prog012.stderr  |2 ++
 .../prog012/prog012.stdout}|0 
 9 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tests/ghci/prog012/Bar1.hs b/tests/ghci/prog012/Bar1.hs
new file mode 100644
index 000..9d63afd
--- /dev/null
+++ b/tests/ghci/prog012/Bar1.hs
@@ -0,0 +1 @@
+module Bar where
diff --git a/tests/ghci/prog012/Bar2.hs b/tests/ghci/prog012/Bar2.hs
new file mode 100644
index 000..755b8e8
--- /dev/null
+++ b/tests/ghci/prog012/Bar2.hs
@@ -0,0 +1,3 @@
+module Bar where
+
+bar = nonexistent
diff --git a/tests/ghci/prog012/Foo.hs b/tests/ghci/prog012/Foo.hs
new file mode 100644
index 000..03884ff
--- /dev/null
+++ b/tests/ghci/prog012/Foo.hs
@@ -0,0 +1,3 @@
+module Foo where
+
+foo = foo
diff --git a/tests/ghci/prog012/Main.hs b/tests/ghci/prog012/Main.hs
new file mode 100644
index 000..d49d063
--- /dev/null
+++ b/tests/ghci/prog012/Main.hs
@@ -0,0 +1,4 @@
+module Main where
+
+import Foo
+import Bar
diff --git a/tests/annotations/should_compile/Makefile 
b/tests/ghci/prog012/Makefile
similarity index 100%
copy from tests/annotations/should_compile/Makefile
copy to tests/ghci/prog012/Makefile
diff --git a/tests/ghci/prog012/all.T b/tests/ghci/prog012/all.T
new file mode 100644
index 000..c4aa9ca
--- /dev/null
+++ b/tests/ghci/prog012/all.T
@@ -0,0 +1,2 @@
+test('prog012', extra_clean(['Bar.hs']), ghci_script, ['prog012.script'])
+
diff --git a/tests/ghci/prog012/prog012.script 
b/tests/ghci/prog012/prog012.script
new file mode 100644
index 000..49af938
--- /dev/null
+++ b/tests/ghci/prog012/prog012.script
@@ -0,0 +1,18 @@
+:l ../shell.hs
+:def shell (\s - do shell s; return )
+:l
+
+-- example from #7231, modified: the example in the ticket did not
+-- trigger the bug, because a module containing only '' will fail
+-- in the downsweep, which is before we unload modules.  Hence this
+-- repro case uses a module that contains an unbound identifier and
+-- fails in the renamer.
+
+:shell cp Bar1.hs Bar.hs
+
+:load Main.hs
+:shell sleep 1
+:shell cp Bar2.hs Bar.hs
+
+:reload
+foo
diff --git a/tests/ghci/prog012/prog012.stderr 
b/tests/ghci/prog012/prog012.stderr
new file mode 100644
index 000..71f2bbe
--- /dev/null
+++ b/tests/ghci/prog012/prog012.stderr
@@ -0,0 +1,2 @@
+
+Bar.hs:3:7: Not in scope: `nonexistent'
diff --git a/tests/typecheck/should_run/tcrun026.stdout 
b/tests/ghci/prog012/prog012.stdout
similarity index 100%
copy from tests/typecheck/should_run/tcrun026.stdout
copy to tests/ghci/prog012/prog012.stdout



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [nightly] 21-Nov-2012 build of HEAD (unreg) on x86_64-unknown-linux (cam-04-unx)

2012-11-23 Thread Simon Marlow

On 21/11/2012 20:47, GHC Build Reports wrote:


The last 30 lines of 
/64playpen/simonmar/nightly/HEAD-unreg-cam-04-unx/logs/x86_64-unknown-linux-stage2
 are



3% (  2 / 63) in 'GHC.Tuple'
0% (  0 /  3) in 'GHC.Debug'
0% (  0 /336) in 'GHC.PrimopWrappers'
   36% (150 /422) in 'GHC.Prim'
  100% (  3 /  3) in 'GHC.Magic'
*** Core Lint warnings : in result of Desugar (after optimization) ***
{-# LINE 99 libraries/ghc-prim/GHC/Classes.hs #-}: Warning:
 [RHS of $c/=_a75U :: GHC.Types.Float
  - GHC.Types.Float - GHC.Types.Bool]
 INLINE binder is (non-rule) loop breaker: $c/=_a75U
{-# LINE 102 libraries/ghc-prim/GHC/Classes.hs #-}: Warning:
 [RHS of $c/=_a75N :: GHC.Types.Double
  - GHC.Types.Double - GHC.Types.Bool]
 INLINE binder is (non-rule) loop breaker: $c/=_a75N
{-# LINE 85 libraries/ghc-prim/GHC/Classes.hs #-}: Warning:
 [RHS of $c/=_a76i :: forall a_a5HG.
  GHC.Classes.Eq a_a5HG =
  [a_a5HG] - [a_a5HG] - GHC.Types.Bool]
 INLINE binder is (non-rule) loop breaker: $c/=_a76i

/64playpen/simonmar/nightly/HEAD-unreg-cam-04-unx/x86_64-unknown-linux/libraries/integer-gmp/dist-install/build/GHC/Integer/Type.hi
Declaration for $fEqInteger:
   attempting to use module `ghc-prim:GHC.Classes' 
(libraries/ghc-prim/./GHC/Classes.hs) which is not loaded
   38% (  6 / 16) in 'GHC.Classes'
Cannot continue after interface file error
make[1]: *** 
[libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock] Error 1
make: *** [all] Error 2


I don't know what's causing this error in the unregisterised build - it 
looks like some kind of build-system problem though.  Ian if you had a 
chance to look into it that would be great.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: build system woes in master

2012-11-23 Thread Simon Marlow

On 22/11/2012 19:38, Ian Lynagh wrote:

On Wed, Nov 21, 2012 at 02:28:24PM -0500, Ben Gamari wrote:


Any thoughts about what might be going on with any of the above?


FWIW, I think that some of your problems probably stem from using an old
cabal-install compiled against an old Cabal, which assumes that -static
is the default and so doesn't say -static -prof when trying to build
static profiling libraries.

But you're right that we should fix the prof_dyn way, we should also
give Cabal a flag to build it.


I think it's important that (a) -prof still works (without needing an 
extra -static) and (b) --enable-library-profiling builds libraries that 
you can use -prof with.  Ian, what's your plan here? To use prof_dyn?


Also, I see that the new Cabal is building both dynamic and static ways 
by default, I wonder whether we should make it just build the dynamic 
way (to save compile-time for people who don't need the static way, 
which should be most people).


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [Haskell-iPhone] GHC as a cross-compiler

2012-11-19 Thread Simon Marlow
I just wanted to mention that there's cross-compilation work going on in 
parallel on the GHC repo: Gabor Greif has been working on 
cross-compilation and Ian is currently working on integrating it.  I 
believe that everyone is working towards the same goal and so ultimately 
there shouldn't be any conflict, although it probably does mean that 
Stephen's work won't integrate cleanly with later GHC versions.


You guys should talk to each other ;-)

Cheers,
Simon


On 18/11/2012 21:29, Stephen Blackheath [to GHC-iPhone] wrote:

Stephen,

The best starting point for our GHC-iOS compiler is
https://github.com/ghc-ios/ghc/wiki

Yes, the GHC wiki CrossCompilation page is a bit out of date. I had
promised to fix it up, but I haven't yet.

I've had some cross-compile related changes integrated into GHC HEAD,
and they made it possible to build on a generic embedded Debian.

There are some more changes that you'll find in GHC-iOS that are also
needed for general cross compiling. About a week ago I decided to start
getting these things integrated, but I haven't found the time just yet.
So, very soon I'll be getting the more general changes pushed into GHC
HEAD.

Here is a very brief starting point. Here's our config.sh:

. env.sh
CPPFLAGS=$TARGET_CPPFLAGS CFLAGS=$TARGET_CFLAGS
LDFLAGS=$TARGET_LDFLAGS ./configure \
 --with-local-gcc=/usr/bin/gcc \
 --target=arm-apple-darwin10 \
 --with-alien=`pwd`/alien \
 --prefix=/usr/local/ghc-iphone/

To turn on the cross compiler, you have to say (in our case)
--target=arm-apple-darwin10

You will also need to provide an alien script. What 'alien' does is to
compile something for the target in such a way that we can run it
locally. This can be using qemu, or by copying the executable over to a
real system and capturing the console output. In our case, we compile it
using the iPhone simulator compiler.

As I mentioned, some of the patches in our ghc-ios repo you will need. I
suggest you start by taking the diff between the ios branch and head. I
am not very good at git yet so I can't tell you the exact command.

As for how complex is it? If the architecture you're using is
supported in GHC and the target is POSIX-based, the job should mostly
involve applying some of the fixes in our repo, which are mostly
makefile ones. (I don't know anything about the Blackberry.)

These are basically the same patches I'll be trying to get integrated
first, so you could wait for me to get some of that work done if you like.


Steve

On 18/11/12 05:07, Stephen Paul Weber wrote:

Hello all,

I'm interested in getting a GHC cross-compiler going for the new
QNX-based BlackBerry 10 OS launching in the new year, but the
documentation on GHC as cross-compiler
http://hackage.haskell.org/trac/ghc/wiki/CrossCompilation is pretty
sparse and contradictory.  You guys seem to be doing it.  How complex is
it?  Where should I start looking for information about the
configuration I'll need in the build system, etc?  Do I need to know a
lot about autotools hacking to get anywhere?

Thanks,



___
iPhone mailing list
iph...@haskell.org
http://www.haskell.org/mailman/listinfo/iphone



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: base] master: GHC.Windows: more error support (guards, system error strings) (62c6793)

2012-11-19 Thread Simon Marlow

On 18/11/2012 01:10, Joey Adams wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/62c6793dfa242166206ad85c62d4296630756e61


---


commit 62c6793dfa242166206ad85c62d4296630756e61
Author: Joey Adams joeyadams3.14...@gmail.com
Date:   Mon Nov 12 21:48:08 2012 -0500


Please welcome Joey Adams as our latest committer.  He's working on 
implementing a Windows I/O manager.  For more details see:


http://hackage.haskell.org/trac/ghc/ticket/7353

Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: C backend: put the entry block first (31c0717)

2012-11-19 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/31c07174b34e999d69870b04cba5780f6d842ada

---

commit 31c07174b34e999d69870b04cba5780f6d842ada
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 19 13:06:41 2012 +

C backend: put the entry block first

---

 compiler/cmm/PprC.hs |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index ed99855..f323097 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -102,7 +102,7 @@ pprTop (CmmProc infos clbl _ graph) =
rbrace ]
 )
   where
-blocks = toBlockList graph
+blocks = toBlockListEntryFirst graph
 (temp_decls, extern_decls) = pprTempAndExternDecls blocks
 
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix bug in previous commit, 65e46f144f3d8b18de7264b0b099086153c68d6c (97dc57c)

2012-11-16 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/97dc57c6e2bdbddd0a0170a283149a570a07179c

---

commit 97dc57c6e2bdbddd0a0170a283149a570a07179c
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Nov 14 10:12:56 2012 +

fix bug in previous commit, 65e46f144f3d8b18de7264b0b099086153c68d6c

---

 rts/sm/Sanity.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index a760e57..fb6a857 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -510,7 +510,7 @@ checkTSO(StgTSO *tso)
 }
 
 next = tso-_link;
-info = (const StgInfoTable*) tso-header.info;
+info = (const StgInfoTable*) tso-_link-header.info;
 
 ASSERT(next == END_TSO_QUEUE ||
info == stg_MVAR_TSO_QUEUE_info ||



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Add a write barrier for TVAR closures (6d784c4)

2012-11-16 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/6d784c43592290ec16db8b7f0f2a012dff3ed497

---

commit 6d784c43592290ec16db8b7f0f2a012dff3ed497
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Nov 16 09:22:00 2012 +

Add a write barrier for TVAR closures

This improves GC performance when there are a lot of TVars in the
heap.  For instance, a TChan with a lot of elements causes a massive
GC drag without this patch.

There's more to do - several other STM closure types don't have write
barriers, so GC performance when there are a lot of threads blocked on
STM isn't great.  But fixing the problem for TVar is a good start.

 includes/rts/storage/ClosureTypes.h |   37 +-
 includes/stg/MiscClosures.h |3 +-
 rts/ClosureFlags.c  |5 +-
 rts/Exception.cmm   |2 +-
 rts/LdvProfile.c|1 +
 rts/Linker.c|3 +
 rts/PrimOps.cmm |2 +-
 rts/Printer.c   |   14 +++
 rts/ProfHeap.c  |3 +-
 rts/RetainerProfile.c   |5 ++-
 rts/STM.c   |   63 ++
 rts/STM.h   |2 +-
 rts/Schedule.c  |2 +-
 rts/StgMiscClosures.cmm |7 ++-
 rts/sm/Compact.c|1 +
 rts/sm/Evac.c   |   12 ++---
 rts/sm/GC.c |   22 +-
 rts/sm/GC.h |8 +++-
 rts/sm/Sanity.c |1 +
 rts/sm/Scav.c   |   73 +--
 rts/sm/Storage.c|9 
 rts/sm/Storage.h|3 +-
 22 files changed, 209 insertions(+), 69 deletions(-)


Diff suppressed because of size. To see it, use:

git show 6d784c43592290ec16db8b7f0f2a012dff3ed497

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: C backend: ignore MO_Touch (a70e45f)

2012-11-16 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a70e45f5d28449698677cc165ec09bf6151078a4

---

commit a70e45f5d28449698677cc165ec09bf6151078a4
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Nov 16 14:03:49 2012 +

C backend: ignore MO_Touch

---

 compiler/cmm/PprC.hs |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index 4e73ade..ed99855 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -230,6 +230,8 @@ pprStmt stmt =
 pprCall cast_fn cconv hresults hargs  semi)
 -- for a dynamic call, no declaration is necessary.
 
+CmmUnsafeForeignCall (PrimTarget MO_Touch) _results _args - empty
+
 CmmUnsafeForeignCall target@(PrimTarget op) results args -
 proto $$ fn_call
   where



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix syntax error in generated C (#7407) (80269ef)

2012-11-16 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/80269ef4899252e22319e9223b6c50df5600ccd3

---

commit 80269ef4899252e22319e9223b6c50df5600ccd3
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Nov 16 13:54:52 2012 +

fix syntax error in generated C (#7407)

---

 compiler/cmm/PprC.hs |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index 1fe3872..4e73ade 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -295,8 +295,8 @@ pprBranch ident = ptext (sLit goto) + pprBlockId ident 
 semi
 pprCondBranch :: CmmExpr - BlockId - BlockId - SDoc
 pprCondBranch expr yes no
 = hsep [ ptext (sLit if) , parens(pprExpr expr) ,
-ptext (sLit goto), pprBlockId yes,
-ptext (sLit else), pprBlockId no  semi ]
+ptext (sLit goto), pprBlockId yes  semi,
+ptext (sLit else goto), pprBlockId no  semi ]
 
 -- -
 -- a local table branch



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: a fix for checkTSO(): the TSO could be a WHITEHOLE (65e46f1)

2012-11-14 Thread Simon Marlow

On 13/11/2012 16:43, Henrique Ferreiro wrote:

commit 65e46f144f3d8b18de7264b0b099086153c68d6c

Author: Simon Marlow marlo...@gmail.com mailto:marlo...@gmail.com
Date:   Mon Nov 5 15:43:21 2012 +

 a fix for checkTSO(): the TSO could be a WHITEHOLE

 ---

  rts/sm/Sanity.c |   13 ++---
  1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 6237662..a760e57 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -499,6 +499,9 @@ checkSTACK (StgStack *stack)
  void
  checkTSO(StgTSO *tso)
  {
+StgTSO *next;
+const StgInfoTable *info;
+
  if (tso-what_next == ThreadKilled) {
/* The garbage collector doesn't bother following any pointers
 * from dead threads, so don't check sanity here.
@@ -506,9 +509,13 @@ checkTSO(StgTSO *tso)
return;
  }

-ASSERT(tso-_link == END_TSO_QUEUE ||
-   tso-_link-header.info http://header.info ==
stg_MVAR_TSO_QUEUE_info ||
-   tso-_link-header.info http://header.info ==
stg_TSO_info);
+next = tso-_link;
+info = (const StgInfoTable*) tso-header.info http://header.info;
+
+ASSERT(next == END_TSO_QUEUE ||
+   info == stg_MVAR_TSO_QUEUE_info ||
+   info == stg_TSO_info ||
+   info == stg_WHITEHOLE_info); // happens due to STM
doing lockTSO()

  if (   tso-why_blocked == BlockedOnMVar
 || tso-why_blocked == BlockedOnBlackHole


I may be missing something but in the original code you are checking the
info table of tso-_link and, in the new one, the info table of tso.


Well spotted, thanks.

Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: add note about compilation safety to safe haskell docs (b78b6b3)

2012-11-13 Thread Simon Marlow

On 13/11/2012 03:08, Ian Lynagh wrote:

On Mon, Nov 12, 2012 at 02:19:38PM +, Simon Marlow wrote:

On 10/11/2012 02:47, Ian Lynagh wrote:

On Fri, Nov 09, 2012 at 05:46:05PM -0800, David Terei wrote:

On 9 November 2012 17:36, Ian Lynagh i...@well-typed.com wrote:

On Fri, Nov 09, 2012 at 04:34:20PM -0800, David Terei wrote:


+  Safe Haskell, however, emphasisdoes not offer/emphasis compilation
+  safety.


Is this a bug? A few lines lower down the docs say that Compiling and
executing untrusted code is one of the two use cases for Safe Haskell.


What matters is, does this problem make Safe Haskell unusable. I'd
argue no,


FWIW, I'd say yes, as it doesn't allow the use cases I can think of (OK,
it does work for lambdabot/tryhaskell, but only because they only allow
toy expressions to be evaluated).


What's wrong with using a sandbox?


According to the docs, Compiling and executing untrusted code is one
of the two use cases Safe Haskell has been designed for. If use a
sandbox is an acceptable part of the answer, then why did we need Safe
Haskell for that use case at all? Isn't the entire use case solved by
use a sandbox?


Well yes. So don't get me wrong, the intention has always been to tackle 
compilation safety too, but we realised it's an orthogonal issue to 
language safety, so we were able to deal with one problem at a time, and 
language safety is the harder (and more interesting) of the two.


Would you like to look at compilation safety?  I don't think either I or 
David has any immediate plans to do so, and as you say it's an important 
next step.  Someone will  need to audit all the flags and compiler 
features and think about whether they can be used maliciously - do you 
have a devious mind? :)


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: assert HpAlloc == 0 (afd7e22)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/afd7e22d4082e9f39432dfb18382759652615005

---

commit afd7e22d4082e9f39432dfb18382759652615005
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 15:42:27 2012 +

assert HpAlloc == 0

---

 rts/StgStartup.cmm |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm
index 5ad2ff6..dcc0383 100644
--- a/rts/StgStartup.cmm
+++ b/rts/StgStartup.cmm
@@ -24,10 +24,11 @@
  * to the scheduler marking the thread as finished.
  */
 
-#define CHECK_SENSIBLE_REGS() \
-ASSERT(Hp != 0);   \
-ASSERT(Sp != 0);   \
-ASSERT(SpLim != 0);\
+#define CHECK_SENSIBLE_REGS()   \
+ASSERT(Hp != 0);\
+ASSERT(HpAlloc == 0);   \
+ASSERT(Sp != 0);\
+ASSERT(SpLim != 0); \
 ASSERT(SpLim - WDS(RESERVED_STACK_WORDS) = Sp);
 
 /* 
-



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: some W_s should be P_s (e15981a)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/e15981a16c832b8cd7dbba676399fd555a379272

---

commit e15981a16c832b8cd7dbba676399fd555a379272
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 15:41:54 2012 +

some W_s should be P_s

---

 rts/PrimOps.cmm |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index be8bc15..18757bf 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -885,9 +885,9 @@ INFO_TABLE_RET(stg_catch_stm_frame, CATCH_STM_FRAME,
 
 stg_atomicallyzh (P_ stm)
 {
-  W_ old_trec;
-  W_ new_trec;
-  W_ code, next_invariant, frame_result;
+  P_ old_trec;
+  P_ new_trec;
+  P_ code, next_invariant, frame_result;
 
   // stmStartTransaction may allocate
   MAYBE_GC_P(stg_atomicallyzh, stm);



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: remove some unused variables (2ef95e8)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2ef95e8fe0df15eb182a480b2d221a827f36ee96

---

commit 2ef95e8fe0df15eb182a480b2d221a827f36ee96
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 15:44:20 2012 +

remove some unused variables

---

 rts/Updates.cmm |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/rts/Updates.cmm b/rts/Updates.cmm
index 01eb682..53b2cba 100644
--- a/rts/Updates.cmm
+++ b/rts/Updates.cmm
@@ -45,7 +45,9 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
  UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,_unused,updatee) )
 return (P_ ret) /* the closure being returned */
 {
-W_ v, i, tso, link;
+W_ v;
+
+if (HpAlloc != 0) { ccall barf(HpAlloc); }
 
 // we know the closure is a BLACKHOLE
 v = StgInd_indirectee(updatee);



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: a fix for checkTSO(): the TSO could be a WHITEHOLE (65e46f1)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/65e46f144f3d8b18de7264b0b099086153c68d6c

---

commit 65e46f144f3d8b18de7264b0b099086153c68d6c
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 15:43:21 2012 +

a fix for checkTSO(): the TSO could be a WHITEHOLE

---

 rts/sm/Sanity.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 6237662..a760e57 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -499,6 +499,9 @@ checkSTACK (StgStack *stack)
 void
 checkTSO(StgTSO *tso)
 {
+StgTSO *next;
+const StgInfoTable *info;
+
 if (tso-what_next == ThreadKilled) {
   /* The garbage collector doesn't bother following any pointers
* from dead threads, so don't check sanity here.  
@@ -506,9 +509,13 @@ checkTSO(StgTSO *tso)
   return;
 }
 
-ASSERT(tso-_link == END_TSO_QUEUE || 
-   tso-_link-header.info == stg_MVAR_TSO_QUEUE_info ||
-   tso-_link-header.info == stg_TSO_info);
+next = tso-_link;
+info = (const StgInfoTable*) tso-header.info;
+
+ASSERT(next == END_TSO_QUEUE ||
+   info == stg_MVAR_TSO_QUEUE_info ||
+   info == stg_TSO_info ||
+   info == stg_WHITEHOLE_info); // happens due to STM doing lockTSO()
 
 if (   tso-why_blocked == BlockedOnMVar
|| tso-why_blocked == BlockedOnBlackHole



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: ASSERT(HpAlloc==0) in the update code, to catch HpAlloc bugs (1c160e5)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/1c160e588706f4ff6b4e391602e38f0a2044ec13

---

commit 1c160e588706f4ff6b4e391602e38f0a2044ec13
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 16:06:24 2012 +

ASSERT(HpAlloc==0) in the update code, to catch HpAlloc bugs

---

 rts/Updates.cmm |   16 +++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/rts/Updates.cmm b/rts/Updates.cmm
index 53b2cba..b3b6b20 100644
--- a/rts/Updates.cmm
+++ b/rts/Updates.cmm
@@ -29,6 +29,8 @@ INFO_TABLE_RET ( stg_upd_frame, UPDATE_FRAME,
  UPDATE_FRAME_FIELDS(W_,P_,info_ptr,_ccs,_unused,updatee) )
 return (P_ ret) /* the closure being returned */
 {
+ASSERT(HpAlloc == 0); // Note [HpAlloc]
+
 /* ToDo: it might be a PAP, so we should check... */
 TICK_UPD_CON_IN_NEW(sizeW_fromITBL(%GET_STD_INFO(updatee)));
 
@@ -47,7 +49,7 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
 {
 W_ v;
 
-if (HpAlloc != 0) { ccall barf(HpAlloc); }
+ASSERT(HpAlloc == 0); // Note [HpAlloc]
 
 // we know the closure is a BLACKHOLE
 v = StgInd_indirectee(updatee);
@@ -87,3 +89,15 @@ INFO_TABLE_RET ( stg_bh_upd_frame, UPDATE_FRAME,
 ( UPDATE_FRAME_FIELDS(,,info_ptr,ccs,_unused,updatee) )
 (ret);
 }
+
+/* Note [HpAlloc]
+ *
+ * HpAlloc is required to be zero unless we just bumped Hp and failed
+ * the heap check: see HeapStackCheck.cmm.  Failures that result from
+ * HpAlloc being non-zero are very hard to track down, because they
+ * manifest as spurious heap corruption that happens only with +RTS
+ * -N2 or greater (because then we have a lot more
+ * interruptCapability() calls happening).  Hence, we assert
+ * HpAlloc==0 as often as possible, and in the update code is a good
+ * place to do that.
+ */



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix the Slow calling convention (#7192) (4270d7e)

2012-11-13 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/4270d7e7485b124dd153399dfe3f571253dc0d1d

---

commit 4270d7e7485b124dd153399dfe3f571253dc0d1d
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Nov 13 11:43:09 2012 +

Fix the Slow calling convention (#7192)

The Slow calling convention passes the closure in R1, but we were
ignoring this and hoping it would work, which it often did.  However,
this bug seems to have been the cause of #7192, because the
graph-colouring allocator is more sensitive to having correct liveness
information on jumps.

 compiler/cmm/CmmCallConv.hs  |6 +++---
 compiler/cmm/CmmParse.y  |2 +-
 compiler/cmm/MkGraph.hs  |   32 
 compiler/codeGen/StgCmmBind.hs   |   21 +++--
 compiler/codeGen/StgCmmExpr.hs   |4 ++--
 compiler/codeGen/StgCmmHeap.hs   |   12 
 compiler/codeGen/StgCmmLayout.hs |2 +-
 7 files changed, 30 insertions(+), 49 deletions(-)


Diff suppressed because of size. To see it, use:

git show 4270d7e7485b124dd153399dfe3f571253dc0d1d

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: add note about compilation safety to safe haskell docs (b78b6b3)

2012-11-12 Thread Simon Marlow

On 10/11/2012 02:47, Ian Lynagh wrote:

On Fri, Nov 09, 2012 at 05:46:05PM -0800, David Terei wrote:

On 9 November 2012 17:36, Ian Lynagh i...@well-typed.com wrote:

On Fri, Nov 09, 2012 at 04:34:20PM -0800, David Terei wrote:


+  Safe Haskell, however, emphasisdoes not offer/emphasis compilation
+  safety.


Is this a bug? A few lines lower down the docs say that Compiling and
executing untrusted code is one of the two use cases for Safe Haskell.


What matters is, does this problem make Safe Haskell unusable. I'd
argue no,


FWIW, I'd say yes, as it doesn't allow the use cases I can think of (OK,
it does work for lambdabot/tryhaskell, but only because they only allow
toy expressions to be evaluated).


What's wrong with using a sandbox?  Note that even if we tackled the 
problem of safe compilation in GHC, that still doesn't help if you're 
using Cabal, which would also need some explicit support for safe 
compilation (e.g. to disable the use of Setup.hs, hsc2hs, and who knows 
what else).  However, using a sandbox addresses both cases, without any 
changes in GHC.


Of course we should fix this in GHC in due course, but I'm just pointing 
out that a sandbox will probably be necessary, and you can use one right 
now to get compilation safety.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: replaceLabels: null out the cml_cont field of CmmCall (4dc7d04)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/4dc7d04e59161be4ea33192f82aa94be3c68bf20

---

commit 4dc7d04e59161be4ea33192f82aa94be3c68bf20
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 14:01:01 2012 +

replaceLabels: null out the cml_cont field of CmmCall

This fixes a CmmLint complaint when doing proc-point splitting.

---

 compiler/cmm/CmmProcPoint.hs |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs
index 02b232d..fb94b95 100644
--- a/compiler/cmm/CmmProcPoint.hs
+++ b/compiler/cmm/CmmProcPoint.hs
@@ -354,7 +354,10 @@ replaceBranches env cmmg
 last (CmmBranch id)  = CmmBranch (lookup id)
 last (CmmCondBranch e ti fi) = CmmCondBranch e (lookup ti) (lookup fi)
 last (CmmSwitch e tbl)   = CmmSwitch e (map (fmap lookup) tbl)
-last l@(CmmCall {})  = l
+last l@(CmmCall {})  = l { cml_cont = Nothing }
+-- NB. remove the continuation of a CmmCall, since this
+-- label will now be in a different CmmProc.  Not only
+-- is this tidier, it stops CmmLint from complaining.
 last l@(CmmForeignCall {})   = l
 lookup id = fmap lookup (mapLookup id env) `orElse` id
 -- XXX: this is a recursive lookup, it follows chains



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Remove OldCmm, convert backends to consume new Cmm (d92bd17)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d92bd17ffd8715f77fd49de0fed6e39c8d0ec28b

---

commit d92bd17ffd8715f77fd49de0fed6e39c8d0ec28b
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 11:47:51 2012 +

Remove OldCmm, convert backends to consume new Cmm

This removes the OldCmm data type and the CmmCvt pass that converts
new Cmm to OldCmm.  The backends (NCGs, LLVM and C) have all been
converted to consume new Cmm.

The main difference between the two data types is that conditional
branches in new Cmm have both true/false successors, whereas in OldCmm
the false case was a fallthrough.  To generate slightly better code we
occasionally need to invert a conditional to ensure that the
branch-not-taken becomes a fallthrough; this was previously done in
CmmCvt, and it is now done in CmmContFlowOpt.

We could go further and use the Hoopl Block representation for native
code, which would mean that we could use Hoopl's postorderDfs and
analyses for native code, but for now I've left it as is, using the
old ListGraph representation for native code.

 compiler/cmm/Cmm.hs|   39 +++-
 compiler/cmm/CmmContFlowOpt.hs |   45 +++-
 compiler/cmm/CmmCvt.hs |  117 
 compiler/cmm/CmmInfo.hs|   32 +--
 compiler/cmm/CmmNode.hs|   14 +-
 compiler/cmm/CmmOpt.hs |7 +-
 compiler/cmm/CmmPipeline.hs|   12 +
 compiler/cmm/CmmUtils.hs   |   14 +-
 compiler/cmm/OldCmm.hs |  279 
 compiler/cmm/OldCmmLint.hs |  212 ---
 compiler/cmm/OldCmmUtils.hs|  100 ---
 compiler/cmm/OldPprCmm.hs  |  224 
 compiler/cmm/PprC.hs   |  131 +-
 compiler/cmm/PprCmmExpr.hs |1 -
 compiler/codeGen/CgUtils.hs|   87 ++
 compiler/ghc.cabal.in  |5 -
 compiler/llvmGen/LlvmCodeGen.hs|   17 +-
 compiler/llvmGen/LlvmCodeGen/Base.hs   |2 +-
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs|  197 +++---
 compiler/llvmGen/LlvmCodeGen/Data.hs   |2 +-
 compiler/llvmGen/LlvmCodeGen/Ppr.hs|2 +-
 compiler/main/CodeOutput.lhs   |4 +-
 compiler/main/HscMain.hs   |   16 +-
 compiler/nativeGen/AsmCodeGen.lhs  |   66 +++---
 compiler/nativeGen/Instruction.hs  |   14 +-
 compiler/nativeGen/PIC.hs  |2 +-
 compiler/nativeGen/PPC/CodeGen.hs  |   72 +++---
 compiler/nativeGen/PPC/Instr.hs|2 +-
 compiler/nativeGen/PPC/Ppr.hs  |2 +-
 compiler/nativeGen/PPC/RegInfo.hs  |2 +-
 compiler/nativeGen/PPC/Regs.hs |2 +-
 compiler/nativeGen/RegAlloc/Graph/Coalesce.hs  |2 +-
 compiler/nativeGen/RegAlloc/Graph/Spill.hs |2 +-
 compiler/nativeGen/RegAlloc/Graph/SpillClean.hs|2 +-
 compiler/nativeGen/RegAlloc/Graph/SpillCost.hs |2 +-
 compiler/nativeGen/RegAlloc/Graph/Stats.hs |3 +-
 .../nativeGen/RegAlloc/Linear/JoinToTargets.hs |1 -
 compiler/nativeGen/RegAlloc/Linear/Main.hs |   15 +-
 compiler/nativeGen/RegAlloc/Linear/Stats.hs|2 -
 compiler/nativeGen/RegAlloc/Liveness.hs|   13 +-
 compiler/nativeGen/SPARC/CodeGen.hs|   73 +++---
 compiler/nativeGen/SPARC/CodeGen/Amode.hs  |2 +-
 compiler/nativeGen/SPARC/CodeGen/Base.hs   |3 +-
 compiler/nativeGen/SPARC/CodeGen/CondCode.hs   |2 +-
 compiler/nativeGen/SPARC/CodeGen/Expand.hs |2 +-
 compiler/nativeGen/SPARC/CodeGen/Gen32.hs  |2 +-
 compiler/nativeGen/SPARC/CodeGen/Gen32.hs-boot |2 +-
 compiler/nativeGen/SPARC/CodeGen/Gen64.hs  |2 +-
 compiler/nativeGen/SPARC/CodeGen/Sanity.hs |4 +-
 compiler/nativeGen/SPARC/Imm.hs|2 +-
 compiler/nativeGen/SPARC/Instr.hs  |2 +-
 compiler/nativeGen/SPARC/Ppr.hs|4 +-
 compiler/nativeGen/SPARC/ShortcutJump.hs   |2 +-
 compiler/nativeGen/Size.hs |2 +-
 compiler/nativeGen/X86/CodeGen.hs  |  220 
 compiler/nativeGen/X86/Instr.hs|2 +-
 compiler/nativeGen/X86/Ppr.hs  |2 +-
 compiler/nativeGen/X86/Regs.hs |2 +-
 compiler/types

[commit: ghc] master: Fix warnings (9295780)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/929578081e8b2b0f14e9518329f516eebf4315ce

---

commit 929578081e8b2b0f14e9518329f516eebf4315ce
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 12:02:44 2012 +

Fix warnings

---

 compiler/cmm/CmmOpt.hs  |1 -
 compiler/cmm/PprC.hs|3 +++
 compiler/llvmGen/LlvmCodeGen.hs |2 +-
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs |5 +++--
 compiler/nativeGen/AsmCodeGen.lhs   |1 -
 compiler/nativeGen/Instruction.hs   |1 -
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs
index f89c081..f4cf864 100644
--- a/compiler/cmm/CmmOpt.hs
+++ b/compiler/cmm/CmmOpt.hs
@@ -16,7 +16,6 @@ module CmmOpt (
 import CmmUtils
 import Cmm
 import DynFlags
-import CLabel
 
 import FastTypes
 import Outputable
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index ee964d8..9ebb12d 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -168,6 +168,7 @@ pprStmt :: CmmNode e x - SDoc
 pprStmt stmt =
 sdocWithDynFlags $ \dflags -
 case stmt of
+CmmEntry _ - empty
 CmmComment _ - empty -- (hang (ptext (sLit /*)) 3 (ftext s)) $$ ptext 
(sLit */)
   -- XXX if the string contains */, we need to fix it
   -- XXX we probably want to emit these comments when
@@ -255,6 +256,8 @@ pprStmt stmt =
 CmmSwitch arg ids- sdocWithDynFlags $ \dflags -
 pprSwitch dflags arg ids
 
+_other - pprPanic PprC.pprStmt (ppr stmt)
+
 type Hinted a = (a, ForeignHint)
 
 pprForeignCall :: SDoc - CCallConv - [Hinted CmmFormal] - [Hinted CmmActual]
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs
index 241e52e..4b8455f 100644
--- a/compiler/llvmGen/LlvmCodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen.hs
@@ -42,7 +42,7 @@ llvmCodeGen dflags h us cmms
 (cdata,env) = {-# SCC llvm_split #-}
   foldr split ([], initLlvmEnv dflags) cmm
 split (CmmData s d' ) (d,e) = ((s,d'):d,e)
-split p@(CmmProc h l live g) (d,e) =
+split (CmmProc h l live g) (d,e) =
 let lbl = strCLabel_llvm env $
 case mapLookup (g_entry g) h of
   Nothing   - l
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs 
b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index b5d4b4a..ef9fc2b 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -40,8 +40,8 @@ type LlvmStatements = OrdList LlvmStatement
 -- | Top-level of the LLVM proc Code generator
 --
 genLlvmProc :: LlvmEnv - RawCmmDecl - UniqSM (LlvmEnv, [LlvmCmmDecl])
-genLlvmProc env proc0@(CmmProc infos lbl live graph) = do
-let blocks = toBlockList graph
+genLlvmProc env (CmmProc infos lbl live graph) = do
+let blocks = toBlockListEntryFirst graph
 (env', lmblocks, lmdata) - basicBlocksCodeGen env live blocks ([], [])
 let info = mapLookup (g_entry graph) infos
 proc = CmmProc info lbl live (ListGraph lmblocks)
@@ -274,6 +274,7 @@ genCall env target res args = do
  _  - CC_Ccc
  CCallConv- CC_Ccc
  CApiConv - CC_Ccc
+ PrimCallConv - panic LlvmCodeGen.CodeGen.genCall: 
PrimCallConv
 
 PrimTarget   _ - CC_Ccc
 
diff --git a/compiler/nativeGen/AsmCodeGen.lhs 
b/compiler/nativeGen/AsmCodeGen.lhs
index 7710691..53d1949 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -953,7 +953,6 @@ cmmStmtConFold stmt
 
 CmmCondBranch test true false
- do test' - cmmExprConFold DataReference test
- dflags - getDynFlags
  return $ case test' of
CmmLit (CmmInt 0 _) - CmmBranch false
CmmLit (CmmInt _ _) - CmmBranch true
diff --git a/compiler/nativeGen/Instruction.hs 
b/compiler/nativeGen/Instruction.hs
index 48d6a33..076129f 100644
--- a/compiler/nativeGen/Instruction.hs
+++ b/compiler/nativeGen/Instruction.hs
@@ -19,7 +19,6 @@ import BlockId
 import DynFlags
 import Cmm hiding (topInfoTable)
 import Platform
-import Outputable
 
 -- | Holds a list of source and destination registers used by a
 --  particular instruction.



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: handle MO_Touch, and generate no code for it. (a1ebe37)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a1ebe37d8394e35d0a29f21511626d0895db634a

---

commit a1ebe37d8394e35d0a29f21511626d0895db634a
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 14:01:22 2012 +

handle MO_Touch, and generate no code for it.

---

 compiler/llvmGen/LlvmCodeGen/CodeGen.hs |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs 
b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index ef9fc2b..fd9d701 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -184,6 +184,9 @@ genCall env (PrimTarget MO_WriteBarrier) _ _
  | getLlvmVer env  29 = barrier env
  | otherwise   = oldBarrier env
 
+genCall env (PrimTarget MO_Touch) _ _
+ = return (env, nilOL, [])
+
 -- Handle popcnt function specifically since GHC only really has i32 and i64
 -- types and things like Word8 are backed by an i32 and just present a logical
 -- i8 range. So we must handle conversions from i32 to i8 explicitly as LLVM



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: update bounds (53741d2)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/53741d230048084767b79530a3040aff7af82822

---

commit 53741d230048084767b79530a3040aff7af82822
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 15:13:38 2012 +

update bounds

---

 tests/perf/compiler/all.T |   40 +++-
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/tests/perf/compiler/all.T b/tests/perf/compiler/all.T
index ec14ef7..f463b96 100644
--- a/tests/perf/compiler/all.T
+++ b/tests/perf/compiler/all.T
@@ -39,21 +39,23 @@ test('T1969',
 # 2012-10-08: 303930948 (x86/Linux, new codegen)
 # 2012-10-29: 298921816 (x86/Windows; increased 
range to 5%
   if_wordsize(64,
-  compiler_stats_range_field('bytes allocated', 642594312, 1)),
-# 17/11/2009: 434,845,560 (amd64/Linux)
-# 08/12/2009: 459,776,680 (amd64/Linux)
-# 17/05/2010: 519,377,728 (amd64/Linux)
-# 05/08/2011: 561,382,568 (amd64/OS X)
-# 16/07/2012: 589,168,872 (amd64/Linux)
-# 20/07/2012: 595,936,240 (amd64/Linux)
-# 23/08/2012: 606,230,880 (amd64/Linux)
-# 29/08/2012: 633,334,184 (amd64/Linux)
-# (^ new codegen)
-# 18/09/2012: 641,959,976 (amd64/Linux)
-# 19/10/2012: 661,832,592 (amd64/Linux)
-# (^ -fPIC turned on)
-# 23/10/2012: 642,594,312 (amd64/Linux)
-# (^ -fPIC turned off 
again)
+  compiler_stats_range_field('bytes allocated', 658786936, 1)),
+# 17/11/2009: 434,845,560 (amd64/Linux)
+# 08/12/2009: 459,776,680 (amd64/Linux)
+# 17/05/2010: 519,377,728 (amd64/Linux)
+# 05/08/2011: 561,382,568 (amd64/OS X)
+# 16/07/2012: 589,168,872 (amd64/Linux)
+# 20/07/2012: 595,936,240 (amd64/Linux)
+# 23/08/2012: 606,230,880 (amd64/Linux)
+# 29/08/2012: 633,334,184 (amd64/Linux)
+# (^ new codegen)
+# 18/09/2012: 641,959,976 (amd64/Linux)
+# 19/10/2012: 661,832,592 (amd64/Linux)
+# (^ -fPIC turned on)
+# 23/10/2012: 642,594,312 (amd64/Linux)
+# (^ -fPIC turned off again)
+# 12/11/2012: 658,786,936 (amd64/Linux)
+# ( UNKNOWN REASON )
   only_ways(['normal']),
   extra_hc_opts('-dcore-lint -static')
   # Leave -dcore-lint on for this one test, so that we have something
@@ -108,9 +110,10 @@ test('T4801',
   compiler_stats_range_field('peak_megabytes_allocated', 30, 20)),
 
   if_wordsize(64,
-  compiler_stats_range_field('peak_megabytes_allocated', 64, 20)),
+  compiler_stats_range_field('peak_megabytes_allocated', 49, 20)),
# prev:   50 (amd64/Linux)
# 19/10/2012: 64 (amd64/Linux) (REASON UNKNOWN!)
+   # 12/11/2012: 49 (amd64/Linux) (REASON UNKNOWN!)
 
   # expected value: 58 (amd64/OS X):
   if_platform('x86_64-apple-darwin',
@@ -235,10 +238,13 @@ test('T783',
   compiler_stats_range_field('bytes allocated', 226907420, 10)),
# 2012-10-08: 226907420 (x86/Linux)
   if_wordsize(64,
-  compiler_stats_range_field('bytes allocated', 436927840, 10)),
+  compiler_stats_range_field('bytes allocated', 640324528, 10)),
# prev:   349,263,216 (amd64/Linux)
# 07/08/2012: 384,479,856 (amd64/Linux)
# 29/08/2012: 436,927,840 (amd64/Linux)
+   # 12/11/2012: 640,324,528 (amd64/Linux)
+   #   (OldCmm removed: not sure why this got worse, 
the
+   #other perf tests remained about the same)
   extra_hc_opts('-static')
   ],
   compile,[''])



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: update 64-bit bounds (560f8cc)

2012-11-12 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/560f8cc06d08d277c6e3e3c4fbd8b3d8ce3448ee

---

commit 560f8cc06d08d277c6e3e3c4fbd8b3d8ce3448ee
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 12 15:16:41 2012 +

update 64-bit bounds

---

 tests/perf/haddock/all.T |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/perf/haddock/all.T b/tests/perf/haddock/all.T
index a7bea9a..e432342 100644
--- a/tests/perf/haddock/all.T
+++ b/tests/perf/haddock/all.T
@@ -2,20 +2,21 @@
 test('haddock.base',
  [unless_in_tree_compiler(skip)
  ,if_wordsize(64,
-  stats_num_field('peak_megabytes_allocated', 236,
-  248))
+  stats_range_field('peak_megabytes_allocated', 249, 10))
 # 2012-08-14: 240 (amd64/Linux)
 # 2012-09-18: 237 (amd64/Linux)
+# 2012-11-12: 249 (amd64/Linux)
  ,if_wordsize(32,
   stats_num_field('peak_megabytes_allocated', 110,
   115))
 # 2012-08-14: 144 (x86/OSX)
 # 2012-10-30: 113 (x86/Windows)
  ,if_wordsize(64,
-  stats_range_field('max_bytes_used', 84794136, 2))
+  stats_range_field('max_bytes_used', 87265136, 10))
 # 2012-08-14: 87374568 (amd64/Linux)
 # 2012-08-21: 86428216 (amd64/Linux)
 # 2012-09-20: 84794136 (amd64/Linux)
+# 2012-11-12: 87265136 (amd64/Linux)
  ,if_wordsize(32,
   stats_range_field('max_bytes_used', 45574928, 1))
 # 2012-08-14: 45574928 (x86/OSX)
@@ -82,19 +83,21 @@ test('haddock.compiler',
 # 2012-08-14: 631 (x86/OSX)
 # 2012-10-30: 606 (x86/Windows)
  ,if_wordsize(64,
-  stats_range_field('max_bytes_used', 442768280, 2))
+  stats_range_field('max_bytes_used', 420105120, 10))
 # 2012-08-14: 428775544 (amd64/Linux)
 # 2012-09-20: 437618008 (amd64/Linux)
 # 2012-10-08: 442768280 (amd64/Linux)
+# 2012-11-12: 420105120 (amd64/Linux)
  ,if_wordsize(32,
   stats_range_field('max_bytes_used', 220847924, 1))
 # 2012-08-14: 231064920 (x86/OSX)
 # 2012-10-30: 220847924 (x86/Windows)
  ,if_wordsize(64,
-  stats_range_field('bytes allocated', 26882813032, 1))
+  stats_range_field('bytes allocated', 25990254632, 10))
   # 2012-08-14: 26,070,600,504 (amd64/Linux)
   # 2012-08-29: 26,353,100,288 (amd64/Linux, new 
CG)
   # 2012-09-18: 26,882,813,032 (amd64/Linux)
+  # 2012-11-12: 25,990,254,632 (amd64/Linux)
  ,if_wordsize(32,
   stats_range_field('bytes allocated', 13773051312, 1))
  # 2012-08-14: 13471797488 (x86/OSX)



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Problems building from source: ghc-tarballs

2012-11-09 Thread Simon Marlow

Hi Alastair! Welcome back :)

On 04/11/12 11:52, Alastair Reid wrote:


http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources
git clone http://darcs.haskell.org/ghc.git/
git clone ghc ghc-working
cd ghc-working
./sync-all --testsuite --no-dph get


Ian's reply contained the fix, but just in case you didn't grasp what 
happened here, the problem is that you cloned the ghc repo locally to 
ghc-working, so the ghc-working repo's origin points back to the ghc 
repo.  Hence when you ran sync-all in ghc-working it was looking for the 
rest of the repos in the same tree as the ghc repo, and not finding them.



Reason I'm starting with git is that my plan is to relearn how to do
unregisterized builds using x86/Linux as an example and then see if I
can figure out how to port ghc to a new architecture.


We're moving towards doing ports with cross-compilation, rather than the 
old method of building .hc files and moving them to the target platform 
to compile them.  I don't think the latter method even works any more. 
Unfortunately the cross-compilation process is not very smooth yet, 
although some people have managed to do it.  Ian is looking into this 
right now, so hopefully he'll be able to provide more info.


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Proposal: New procedures for handling packages in a GHC tree

2012-11-06 Thread Simon Marlow

On 06/11/12 02:56, Manuel M T Chakravarty wrote:


I wonder about the loss of changes that both you and Ian mentioned.
We are using git submodules for Accelerate, and yes, you need to use
them in the right way (as you do with the nested repos), but I don't
think we ever lost anything due to submodules. How does that happen?


Submodules are normally in a detached-HEAD state, and when you do 'git 
submodule update' it does a checkout to the new revision, so any commits 
you previously made are lost (well, they're still in the repo, but you 
have to dig into the reflog to get them back, and a future git gc will 
kill them):


I discovered this when I investigated submodules a while ago: 
http://hackage.haskell.org/trac/ghc/wiki/DarcsConversion#Theperspectiveonsubmodules


and this blog post is a good summary of the problems that can trip 
people up (see in particular the section Oh were you using that?):


http://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/

The upshot is that there are new gotchas that people will run into with 
submodules, so we'll need some clear instructions on what to do, and 
perhaps some tooling (in sync-all) to catch the common mistakes.



I also imagine that we might still like to keep the ./sync-all script to 
automate the use of submodules for the common use cases. (That should minimise 
the risk of mistakes.)


Right, the plan Ian had in mind was for sync-all pull to do an automatic 
submodule update too.


Cheers,
Simon



Manuel


Simon Marlow marlo...@gmail.com:

On 05/11/2012 10:52, Manuel M T Chakravarty wrote:


I agree with Geoff, submodules bring a certain complexity, but also
advantages. We already pay for most complexities if we use submodules
at all (such as having to use git submodule and remember to keep
them in sync). If we pay already, why not reap the advantages for the
rest of the repositories as well.

For example, I often make changes in the main repo and the dph repo
at the same time. It would be much more convenient if a branch would
reflect the shared state of both (i.e., if dph would be a submodule
of the main repo).

In other words, if we use submodules at all (which is an idea I
like), why add additional complexity by using different mechanisms
for different subrepos? And why not reap the benefits of submodules
across the board?


I wouldn't object to trying that, if that's what people want.  I buy the 
advantages of submodules, and I buy the argument that since we have some 
submodules, it's probably easier to make them all submodules.

I've been deliberately conservative in our adoption of submodules, because my 
own experience wasn't good when I tried them - it's easy to get very confused, 
and to lose changes.  The setup with separate repos has its disadvantages, but 
at least we fully understand it, and it's under our control.

We're forced to use submodules for upstream packages, because we will sometimes 
need to move from tracking one branch to another branch.  This doesn't work 
well with separate repos, because GHC devs would need a git reset when we 
switch to tracking a different branch.  Hence the move to submodules.


Cheers,
Simon





Manuel


Geoffrey Mainland mainl...@apeiron.net:

On 11/02/2012 08:10 PM, Ian Lynagh wrote:

Hi all,

We have been working on a new way in which we handle the repositories
that make up a GHC tree, in order to makes the process smoother for all
parties.

Our proposal is here:
   http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions/Repositories

Please have a look and let us know what you think, and especially
whether you think there is anything that we've failed to take into
account.

Thanks
Ian


Hi Ian,

Thanks for putting together the proposal.

If we will now be using git submodules for external libraries, can we
not just use submodules for all libraries? That way the GHC repo hash
will uniquely specify everything needed to reproduce a build. Right now
it is painful to do any sort of bisect operation---doing so requires
digging through build logs to find fingerprint files for past builds.

It looks like the proposal will leave us with the pain of fingerprints
and add the additional pain of git submodules. I am very much in favor
of just using submodules for everything.

Geoff

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http

Re: [PATCH] define own version of PRIdPTR on platform where its not available

2012-11-05 Thread Simon Marlow

On 03/11/2012 00:16, Ian Lynagh wrote:


Hi Karel,

On Fri, Nov 02, 2012 at 07:39:45PM +0100, Karel Gardas wrote:


I'm curious if this patch is kind of controversial so you are
reluctant to merge it. If you find any issue with it please let me
know so I can change it as per your suggestion. I've done this patch
to un-break GHC HEAD build failure on my solaris 11 box.


If we're going to go this route, then I think we should do it by
comparing SIZEOF_VOID_P to SIZEOF_INT etc, rather than assuming that
either 'ld' or 'd' is right based on _LP64.

However, I'm hoping to replace mkDerivedConstants.c with probably a
configure script soon, so that it can produce the right results when
cross-compiling.


Yes we need to replace mkDerivedConstants.c with something else for 
cross compilation, but I really hope it doesn't have to be a configure 
script :-)  Surely it's possible to convince the C compiler to emit 
struct offsets without having to run the program, somehow?


Cheers,
Simon







On 10/30/12 06:59 PM, Karel Gardas wrote:

Note that PRIdPTR is considered as linux-ism so it's not available on platforms
like Solaris, although some other free Unix(-like) OSes apparently supports
it too.
---
  includes/mkDerivedConstants.c |   11 +++
  1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index 1393112..953b2b5 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -30,6 +30,17 @@
  #includestdio.h
  #includestring.h

+
+#if !defined(PRIdPTR)
+#if defined(_LP64)
+/* compiling for 64bit target */
+#define PRIdPTR ld
+#else
+/* compiling for 32bit target */
+#define PRIdPTR d
+#endif
+#endif



Thanks
Ian


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Proposal: New procedures for handling packages in a GHC tree

2012-11-05 Thread Simon Marlow

On 05/11/2012 10:52, Manuel M T Chakravarty wrote:


I agree with Geoff, submodules bring a certain complexity, but also
advantages. We already pay for most complexities if we use submodules
at all (such as having to use git submodule and remember to keep
them in sync). If we pay already, why not reap the advantages for the
rest of the repositories as well.

For example, I often make changes in the main repo and the dph repo
at the same time. It would be much more convenient if a branch would
reflect the shared state of both (i.e., if dph would be a submodule
of the main repo).

In other words, if we use submodules at all (which is an idea I
like), why add additional complexity by using different mechanisms
for different subrepos? And why not reap the benefits of submodules
across the board?


I wouldn't object to trying that, if that's what people want.  I buy the 
advantages of submodules, and I buy the argument that since we have some 
submodules, it's probably easier to make them all submodules.


I've been deliberately conservative in our adoption of submodules, 
because my own experience wasn't good when I tried them - it's easy to 
get very confused, and to lose changes.  The setup with separate repos 
has its disadvantages, but at least we fully understand it, and it's 
under our control.


We're forced to use submodules for upstream packages, because we will 
sometimes need to move from tracking one branch to another branch.  This 
doesn't work well with separate repos, because GHC devs would need a git 
reset when we switch to tracking a different branch.  Hence the move to 
submodules.



Cheers,
Simon





Manuel


Geoffrey Mainland mainl...@apeiron.net:

On 11/02/2012 08:10 PM, Ian Lynagh wrote:

Hi all,

We have been working on a new way in which we handle the repositories
that make up a GHC tree, in order to makes the process smoother for all
parties.

Our proposal is here:
   http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions/Repositories

Please have a look and let us know what you think, and especially
whether you think there is anything that we've failed to take into
account.

Thanks
Ian


Hi Ian,

Thanks for putting together the proposal.

If we will now be using git submodules for external libraries, can we
not just use submodules for all libraries? That way the GHC repo hash
will uniquely specify everything needed to reproduce a build. Right now
it is painful to do any sort of bisect operation---doing so requires
digging through build logs to find fingerprint files for past builds.

It looks like the proposal will leave us with the pain of fingerprints
and add the additional pain of git submodules. I am very much in favor
of just using submodules for everything.

Geoff

___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: loadThreadState should set HpAlloc=0 (9f68cce)

2012-11-05 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9f68cceca364600e2ed8d8b4c9e2684eb83549fc

---

commit 9f68cceca364600e2ed8d8b4c9e2684eb83549fc
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 14:49:05 2012 +

loadThreadState should set HpAlloc=0

---

 compiler/codeGen/StgCmmForeign.hs |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/compiler/codeGen/StgCmmForeign.hs 
b/compiler/codeGen/StgCmmForeign.hs
index 7612cd1..aef1e4f 100644
--- a/compiler/codeGen/StgCmmForeign.hs
+++ b/compiler/codeGen/StgCmmForeign.hs
@@ -306,6 +306,11 @@ loadThreadState dflags tso stack = do
 -- SpLim = stack-stack + RESERVED_STACK_WORDS;
 mkAssign spLim (cmmOffsetW dflags (cmmOffset dflags (CmmReg (CmmLocal 
stack)) (stack_STACK dflags))
 (rESERVED_STACK_WORDS dflags)),
+-- HpAlloc = 0;
+--   HpAlloc is assumed to be set to non-zero only by a failed
+--   a heap check, see HeapStackCheck.cmm:GC_GENERIC
+mkAssign hpAlloc (zeroExpr dflags),
+
 openNursery dflags,
 -- and load the current cost centre stack from the TSO when profiling:
 if gopt Opt_SccProfilingOn dflags then
@@ -367,13 +372,14 @@ stgHp = CmmReg hp
 stgCurrentTSO = CmmReg currentTSO
 stgCurrentNursery = CmmReg currentNursery
 
-sp, spLim, hp, hpLim, currentTSO, currentNursery :: CmmReg
+sp, spLim, hp, hpLim, currentTSO, currentNursery, hpAlloc :: CmmReg
 sp= CmmGlobal Sp
 spLim = CmmGlobal SpLim
 hp= CmmGlobal Hp
 hpLim = CmmGlobal HpLim
 currentTSO= CmmGlobal CurrentTSO
 currentNursery= CmmGlobal CurrentNursery
+hpAlloc   = CmmGlobal HpAlloc
 
 -- 
-
 -- For certain types passed to foreign calls, we adjust the actual



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: small optimisation: inline stmNewTVar() (a307ad5)

2012-11-05 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a307ad56e0a5568d4b9f2c446ba33fcc42f39f47

---

commit a307ad56e0a5568d4b9f2c446ba33fcc42f39f47
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Nov 5 10:42:23 2012 +

small optimisation: inline stmNewTVar()

---

 includes/mkDerivedConstants.c |3 +++
 rts/PrimOps.cmm   |   11 +--
 rts/STM.c |   15 ---
 rts/STM.h |8 
 4 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index 79242d9..7009a3f 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -631,7 +631,10 @@ main(int argc, char *argv[])
 closure_field(StgTVarWatchQueue, next_queue_entry);
 closure_field(StgTVarWatchQueue, prev_queue_entry);
 
+closure_size(StgTVar);
 closure_field(StgTVar, current_value);
+closure_field(StgTVar, first_watch_queue_entry);
+closure_field(StgTVar, num_updates);
 
 closure_size(StgWeak);
 closure_field(StgWeak,link);
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 6ff7dc0..be8bc15 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1062,8 +1062,15 @@ stg_newTVarzh (P_ init)
 {
 W_ tv;
 
-MAYBE_GC_P (stg_newTVarzh, init);
-(ptr tv) = ccall stmNewTVar(MyCapability() ptr, init ptr);
+ALLOC_PRIM_P (SIZEOF_StgTVar, stg_newTVarzh, init);
+
+tv = Hp - SIZEOF_StgTVar + WDS(1);
+SET_HDR (tv, stg_TVAR_info, CCCS);
+
+StgTVar_current_value(tv) = init;
+StgTVar_first_watch_queue_entry(tv) = stg_END_STM_WATCH_QUEUE_closure;
+StgTVar_num_updates(tv) = 0;
+
 return (tv);
 }
 
diff --git a/rts/STM.c b/rts/STM.c
index f8f56a2..568a401 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -1648,18 +1648,3 @@ void stmWriteTVar(Capability *cap,
 }
 
 /*..*/
-
-StgTVar *stmNewTVar(Capability *cap,
-StgClosure *new_value) {
-  StgTVar *result;
-  result = (StgTVar *)allocate(cap, sizeofW(StgTVar));
-  SET_HDR (result, stg_TVAR_info, CCS_SYSTEM);
-  result - current_value = new_value;
-  result - first_watch_queue_entry = END_STM_WATCH_QUEUE;
-#if defined(THREADED_RTS)
-  result - num_updates = 0;
-#endif
-  return result;
-}
-
-/*..*/
diff --git a/rts/STM.h b/rts/STM.h
index dd11bb8..799cac3 100644
--- a/rts/STM.h
+++ b/rts/STM.h
@@ -183,14 +183,6 @@ StgBool stmReWait(Capability *cap, StgTSO *tso);
 
 /*--
 
-   TVar management operations
-   --
-*/
-
-StgTVar *stmNewTVar(Capability *cap, StgClosure *new_value);
-
-/*--
-
Data access operations
--
 */



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: fix 'return' in cmm code when tablesNextToCode==False (811a19c)

2012-11-05 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/811a19c95bcb4d97a075134a45fb04f2e81acf4e

---

commit 811a19c95bcb4d97a075134a45fb04f2e81acf4e
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Nov 2 12:09:35 2012 +

fix 'return' in cmm code when tablesNextToCode==False

---

 compiler/cmm/CmmParse.y |6 ++
 compiler/cmm/MkGraph.hs |8 +---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 1291f64..dfa44ca 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -1065,6 +1065,12 @@ doReturn exprs_code = do
   updfr_off - getUpdFrameOff
   emit (mkReturnSimple dflags exprs updfr_off)
 
+mkReturnSimple  :: DynFlags - [CmmActual] - UpdFrameOffset - CmmAGraph
+mkReturnSimple dflags actuals updfr_off =
+  mkReturn dflags e actuals updfr_off
+  where e = entryCode dflags (CmmLoad (CmmStackSlot Old updfr_off)
+ (gcWord dflags))
+
 doRawJump :: CmmParse CmmExpr - [GlobalReg] - CmmParse ()
 doRawJump expr_code vols = do
   dflags - getDynFlags
diff --git a/compiler/cmm/MkGraph.hs b/compiler/cmm/MkGraph.hs
index 1536794..7971b1d 100644
--- a/compiler/cmm/MkGraph.hs
+++ b/compiler/cmm/MkGraph.hs
@@ -12,7 +12,7 @@ module MkGraph
   , mkJump, mkJumpExtra, mkDirectJump, mkForeignJump, mkForeignJumpExtra
   , mkRawJump
   , mkCbranch, mkSwitch
-  , mkReturn, mkReturnSimple, mkComment, mkCallEntry, mkBranch
+  , mkReturn, mkComment, mkCallEntry, mkBranch
   , copyInOflow, copyOutOflow
   , noExtraStack
   , toCall, Transfer(..)
@@ -23,7 +23,6 @@ import BlockId
 import Cmm
 import CmmCallConv
 
-
 import Compiler.Hoopl hiding (Unique, (*), mkFirst, mkMiddle, mkLast, 
mkLabel, mkBranch, Shape(..))
 import DynFlags
 import FastString
@@ -241,11 +240,6 @@ mkReturn dflags e actuals updfr_off =
   lastWithArgs dflags Ret  Old NativeReturn actuals updfr_off $
 toCall e Nothing updfr_off 0
 
-mkReturnSimple  :: DynFlags - [CmmActual] - UpdFrameOffset - CmmAGraph
-mkReturnSimple dflags actuals updfr_off =
-  mkReturn dflags e actuals updfr_off
-  where e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord dflags)
-
 mkBranch:: BlockId - CmmAGraph
 mkBranch bid = mkLast (CmmBranch bid)
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Save R1/R2/.. across foreign calls (8b25d39)

2012-11-05 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8b25d3953f2fa7055dc217e77a849cac92d2aa78

---

commit 8b25d3953f2fa7055dc217e77a849cac92d2aa78
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Nov 2 11:28:16 2012 +

Save R1/R2/.. across foreign calls

---

 rts/Exception.cmm |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/rts/Exception.cmm b/rts/Exception.cmm
index 3f1dc10..2b63328 100644
--- a/rts/Exception.cmm
+++ b/rts/Exception.cmm
@@ -55,6 +55,9 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ 
info_ptr)
 {
 CInt r;
 
+P_ ret;
+ret = R1;
+
 StgTSO_flags(CurrentTSO) = %lobits32(
   TO_W_(StgTSO_flags(CurrentTSO))  ~(TSO_BLOCKEX|TSO_INTERRUPTIBLE));
 
@@ -68,18 +71,18 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, 
W_ info_ptr)
  * thread, which might result in the thread being killed.
  */
 Sp_adj(-2);
-Sp(1) = R1;
+Sp(1) = ret;
 Sp(0) = stg_ret_p_info;
 SAVE_THREAD_STATE();
 (r) = ccall maybePerformBlockedException (MyCapability() ptr, 
   CurrentTSO ptr);
-
 if (r != 0::CInt) {
 if (StgTSO_what_next(CurrentTSO) == ThreadKilled::I16) {
 jump stg_threadFinished [];
 } else {
 LOAD_THREAD_STATE();
 ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+R1 = ret;
 jump %ENTRY_CODE(Sp(0)) [R1];
 }
 }
@@ -94,6 +97,7 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ 
info_ptr)
 }
 
 Sp_adj(1);
+R1 = ret;
 jump %ENTRY_CODE(Sp(0)) [R1];
 }
 
@@ -184,7 +188,10 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
 W_ level;
 
 /* Args: R1 :: IO a */
-STK_CHK_P (WDS(4), stg_unmaskAsyncExceptionszh, R1);
+P_ io;
+io = R1;
+
+STK_CHK_P (WDS(4), stg_unmaskAsyncExceptionszh, io);
 /* 4 words: one for the unblock frame, 3 for setting up the
  * stack to call maybePerformBlockedException() below.
  */
@@ -222,7 +229,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
  */
 Sp_adj(-3);
 Sp(2) = stg_ap_v_info;
-Sp(1) = R1;
+Sp(1) = io;
 Sp(0) = stg_enter_info;
 
 SAVE_THREAD_STATE();
@@ -235,6 +242,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
} else {
LOAD_THREAD_STATE();
ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+R1 = io;
 jump %ENTRY_CODE(Sp(0)) [R1];
}
 } else {
@@ -246,6 +254,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
 }
 TICK_UNKNOWN_CALL();
 TICK_SLOW_CALL_v();
+R1 = io;
 jump stg_ap_v_fast [R1];
 }
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Fix dependency generation when GhcLibWays = dyn p (11aa737)

2012-11-02 Thread Simon Marlow

On 01/11/2012 20:32, Ian Lynagh wrote:


If we want to stick with the current approach, then wouldn't it make
more sense for ghc -M to ignore any way flags and osuf/hisuf, and for
e.g. ghc -M -dep-suffix '' -dep-suffix p_ ... to generate rules for
.o/.hi and .p_o/.p_hi?


Yup, that's fine by me.

Cheers,
Simon



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Don't clearNurseries() in parallel with -debug (2073e3e)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2073e3ecc5dd0e37e097bd331f19a782eb96785d

---

commit 2073e3ecc5dd0e37e097bd331f19a782eb96785d
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Oct 31 12:38:06 2012 +

Don't clearNurseries() in parallel with -debug

It makes sanity-checking fail.

---

 includes/Rts.h |6 ++
 rts/sm/GC.c|8 +---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/includes/Rts.h b/includes/Rts.h
index b317768..edb48c1 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -306,6 +306,12 @@ TICK_VAR(2)
 #define DEBUG_ONLY(s) doNothing()
 #endif
 
+#ifdef DEBUG
+#define DEBUG_IS_ON   1
+#else
+#define DEBUG_IS_ON   0
+#endif
+
 /* 
-
Useful macros and inline functions
-- 
*/
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 8b92ca8..b9485f2 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -404,7 +404,7 @@ GarbageCollect (nat collect_gen,
   break;
   }
 
-  if (n_gc_threads != 1) {
+  if (!DEBUG_IS_ON  n_gc_threads != 1) {
   gct-allocated = clearNursery(cap);
   }
 
@@ -638,7 +638,7 @@ GarbageCollect (nat collect_gen,
   }
 
   // Reset the nursery: make the blocks empty
-  if (n_gc_threads == 1) {
+  if (DEBUG_IS_ON || n_gc_threads == 1) {
   for (n = 0; n  n_capabilities; n++) {
   allocated += clearNursery(capabilities[n]);
   }
@@ -1074,7 +1074,9 @@ gcWorkerThread (Capability *cap)
 
 scavenge_until_all_done();
 
-gct-allocated = clearNursery(cap);
+if (!DEBUG_IS_ON) {
+gct-allocated = clearNursery(cap);
+}
 
 #ifdef THREADED_RTS
 // Now that the whole heap is marked, we discard any sparks that



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: turn off cmm optimisation for the debug way (ee43ad5)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ee43ad528d57f0b31f47e56afdf5211141780239

---

commit ee43ad528d57f0b31f47e56afdf5211141780239
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Oct 31 13:50:54 2012 +

turn off cmm optimisation for the debug way

---

 rts/ghc.mk |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rts/ghc.mk b/rts/ghc.mk
index 36df61d..fe26ee1 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -130,7 +130,7 @@ ifneq $$(BINDIST) YES
 
 # The per-way CC_OPTS
 ifneq $$(findstring debug, $1) 
-rts_dist_$1_HC_OPTS =
+rts_dist_$1_HC_OPTS = -O0
 rts_dist_$1_CC_OPTS = -g -O0
 else
 rts_dist_$1_HC_OPTS = $$(GhcRtsHcOpts)



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Turn on -O2 for the RTS by default (3a6b1bf)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3a6b1bfb08602a8193b0025f0fe47ec8ddf8dad2

---

commit 3a6b1bfb08602a8193b0025f0fe47ec8ddf8dad2
Author: Simon Marlow marlo...@gmail.com
Date:   Fri Oct 26 11:12:49 2012 +0100

Turn on -O2 for the RTS by default

Optimisation now makes a difference when compiling .cmm code, because
it enables the optimisation passes in CmmPipeline.  Recently validate
has not been optimising the .cmm code because it uses SRC_HC_OPTS=-O0,
which explains why I couldn't reproduce #7366 in validate (the bug
miscompiled rts/PrimOps.cmm).

---

 mk/config.mk.in |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mk/config.mk.in b/mk/config.mk.in
index a906d25..f8d4d6a 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -360,9 +360,11 @@ LAX_DEPENDENCIES = NO
 # 
 # Options for GHC's RTS
 
-# For an optimised RTS (you probably don't want to change these; we build
-# a debugging RTS by default now.  Use -debug to get it).
-GhcRtsHcOpts=-optc-O2
+# Build an optimised RTS.  Remember that we need to turn on
+# optimisation both for C code (-optc-O2) and .cmm code (-O2).  For
+# the debugging RTS flavour, rts/ghc.mk overrides these to turn off
+# optimisation.
+GhcRtsHcOpts=-optc-O2 -O2
 GhcRtsCcOpts=-fomit-frame-pointer
 
 # Include the front panel code?  Needs GTK+.



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Add -fghci-hist-size=N to set the number of previous steps stored by :trace (458ee4f)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/458ee4fe496bf55a827900fe5fd1498dadfb8fb1

---

commit 458ee4fe496bf55a827900fe5fd1498dadfb8fb1
Author: Simon Marlow marlo...@gmail.com
Date:   Thu Nov 1 08:51:12 2012 +

Add -fghci-hist-size=N to set the number of previous steps stored by :trace

---

 compiler/main/DynFlags.hs|6 ++
 compiler/main/InteractiveEval.hs |   10 ++
 docs/users_guide/flags.xml   |6 ++
 docs/users_guide/ghci.xml|   13 +++--
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index d745cd6..4810ce8 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -670,6 +670,8 @@ data DynFlags = DynFlags {
 
   maxWorkerArgs :: Int,
 
+  ghciHistSize  :: Int,
+
   -- | MsgDoc output action: use ErrUtils instead of this if you can
   log_action:: LogAction,
   flushOut  :: FlushOut,
@@ -1227,6 +1229,8 @@ defaultDynFlags mySettings =
 
 maxWorkerArgs = 10,
 
+ghciHistSize = 50, -- keep a log of length 50 by default
+
 log_action = defaultLogAction,
 flushOut = defaultFlushOut,
 flushErr = defaultFlushErr,
@@ -2126,6 +2130,8 @@ dynamic_flags = [
 
   , Flag fmax-worker-args (intSuffix (\n d - d {maxWorkerArgs = n}))
 
+  , Flag fghci-hist-size (intSuffix (\n d - d {ghciHistSize = n}))
+
 -- Profiling 
 
 -- OLD profiling flags
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 64b2d33..9b9c14b 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -220,13 +220,15 @@ runStmtWithLocation source linenumber expr step =
 let ic = hsc_IC hsc_env
 bindings = (ic_tythings ic, ic_rn_gbl_env ic)
 
+size = ghciHistSize idflags'
+
 case step of
   RunAndLogSteps -
   traceRunStatus expr bindings tyThings
- breakMVar statusMVar status emptyHistory
+ breakMVar statusMVar status (emptyHistory size)
   _other -
   handleRunStatus expr bindings tyThings
-   breakMVar statusMVar status emptyHistory
+   breakMVar statusMVar status (emptyHistory size)
 
 runDecls :: GhcMonad m = String - m [Name]
 runDecls = runDeclsWithLocation interactive 1
@@ -268,8 +270,8 @@ withVirtualCWD m = do
 parseImportDecl :: GhcMonad m = String - m (ImportDecl RdrName)
 parseImportDecl expr = withSession $ \hsc_env - liftIO $ hscImport hsc_env 
expr
 
-emptyHistory :: BoundedList History
-emptyHistory = nilBL 50 -- keep a log of length 50
+emptyHistory :: Int - BoundedList History
+emptyHistory size = nilBL size
 
 handleRunStatus :: GhcMonad m =
String- ([TyThing],GlobalRdrEnv) - [Id]
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index d670cb9..bc1c228 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -511,6 +511,12 @@
 entryoption-fno-break-on-error/option/entry
   /row
   row
+
entryoption-fghci-hist-size=replaceablen/replaceable/option/entry
+entrylink linkend=ghci-debuggerSet the number of entries 
GHCi keeps for literal:history/literal/link/entry
+entrydynamic/entry
+entryoption(default is 50)/option/entry
+  /row
+  row
 entryoption-fprint-evld-with-show/option/entry
 entrylink linkend=breakpointsEnable usage of Show instances 
in literal:print/literal/link/entry
 entrydynamic/entry
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index 3d1aecc..c59f4b3 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -1715,8 +1715,7 @@ a :: a
   paraThe history is only available when
 using literal:trace/literal; the reason for this is we found that
 logging each breakpoint in the history cuts performance by a factor of
-2 or more.  GHCi remembers the last 50 steps in the history (perhaps in
-the future we'll make this configurable)./para
+2 or more.  By default, GHCi remembers the last 50 steps in the 
history, but this can be changed with the 
option-fghci-hist-size=replaceablen/replaceable/optionindextermprimaryoptionndash;fghci-hist-size/option/primary/indexterm
 option)./para
 /sect2
 
 sect2 id=ghci-debugger-exceptions
@@ -2381,10 +2380,12 @@ Prelude :. cmds.ghci
   indextermprimaryliteral:history/literal/primary/indexterm
 /term
listitem
- paraDisplay the history of evaluation steps

[commit: ghc] master: A couple of W_s should be P_s (not an actual bug, I think) (d28a722)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d28a72233550a907533751a6c4fccc472e5be4a0

---

commit d28a72233550a907533751a6c4fccc472e5be4a0
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Oct 31 13:49:36 2012 +

A couple of W_s should be P_s (not an actual bug, I think)

---

 rts/PrimOps.cmm |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 67a0a5a..6ff7dc0 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1070,8 +1070,8 @@ stg_newTVarzh (P_ init)
 
 stg_readTVarzh (P_ tvar)
 {
-  W_ trec;
-  W_ result;
+  P_ trec;
+  P_ result;
 
   // Call to stmReadTVar may allocate
   MAYBE_GC_P (stg_readTVarzh, tvar);



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix bug in stg_ctoi_R1n (could cause GHCi crashes) (26e576c)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/26e576c01a10053fe43920c3fa8dedf62707350a

---

commit 26e576c01a10053fe43920c3fa8dedf62707350a
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Oct 31 13:50:15 2012 +

Fix bug in stg_ctoi_R1n (could cause GHCi crashes)

---

 rts/StgMiscClosures.cmm |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
index 2985982..e6a30e6 100644
--- a/rts/StgMiscClosures.cmm
+++ b/rts/StgMiscClosures.cmm
@@ -127,7 +127,7 @@ INFO_TABLE_RET( stg_ctoi_R1n, RET_BCO )
 {
 Sp_adj(-2);
 Sp(1) = R1;
-Sp(0) = stg_ret_p_info;
+Sp(0) = stg_ret_n_info;
 jump stg_yield_to_interpreter [];
 }
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: The shape of StgTVar should not depend on THREADED_RTS (8703bbc)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8703bbcdcc9a47a29bccc4343dcea43868fbbeb6

---

commit 8703bbcdcc9a47a29bccc4343dcea43868fbbeb6
Author: Simon Marlow marlo...@gmail.com
Date:   Thu Nov 1 12:59:01 2012 +

The shape of StgTVar should not depend on THREADED_RTS

By shear luck I think this didn't lead to any actual runtime crashes,
but it did cause some problems for debugging.

---

 includes/rts/storage/Closures.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index fcba1eb..2302b7d 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -306,9 +306,7 @@ typedef struct {
   StgHeader  header;
   StgClosure*volatile current_value;
   StgTVarWatchQueue *volatile first_watch_queue_entry;
-#if defined(THREADED_RTS)
   StgInt volatile num_updates;
-#endif
 } StgTVar;
 
 typedef struct {



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix bug in stg_enter_checkbh (225172e)

2012-11-01 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/225172e68980ce948e2fd00aa2d8a81657207525

---

commit 225172e68980ce948e2fd00aa2d8a81657207525
Author: Simon Marlow marlo...@gmail.com
Date:   Thu Nov 1 13:02:57 2012 +

Fix bug in stg_enter_checkbh

This was causing crashes in stm050(ghci), throwto001(ghci), and
possibly more.

---

 rts/HeapStackCheck.cmm |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index b3ae264..fbceb76 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -221,7 +221,11 @@ INFO_TABLE_RET ( stg_enter_checkbh, RET_SMALL,
 {
 foreign C checkBlockingQueues(MyCapability() ptr,
 CurrentTSO);
-return (updatee);
+
+// we need to return updatee now.  Note that it might be a pointer
+// to an indirection or a tagged value, we don't know which, so we
+// need to ENTER() rather than return().
+ENTER(updatee);
 }
 
 /* 
-



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Fix popcnt calls (2293238)

2012-11-01 Thread Simon Marlow

On 01/11/12 17:29, Ian Lynagh wrote:

Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/229323898b0809047b19b79c181085430cce9850


---


commit 229323898b0809047b19b79c181085430cce9850
Author: Ian Lynagh i...@well-typed.com
Date:   Thu Nov 1 14:13:05 2012 +

 Fix popcnt calls

 We don't want to narrow the argument size before making the foreign
 call: Word8 still gets passed as a Word-sized argument


I'm not sure this is right (I added the narrowing, FWIW).  The fact that 
Word8 gets promoted to Word is part of the C ABI, and we don't want to 
do that when popcnt is being implemented directly by the native codegen. 
 I know it is currently broken on some platforms, but I think the fix 
is to implement the proper type promotion in the compilation of C calls.


Cheers,
Simon




---


  compiler/codeGen/StgCmmPrim.hs |   15 +--
  1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 650a12e..fe2a021 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -485,16 +485,11 @@ emitPrimOp _  [] SetByteArrayOp [ba,off,len,c] =
  doSetByteArrayOp ba off len c

  -- Population count
-emitPrimOp dflags [res] PopCnt8Op [w] =
-  emitPopCntCall res (CmmMachOp (mo_WordTo8 dflags) [w]) W8
-emitPrimOp dflags [res] PopCnt16Op [w] =
-  emitPopCntCall res (CmmMachOp (mo_WordTo16 dflags) [w]) W16
-emitPrimOp dflags [res] PopCnt32Op [w] =
-  emitPopCntCall res (CmmMachOp (mo_WordTo32 dflags) [w]) W32
-emitPrimOp _  [res] PopCnt64Op [w] =
-  emitPopCntCall res w W64 -- arg always has type W64, no need to narrow
-emitPrimOp dflags [res] PopCntOp [w] =
-  emitPopCntCall res w (wordWidth dflags)
+emitPrimOp _  [res] PopCnt8Op  [w] = emitPopCntCall res w W8
+emitPrimOp _  [res] PopCnt16Op [w] = emitPopCntCall res w W16
+emitPrimOp _  [res] PopCnt32Op [w] = emitPopCntCall res w W32
+emitPrimOp _  [res] PopCnt64Op [w] = emitPopCntCall res w W64
+emitPrimOp dflags [res] PopCntOp   [w] = emitPopCntCall res w (wordWidth 
dflags)

  -- The rest just translate straightforwardly
  emitPrimOp dflags [res] op [arg]



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc




___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Validate failures of the day

2012-10-31 Thread Simon Marlow
Here's a selection of today's validate failures on x86_64/Linux for your 
enjoyment.


   1 unexpected passes
  13 unexpected failures

And that's on our best supported platform.  Now, one of those is due to 
local changes in my tree, and another 4 are due to a linking issue that 
breaks a few RTS tests on recent Linux distros (--as-needed stuff).  3 
are silly perf test failures.  The rest are pasted below.


Remember the good old days when we used to get the clean validate 
message? :)


Cheers,
Simon

--- ./typecheck/should_fail/T5691.stderr2012-10-31 11:21:51.0 
+
+++ ./typecheck/should_fail/T5691.comp.stderr	2012-10-31 
12:17:02.102562238 +

@@ -1,6 +1,11 @@

 T5691.hs:14:9:
 Couldn't match type `p' with `PrintRuleInterp'
+  `p' is untouchable
+inside the constraints ()
+bound by the type signature for
+   test :: PrintRuleInterp a - PrintRuleInterp a
+at T5691.hs:14:3-6
 Expected type: PrintRuleInterp a
   Actual type: p a
 In the pattern: f :: p a
@@ -9,6 +14,11 @@

 T5691.hs:15:24:
 Couldn't match type `p' with `PrintRuleInterp'
+  `p' is untouchable
+inside the constraints ()
+bound by the type signature for
+   test :: PrintRuleInterp a - PrintRuleInterp a
+at T5691.hs:14:3-6
 Expected type: PrintRuleInterp a
   Actual type: p a
 Relevant bindings include f :: p a (bound at T5691.hs:14:9)
*** unexpected failure for T5691(normal)


--- ./typecheck/should_fail/T7264.stderr2012-10-31 11:21:51.0 
+
+++ ./typecheck/should_fail/T7264.comp.stderr	2012-10-31 
12:17:02.670563611 +

@@ -1,10 +1,6 @@

 T7264.hs:13:19:
 Couldn't match type `a' with `forall r. r - String'
-  `a' is untouchable
-inside the constraints ()
-bound by the inferred type of mkFoo2 :: a - Maybe Foo
-at T7264.hs:13:1-32
   `a' is a rigid type variable bound by
   the inferred type of mkFoo2 :: a - Maybe Foo at T7264.hs:13:1
 Expected type: a - Foo



--- ./cabal/ghcpkg03.stderr 2012-10-29 13:53:32.0 +
+++ ./cabal/ghcpkg03.run.stderr 2012-10-31 12:18:56.230835671 +
@@ -7,7 +7,7 @@
 testpkg-1.2.3.4: cannot find any of [A.hi,A.p_hi,A.dyn_hi] 
(ignoring)
 testpkg-1.2.3.4: cannot find any of [B.hi,B.p_hi,B.dyn_hi] 
(ignoring)
 testpkg-1.2.3.4: cannot find any of [C/D.hi,C/D.p_hi,C/D.dyn_hi] 
(ignoring)
-testpkg-1.2.3.4: cannot find any of 
[libtestpkg-1.2.3.4.a,libtestpkg-1.2.3.4.p_a,libtestpkg-1.2.3.4-ghc7.7.20121025.so,libtestpkg-1.2.3.4-ghc7.7.20121025.dylib,testpkg-1.2.3.4-ghc7.7.20121025.dll] 
on library path (ignoring)
+testpkg-1.2.3.4: cannot find any of 
[libtestpkg-1.2.3.4.a,libtestpkg-1.2.3.4.p_a,libtestpkg-1.2.3.4-ghc7.7.20121031.so,libtestpkg-1.2.3.4-ghc7.7.20121031.dylib,testpkg-1.2.3.4-ghc7.7.20121031.dll] 
on library path (ignoring)

*** unexpected failure for ghcpkg03(normal)

--- ./cabal/ghcpkg05.stderr 2012-10-29 13:53:32.0 +
+++ ./cabal/ghcpkg05.run.stderr 2012-10-31 12:18:56.738836856 +
@@ -9,7 +9,7 @@
   cannot find any of [B.hi,B.p_hi,B.dyn_hi]
   cannot find any of [C/D.hi,C/D.p_hi,C/D.dyn_hi]
   cannot find any of [C/E.hi,C/E.p_hi,C/E.dyn_hi]
-  cannot find any of 
[libtestpkg-2.0.a,libtestpkg-2.0.p_a,libtestpkg-2.0-ghc7.7.20121025.so,libtestpkg-2.0-ghc7.7.20121025.dylib,testpkg-2.0-ghc7.7.20121025.dll] 
on library path
+  cannot find any of 
[libtestpkg-2.0.a,libtestpkg-2.0.p_a,libtestpkg-2.0-ghc7.7.20121031.so,libtestpkg-2.0-ghc7.7.20121031.dylib,testpkg-2.0-ghc7.7.20121031.dll] 
on library path


 The following packages are broken, either because they have a problem
 listed above, or because they depend on a broken package.
*** unexpected failure for ghcpkg05(normal)


--- /dev/null   2012-09-24 09:11:13.204241107 +0100
+++ ./ghci/scripts/T5130.run.stderr 2012-10-31 12:18:23.418758823 +
@@ -0,0 +1,12 @@
+
+interactive:3:35:
+Couldn't match expected type `a' with actual type `[Char]'
+  `a' is a rigid type variable bound by
+  the inferred type of f :: (a, a) - [a] at interactive:3:5
+Relevant bindings include
+  f :: (a, a) - [a] (bound at interactive:3:5)
+  x :: a (bound at interactive:3:12)
+  y :: a (bound at interactive:3:20)
+In the expression: hi
+In the expression: [x, hi]
+In the expression: (\ (x :: a, y :: a) - [x, hi])
*** unexpected failure for T5130(ghci)


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Retainer prof: immutable arrays are not retainers, and fix the docs (ab5008d)

2012-10-31 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ab5008d4498177dd375f942618ceab46ae37671a

---

commit ab5008d4498177dd375f942618ceab46ae37671a
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Oct 30 14:40:01 2012 +

Retainer prof: immutable arrays are not retainers, and fix the docs

---

 docs/users_guide/profiling.xml |4 ++--
 rts/RetainerProfile.c  |5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml
index 25db080..5589fa9 100644
--- a/docs/users_guide/profiling.xml
+++ b/docs/users_guide/profiling.xml
@@ -884,8 +884,8 @@ MAINMAIN102   0
0.00.0   100.0  1
   by defining what we mean by a retainer:/para
 
   blockquote
-   paraA retainer is either the system stack, or an unevaluated
-   closure (thunk)./para
+paraA retainer is either the system stack, an unevaluated
+closure (thunk), or an explicitly mutable object./para
   /blockquote
 
   paraIn particular, constructors are emphasisnot/emphasis
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index 5f9164b..24745ea 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -1013,8 +1013,6 @@ isRetainer( StgClosure *c )
 case MUT_VAR_DIRTY:
 case MUT_ARR_PTRS_CLEAN:
 case MUT_ARR_PTRS_DIRTY:
-case MUT_ARR_PTRS_FROZEN:
-case MUT_ARR_PTRS_FROZEN0:
 
// thunks are retainers.
 case THUNK:
@@ -1071,6 +1069,9 @@ isRetainer( StgClosure *c )
 case ARR_WORDS:
// STM
 case TREC_CHUNK:
+// immutable arrays
+case MUT_ARR_PTRS_FROZEN:
+case MUT_ARR_PTRS_FROZEN0:
return rtsFalse;
 
//



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Fix C macro bug that was causing some stack checks to erroneously succeed (984149b)

2012-10-31 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/984149bf8845dd897e038943b6177ae4fb184591

---

commit 984149bf8845dd897e038943b6177ae4fb184591
Author: Simon Marlow marlo...@gmail.com
Date:   Wed Oct 31 11:18:36 2012 +

Fix C macro bug that was causing some stack checks to erroneously succeed

---

 includes/Cmm.h |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/includes/Cmm.h b/includes/Cmm.h
index 211d2a8..5ef6c2d 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -372,8 +372,8 @@
CCCS_ALLOC(bytes);
 
 #define HEAP_CHECK(bytes,failure)   \
-Hp = Hp + bytes;\
-if (Hp  HpLim) { HpAlloc = bytes; failure; }   \
+Hp = Hp + (bytes);  \
+if (Hp  HpLim) { HpAlloc = (bytes); failure; } \
 TICK_ALLOC_HEAP_NOCTR(bytes);
 
 #define ALLOC_PRIM_WITH_CUSTOM_FAILURE(bytes,failure)   \
@@ -400,8 +400,8 @@
 #define HP_CHK_P(bytes, fun, arg)   \
HEAP_CHECK(bytes, GC_PRIM_P(fun,arg))
 
-#define ALLOC_P_TICKY(alloc, fun, arg) \
-   HP_CHK_P(alloc);   \
+#define ALLOC_P_TICKY(alloc, fun, arg)  \
+   HP_CHK_P(alloc); \
TICK_ALLOC_HEAP_NOCTR(alloc);
 
 #define CHECK_GC()  \
@@ -473,22 +473,22 @@
}
 
 #define STK_CHK(n, fun) \
-if (Sp - n  SpLim) {   \
+if (Sp - (n)  SpLim) { \
 GC_PRIM(fun)\
 }
 
 #define STK_CHK_P(n, fun, arg)  \
-if (Sp - n  SpLim) {   \
+if (Sp - (n)  SpLim) { \
 GC_PRIM_P(fun,arg)  \
 }
 
 #define STK_CHK_PP(n, fun, arg1, arg2)  \
-if (Sp - n  SpLim) {   \
+if (Sp - (n)  SpLim) { \
 GC_PRIM_PP(fun,arg1,arg2)   \
 }
 
 #define STK_CHK_ENTER(n, closure)   \
-if (Sp - n  SpLim) {   \
+if (Sp - (n)  SpLim) { \
 jump __stg_gc_enter_1(closure); \
 }
 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: Windows falures

2012-10-30 Thread Simon Marlow

ghcpkg03 and ghcpkg05 are not Windows-specific:

Actual stderr output differs from expected:
--- ./cabal/ghcpkg03.stderr 2012-10-29 13:53:32.0 +
+++ ./cabal/ghcpkg03.run.stderr 2012-10-30 11:44:26.723934678 +
@@ -7,7 +7,7 @@
 testpkg-1.2.3.4: cannot find any of [A.hi,A.p_hi,A.dyn_hi] 
(ignoring)
 testpkg-1.2.3.4: cannot find any of [B.hi,B.p_hi,B.dyn_hi] 
(ignoring)
 testpkg-1.2.3.4: cannot find any of [C/D.hi,C/D.p_hi,C/D.dyn_hi] 
(ignoring)
-testpkg-1.2.3.4: cannot find any of 
[libtestpkg-1.2.3.4.a,libtestpkg-1.2.3.4.p_a,libtestpkg-1.2.3.4-ghc7.7.20121025.so,libtestpkg-1.2.3.4-ghc7.7.20121025.dylib,testpkg-1.2.3.4-ghc7.7.20121025.dll] 
on library path (ignoring)
+testpkg-1.2.3.4: cannot find any of 
[libtestpkg-1.2.3.4.a,libtestpkg-1.2.3.4.p_a,libtestpkg-1.2.3.4-ghc7.7.20121029.so,libtestpkg-1.2.3.4-ghc7.7.20121029.dylib,testpkg-1.2.3.4-ghc7.7.20121029.dll] 
on library path (ignoring)
 testpkg-2.0: Warning: library-dirs: /usr/local/lib/testpkg doesn't 
exist or isn't a directory
 testpkg-2.0: Warning: include-dirs: /usr/local/include/testpkg doesn't 
exist or isn't a directory
 testpkg-2.0: import-dirs: /usr/local/lib/testpkg doesn't exist or 
isn't a directory (ignoring)


I'm also seeing a failure in T7341, is this one of yours Simon?

--- ./polykinds/T7341.stderr2012-10-29 13:53:33.0 +
+++ ./polykinds/T7341.comp.stderr   2012-10-30 11:43:27.107809209 +
@@ -1 +1,6 @@

\ No newline at end of file
+T7341.hs:11:12:
+Expecting one more argument to `[]'
+The first argument of `C' should have kind `*',
+  but `[]' has kind `* - *'
+In the instance declaration for `C []'
*** unexpected failure for T7341(normal)


Cheers,
Simon


On 30/10/2012 08:06, Simon Peyton-Jones wrote:

Ian

As discussed, here are the failures I get on 32 bit Windows with MSYS:

../../libraries/random/tests   rangeTest [bad exit code]
(normal)

cabal  ghcpkg03 [bad stderr] (normal)

cabal  ghcpkg05 [bad stderr] (normal)

codeGen/should_run cgrun071 [bad exit code] (normal)

driver shared001 [bad stderr] (normal)

ghci.debugger/scripts  break011 [bad stdout] (ghci)

ghci.debugger/scripts  dynbrk009 [bad exit code] (ghci)

ghci/linking   ghcilink004 [bad exit code]
(normal)

ghci/scripts   T5975a [bad stderr] (ghci)

ghci/scripts   T6106 [bad stderr] (ghci)

ghci/scripts   ghci058 [bad stderr] (ghci)

rtsT7037 [bad exit code] (normal)

I’ve cut/pasted the relevant log output below.  Happy to help if you
have any difficulty reproducing.  This is with my validate.mk saying

LAX_DEPENDENCIES = YES

WERROR  = -Werror

GhcStage1HcOpts += -O0 -DDEBUG

GhcStage2HcOpts += -dcore-lint -ticky

GhcLibHcOpts+= -dcore-lint

GhcLibWays = v

SplitObjs  = NO

(the -ticky is accidental but should do no harm.)

thanks

Simon

= rangeTest(normal) 3246 of 3460 [1, 35, 1]

cd ../../libraries/random/tests 
'C:/code/HEAD/inplace/bin/ghc-stage2.exe' -fforce-recomp -dcore-lint
-dcmm-lint -dno-debug-output -no-user-package-db -rtsopts
-fno-ghci-history -o rangeTest rangeTest.hsrangeTest.comp.stderr 21

cd ../../libraries/random/tests  ./rangeTest/dev/null
 rangeTest.run.stdout 2rangeTest.run.stderr

Wrong exit code (expected 0 , actual 1 )

Stdout:

Int:  Passed

Integer:  Passed

Int8:  Passed

Int16:  Passed

Int32:  Passed

Int64:  Passed

Word:  Passed

Word8:  Passed

Word16:  Passed

Word32:  Passed

Word64:  Passed

Double:  Passed

Float:  Passed

CChar:  Passed

CSChar:  Passed

CUChar:  Passed

CShort:  Passed

CUShort:  Passed

CInt:  Passed

CUInt:  Passed

CLong:  Passed

CULong:  Passed

CPtrdiff:  Passed

CSize:  Passed

CWchar:  Passed

CSigAtomic:  Passed

CLLong:  Passed

CULLong:  Passed

CIntPtr:  Passed

CUIntPtr:  Passed

CIntMax:  Passed

CUIntMax:  Passed

Int R:  Passed

Integer R:  Passed

Int8 R:  Passed

Int8 Rsmall:  Passed

Int8 Rmini:  Passed

Int8 Rtrivial:  Passed

Int16 R:  Passed

Int32 R:  Passed

Int64 R:  Passed

Word R:  Passed

Word8 R:  Passed

Word16 R:  Passed

Word32 R:  Passed

Word64 R:  Passed

Double R:  Passed

Float R:  Passed

CChar R:  Passed

CSChar R:  Passed

CUChar R:  Passed

CShort R:  Passed

CUShort R:  Passed

CInt R:  Passed

CUInt R:  Passed

CLong R:  Passed

CULong R:  Passed

CPtrdiff R:  Passed

CSize R:  Passed

CWchar R:

Stderr:

rangeTest.exe: broke lower bound: 100

*** unexpected failure for rangeTest(normal)

= ghcpkg03(normal) 75 of 3460 [1, 0, 1]

cd ./cabal  $MAKE -s --no-print-directory ghcpkg03/dev/null
 ghcpkg03.run.stdout 2ghcpkg03.run.stderr

Actual stderr output differs from expected:

--- ./cabal/ghcpkg03.stderr-mingw32  2012-05-03 

[commit: ghc] master: INFO_TABLE_RET should generate a CmmRetInfoLabel, not a CmmInfoLabel (4444dd8)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/dd88a2021cc8acb05550a16110a20d95c017

---

commit dd88a2021cc8acb05550a16110a20d95c017
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Oct 29 13:49:57 2012 +

INFO_TABLE_RET should generate a CmmRetInfoLabel, not a CmmInfoLabel

Fixes this, when building unregisterised:

rts/dist/build/AutoApply.hc:87:1:
 error: ‘stg_ap_v_entry’ undeclared (first use in this function)

---

 compiler/cmm/CmmParse.y |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index c483502..a02e742 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -482,7 +482,7 @@ info:: { CmmParse (CLabel, Maybe CmmInfoTable, 
[LocalReg]) }
do let prof = NoProfilingInfo
   rep  = mkRTSRep (fromIntegral $5) $ mkStackRep []
   return (mkCmmRetLabel pkg $3,
-  Just $ CmmInfoTable { cit_lbl = mkCmmInfoLabel 
pkg $3
+  Just $ CmmInfoTable { cit_lbl = 
mkCmmRetInfoLabel pkg $3
, cit_rep = rep
, cit_prof = prof, cit_srt = 
NoC_SRT },
   []) }
@@ -497,7 +497,7 @@ info:: { CmmParse (CLabel, Maybe CmmInfoTable, 
[LocalReg]) }
   bitmap = mkLiveness dflags (map Just (drop 1 live))
   rep  = mkRTSRep (fromIntegral $5) $ mkStackRep bitmap
   return (mkCmmRetLabel pkg $3,
-  Just $ CmmInfoTable { cit_lbl = mkCmmInfoLabel 
pkg $3
+  Just $ CmmInfoTable { cit_lbl = 
mkCmmRetInfoLabel pkg $3
, cit_rep = rep
, cit_prof = prof, cit_srt = 
NoC_SRT },
   live) }



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: ghc] master: Make DYNAMIC_BY_DEFAULT=NO when GhcUnregisterised (092c0bd)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/092c0bd466230cf248ecb996fd5891c413ed7b7d

---

commit 092c0bd466230cf248ecb996fd5891c413ed7b7d
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Oct 29 13:50:35 2012 +

Make DYNAMIC_BY_DEFAULT=NO when GhcUnregisterised

---

 mk/config.mk.in |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/mk/config.mk.in b/mk/config.mk.in
index 366d511..a906d25 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -136,8 +136,17 @@ SharedLibsByDefaultPlatformList =   \
  x86_64-unknown-linux   \
  x86_64-apple-darwin
 
-DYNAMIC_BY_DEFAULT = $(if $(filter $(TARGETPLATFORM),\
-   $(SharedLibsByDefaultPlatformList)),YES,NO)
+# DYANMIC_BY_DEFAULT says whether this compiler will default to
+# building dynamic executables, i.e. -dynamic is on.  We do this for
+# certain platforms because it lets us use the system dynamic linker
+# instead of our own linker for GHCi.
+#
+# We do not enable this for an unregisterised build.  It is currently
+# unknown whether shared libraries (should) work when unregisterised.
+#
+DYNAMIC_BY_DEFAULT = $(strip $(if $(filter YES,$(GhcUnregisterised)),NO,\
+ $(if $(filter $(TARGETPLATFORM),\
+   $(SharedLibsByDefaultPlatformList)),YES,NO)))
 
 # Build a compiler that will build *unregisterised* libraries and
 # binaries by default.  Unregisterised code is supposed to compile and



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: make it optional to have DynamicByDefault, to support older GHCs (65ab228)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/65ab2281b3a3024220d02a8aa557cfe5a4cba118

---

commit 65ab2281b3a3024220d02a8aa557cfe5a4cba118
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Oct 29 10:37:31 2012 +

make it optional to have DynamicByDefault, to support older GHCs

It's often useful to be able to say 'make TEST_HC=ghc' to check that a
test really fails with a different GHC.

---

 mk/ghc-config.hs |   64 +
 1 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/mk/ghc-config.hs b/mk/ghc-config.hs
index 77efbcd..b667b84 100644
--- a/mk/ghc-config.hs
+++ b/mk/ghc-config.hs
@@ -7,22 +7,22 @@ main = do
 
   info - readProcess ghc [+RTS, --info] 
   let fields = read info :: [(String,String)]
-  getGhcField fields HostOS Host OS
-  getGhcField fields WORDSIZE Word size
-  getGhcField fields TARGETPLATFORM Target platform
-  getGhcField fields TargetOS_CPP Target OS
-  getGhcField fields TargetARCH_CPP Target architecture
+  getGhcFieldOrFail fields HostOS Host OS
+  getGhcFieldOrFail fields WORDSIZE Word size
+  getGhcFieldOrFail fields TARGETPLATFORM Target platform
+  getGhcFieldOrFail fields TargetOS_CPP Target OS
+  getGhcFieldOrFail fields TargetARCH_CPP Target architecture
 
   info - readProcess ghc [--info] 
   let fields = read info :: [(String,String)]
 
-  getGhcField fields GhcStage Stage
-  getGhcField fields GhcWithNativeCodeGen Have native code generator
-  getGhcField fields GhcWithInterpreter Have interpreter
-  getGhcField fields GhcUnregisterised Unregisterised
-  getGhcField fields GhcWithSMP Support SMP
-  getGhcField fields GhcRTSWays RTS ways
-  getGhcField fields GhcDynamicByDefault Dynamic by default
+  getGhcFieldOrFail fields GhcStage Stage
+  getGhcFieldOrFail fields GhcWithNativeCodeGen Have native code generator
+  getGhcFieldOrFail fields GhcWithInterpreter Have interpreter
+  getGhcFieldOrFail fields GhcUnregisterised Unregisterised
+  getGhcFieldOrFail fields GhcWithSMP Support SMP
+  getGhcFieldOrFail fields GhcRTSWays RTS ways
+  getGhcFieldOrDefault fields GhcDynamicByDefault Dynamic by default NO
   getGhcFieldProgWithDefault fields AR ar command ar
 
   let pkgdb_flag = case lookup Project version fields of
@@ -32,20 +32,36 @@ main = do
   putStrLn $ GhcPackageDbFlag ++ '=':pkgdb_flag
 
 
-getGhcField :: [(String,String)] - String - String - IO ()
-getGhcField fields mkvar key =
-   case lookup key fields of
-  Nothing  - fail (No field:  ++ key)
-  Just val - putStrLn (mkvar ++ '=':val)
+getGhcFieldOrFail :: [(String,String)] - String - String - IO ()
+getGhcFieldOrFail fields mkvar key
+   = getGhcField fields mkvar key id (fail (No field:  ++ key))
+
+getGhcFieldOrDefault :: [(String,String)] - String - String - String - IO 
()
+getGhcFieldOrDefault fields mkvar key deflt
+  = getGhcField fields mkvar key id on_fail
+  where
+on_fail = putStrLn (mkvar ++ '=' : deflt)
+
+getGhcFieldProgWithDefault
+   :: [(String,String)]
+   - String - String - String
+   - IO ()
+getGhcFieldProgWithDefault fields mkvar key deflt
+  = getGhcField fields mkvar key fix on_fail
+  where
+fix val = fixSlashes (fixTopdir topdir val)
+topdir = fromMaybe  (lookup LibDir fields)
+on_fail = putStrLn (mkvar ++ '=' : deflt)
 
-getGhcFieldProgWithDefault :: [(String,String)]
-   - String - String - String - IO ()
-getGhcFieldProgWithDefault fields mkvar key deflt = do
+getGhcField
+   :: [(String,String)] - String - String
+   - (String - String)
+   - IO ()
+   - IO ()
+getGhcField fields mkvar key fix on_fail =
case lookup key fields of
-  Nothing  - putStrLn (mkvar ++ '=' : deflt)
-  Just val - putStrLn (mkvar ++ '=' : fixSlashes (fixTopdir topdir val))
- where
-  topdir = fromMaybe  (lookup LibDir fields)
+  Nothing  - on_fail
+  Just val - putStrLn (mkvar ++ '=' : fix val)
 
 fixTopdir :: String - String - String
 fixTopdir t  = 



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: add test for #7319 (23ad5a9)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/23ad5a9841b2e2935daf2fc35e534ad3f8232494

---

commit 23ad5a9841b2e2935daf2fc35e534ad3f8232494
Author: Simon Marlow marlo...@gmail.com
Date:   Mon Oct 29 10:46:47 2012 +

add test for #7319

---

 tests/codeGen/should_run/T7319.hs |   11 +++
 tests/codeGen/should_run/T7319.stderr |5 +
 tests/codeGen/should_run/all.T|6 ++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/tests/codeGen/should_run/T7319.hs 
b/tests/codeGen/should_run/T7319.hs
new file mode 100644
index 000..5159744
--- /dev/null
+++ b/tests/codeGen/should_run/T7319.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE BangPatterns, MagicHash #-}
+import Control.Exception
+import System.Environment
+import GHC.Exts
+
+main = do
+  args - getArgs
+  foo args
+
+foo _ = let !e = toException (ErrorCall test) in
+raise# e
diff --git a/tests/codeGen/should_run/T7319.stderr 
b/tests/codeGen/should_run/T7319.stderr
new file mode 100644
index 000..4d3bc94
--- /dev/null
+++ b/tests/codeGen/should_run/T7319.stderr
@@ -0,0 +1,5 @@
+*** Exception (reporting due to +RTS -xc): (base:GHC.Exception.SomeException), 
stack trace: 
+  Main.foo,
+  called from Main.main,
+  called from Main.CAF
+T7319: test
diff --git a/tests/codeGen/should_run/all.T b/tests/codeGen/should_run/all.T
index cef3994..f2fbe43 100644
--- a/tests/codeGen/should_run/all.T
+++ b/tests/codeGen/should_run/all.T
@@ -94,3 +94,9 @@ test('setByteArray', normal, compile_and_run, [''])
 test('6146', normal, compile_and_run, [''])
 test('T5900', normal, compile_and_run, [''])
 test('T7163', normal, compile_and_run, [''])
+
+# Gives different results when optimised, so restrict to just one way
+test('T7319', [ extra_ways(['prof']), only_ways(['prof']), exit_code(1),
+req_profiling,
+extra_hc_opts('-fprof-auto'),
+extra_run_opts('+RTS -xc') ], compile_and_run, [''])



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: fix HAVE_VANILLA when we have both static profiling and vanilla libs (03a016b)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/03a016b75d9a5216709a5d60c7c207613e1e

---

commit 03a016b75d9a5216709a5d60c7c207613e1e
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Oct 30 11:36:20 2012 +

fix HAVE_VANILLA when we have both static profiling and vanilla libs

---

 mk/test.mk |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mk/test.mk b/mk/test.mk
index 3784d8f..586cb8b 100644
--- a/mk/test.mk
+++ b/mk/test.mk
@@ -46,7 +46,7 @@ RUNTEST_OPTS += -e ghc_with_native_codegen=0
 endif
 
 HASKELL98_LIBDIR := $(shell $(GHC_PKG) field haskell98 library-dirs | sed 
's/^[^:]*: *//')
-HAVE_VANILLA := $(shell if [ -f $(subst 
\,/,$(HASKELL98_LIBDIR))/libHShaskell98-*.a ]; then echo YES; else echo NO; fi)
+HAVE_VANILLA := $(shell if [ -f $(subst 
\,/,$(HASKELL98_LIBDIR))/libHShaskell98-*[0-9].a ]; then echo YES; else echo 
NO; fi)
 HAVE_PROFILING := $(shell if [ -f $(subst 
\,/,$(HASKELL98_LIBDIR))/libHShaskell98-*_p.a ]; then echo YES; else echo NO; 
fi)
 
 ifeq $(HAVE_VANILLA) YES



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


[commit: testsuite] master: accept (46a856a)

2012-10-30 Thread Simon Marlow
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/46a856ae42719d31a92c74f949fa353b539a58ba

---

commit 46a856ae42719d31a92c74f949fa353b539a58ba
Author: Simon Marlow marlo...@gmail.com
Date:   Tue Oct 30 12:01:55 2012 +

accept

---

 tests/ghci.debugger/scripts/break011.stdout |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ghci.debugger/scripts/break011.stdout 
b/tests/ghci.debugger/scripts/break011.stdout
index afaa1fd..b84023b 100644
--- a/tests/ghci.debugger/scripts/break011.stdout
+++ b/tests/ghci.debugger/scripts/break011.stdout
@@ -16,8 +16,8 @@ _result :: a
 Stopped at exception thrown
 _exception :: e
 already at the beginning of the history
-_exception = SomeException (ErrorCall foo)
+_exception = SomeException foo
 _result :: a = _
-_exception :: SomeException = SomeException (ErrorCall foo)
+_exception :: SomeException = SomeException foo
 *** Exception: foo
 *** Exception: foo



___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


Re: [commit: ghc] master: Fix dependency generation when GhcLibWays = dyn p (11aa737)

2012-10-30 Thread Simon Marlow

On 30/10/2012 02:48, Ian Lynagh wrote:


+# Setting hisuf/osuf is a kludge. If DYNAMIC_BY_DEFAULT is on, dyn is
+# the first way, and p is another way, then without this kludge we run
+# ghc -M -hisuf dyn_hi -osuf dyn_o -dep-suffix dyn -dep-suffix p
+# which means we get dependencies for .dyn_hi/.dyn_o and .p_dyn_hi/.p_dyn_o
+# rather than .dyn_hi/.dyn_o and .p_hi/.p_o.
+# With the kludge we also get .hi/.o dependencies that we don't need, but
+# they don't do any harm.
+# We also specify -static, as otherwise we end up with some dependencies
+# on .dyn_dyn_hi files
+$1_$2_MKDEPENDHS_FLAGS += -static -hisuf hi -osuf o

  ifneq $$(NO_GENERATED_MAKEFILE_RULES) YES

@@ -34,8 +44,9 @@ $$($1_$2_depfile_haskell) : $$(includes_H_CONFIG) 
$$(includes_H_PLATFORM)
  $$($1_$2_depfile_haskell) : $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) 
$$($1_$2_HC_MK_DEPEND_DEP) | (dir @)/.
$$(call removeFiles,$$@.tmp)
  ifneq $$($1_$2_HS_SRCS) 
-   $$($1_$2_HC_MK_DEPEND) -M $$($1_$2_MKDEPENDHS_FLAGS) \
+   $$($1_$2_HC_MK_DEPEND) -M \
$$(filter-out -split-objs, $$($1_$2_$$(firstword 
$$($1_$2_WAYS))_ALL_HC_OPTS)) \
+   $$($1_$2_MKDEPENDHS_FLAGS) \
$$($1_$2_HS_SRCS)
  endif
echo $1_$2_depfile_haskell_EXISTS = YES  $$@.tmp


I encountered this yesterday.  I wonder whether we could just use 
$$($1_$2_v_ALL_HC_OPTS) instead of $$($1_$2_$$(firstword 
$$($1_$2_WAYS))_ALL_HC_OPTS), and then we wouldn't need the kludge 
(though we'd still need a comment to explain why).  Wouldn't that be better?


Cheers,
Simon


___
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc


  1   2   3   4   5   6   7   8   9   10   >