RE: whole program optimization

2007-12-28 Thread Simon Peyton-Jones
| Am Sonntag, 23. Dezember 2007 13:35 schrieb Isaac Dupree:
|  GHC optimizes less effectively when parts of a program are in different
|  modules, or are exported from a module.
|
| By the way, does GHC do cross-package optimization (not just cross-module
| optimization within packages)?

GHC does cross-package inlining just as it does cross-module inlining, which is 
I guess what you mean. This has the downside that you can't re-link with 
another version of the same package, even if it exports the same API.  But it 
makes a huge difference to optimization.

Simon
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: External Core - my goal

2007-12-28 Thread Neil Mitchell
Hi

  2) Compile all the associate libraries and modules to generate
  separate GHC Core files for each. Convert each Core file to Yhc Core.
  Link the Yhc Core files together.
 

 Now that I've read this more carefully -- I think plan (2) is your
 best bet. In theory, you should be able to do (2) now, using the HEAD.
 In practice, I'm sure there are bugs in the API code that I just added
 (and I haven't tested multiple-module programs), so you should try it
 out and holler

Fantastic, will do that in a few days time.

 (1) has the problem that you would have to implement a demodulizer for
 Core -- I don't think this would be all that hard, but there would be
 some of the same issues that exist for demodulizing Haskell, and it
 would take time. Of course, a Haskell demodulizer, HAllinOne, already
 exists, so that could be used as a guide.

Demodulizing Core should be trivial compared to HAllinOne - but we can
leave that for the moment if the other route is closer.

 Compiling the Core for the libraries should be easy enough. The way
 I've been doing it for my purposes is by creating a list of all the
 library Haskell source filenames, and running them through
 compileToCore (because GHC's automatic dependency-finding won't take
 care of this for me for package modules.) The main tricky bit for me
 has been dealing with GHC primitives. There are a lot of them. I don't
 know whether Catch needs to know what the semantics of the primitives
 are, though.

Catch assumes if a primitive is given all non-_|_ arguments, it
returns a non-_|_ result but assumes nothing more. This should be
sufficient for most primitives. There is also a mechanism for
overriding the definition of certain primitives. I don't expect
primitives to be more than a days work, and I can ignore the vast
majority of them.

Thanks

Neil
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: patch applied (cabal): make rawSystemStdout put its temp files in the temp dir rather than cwd

2007-12-28 Thread Gregory Wright


Hi Duncan,

(Cross-posting to ghc-users since some of the issues were brought up  
there.)


On Dec 2, 2007, at 5:04 PM, Duncan Coutts wrote:


Sun Dec  2 14:06:20 PST 2007  Duncan Coutts [EMAIL PROTECTED]
 * make rawSystemStdout put its temp files in the temp dir rather  
than cwd

 Should fixe reported wierdness with finding program version numbers

   M ./Distribution/Simple/Utils.hs -2 +4



I saw this problem when trying to build 6.8.1 on a mac (Leopard/Intel)  
using
6.4 to build compiler.  I edited rawSystemStdout to put the tmp files  
directory
in /tmp instead of using getTemporaryDirectory.  On this combination  
of compilers,
moving the temporary file did not fix the problem of finding the  
program version
number.  The underlying error was that the temp file was reported to  
still

be locked.

Building 6.8.2 with another 6.8.2 eliminated the program version  
problem,
but I have seen two other intermittent errors which seem to be  
related.  (Reported
in trac as issue #1992.)  Building 6.8.2 with 6.8.2 using the MacPorts  
infrastructure,

I get this error about half the time:

	../compiler/stage1/ghc-inplace -M -optdep-f -optdep.depend-BASE  - 
osuf o -I../includes   -H16m -O -I/opt/local/include -I/usr/include -L/ 
opt/local/lib -L/usr/lib -iutils -ibasicTypes -itypes -ihsSyn - 
iprelude -irename -itypecheck -ideSugar -icoreSyn -ivectorise - 
ispecialise -isimplCore -istranal -istgSyn -isimplStg -icodeGen -imain  
-iprofiling -iparser -icprAnalysis -indpFlatten -iiface -icmm - 
inativeGen -ighci -Wall -fno-warn-name-shadowing -fno-warn-orphans - 
Istage2 -package hpc -package bytestring -DGHCI -package template- 
haskell -DGHCI_TABLES_NEXT_TO_CODE -package readline -DUSE_READLINE - 
cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -Iparser -package  
unix -package Cabal -ignore-package lang -recomp -Rghc-timing -H16M '- 
#include cutils.h' -package-name ghc-6.8.2 -fgenerics basicTypes/ 
BasicTypes.lhs basicTypes/DataCon.lhs basicTypes/Demand.lhs basicTypes/ 
Id.lhs basicTypes/IdInfo.lhs basicTypes/Literal.lhs basicTypes/ 
MkId.lhs basicTypes/Module.lhs basicTypes/Name.lhs basicTypes/ 
NameEnv.lhs basicTypes/NameSet.lhs basicTypes/NewDemand.lhs basicTypes/ 
OccName.lhs basicTypes/RdrName.lhs basicTypes/SrcLoc.lhs basicTypes/ 
UniqSupply.lhs basicTypes/Unique.lhs basicTypes/Var.lhs basicTypes/ 
VarEnv.lhs basicTypes/VarSet.lhs cmm/CLabel.hs cmm/Cmm.hs cmm/ 
CmmBrokenBlock.hs cmm/CmmCPS.hs cmm/CmmCPSGen.hs cmm/CmmCallConv.hs  
cmm/CmmInfo.hs cmm/CmmLex.hs cmm/CmmLint.hs cmm/CmmLive.hs cmm/ 
CmmOpt.hs cmm/CmmParse.hs cmm/CmmProcPoint.hs cmm/CmmUtils.hs cmm/ 
Dataflow.hs cmm/MachOp.hs cmm/PprC.hs cmm/PprCmm.hs codeGen/Bitmap.hs  
codeGen/CgBindery.lhs codeGen/CgCallConv.hs codeGen/CgCase.lhs codeGen/ 
CgClosure.lhs codeGen/CgCon.lhs codeGen/CgExpr.lhs codeGen/ 
CgForeignCall.hs codeGen/CgHeapery.lhs codeGen/CgHpc.hs codeGen/ 
CgInfoTbls.hs codeGen/CgLetNoEscape.lhs codeGen/CgMonad.lhs codeGen/ 
CgParallel.hs codeGen/CgPrimOp.hs codeGen/CgProf.hs codeGen/ 
CgStackery.lhs codeGen/CgTailCall.lhs codeGen/CgTicky.hs codeGen/ 
CgUtils.hs codeGen/ClosureInfo.lhs codeGen/CodeGen.lhs codeGen/ 
SMRep.lhs coreSyn/CoreFVs.lhs coreSyn/CoreLint.lhs coreSyn/ 
CorePrep.lhs coreSyn/CoreSubst.lhs coreSyn/CoreSyn.lhs coreSyn/ 
CoreTidy.lhs coreSyn/CoreUnfold.lhs coreSyn/CoreUtils.lhs coreSyn/ 
ExternalCore.lhs coreSyn/MkExternalCore.lhs coreSyn/PprCore.lhs  
coreSyn/PprExternalCore.lhs cprAnalysis/CprAnalyse.lhs deSugar/ 
Check.lhs deSugar/Coverage.lhs deSugar/Desugar.lhs deSugar/ 
DsArrows.lhs deSugar/DsBinds.lhs deSugar/DsCCall.lhs deSugar/ 
DsExpr.lhs deSugar/DsForeign.lhs deSugar/DsGRHSs.lhs deSugar/ 
DsListComp.lhs deSugar/DsMeta.hs deSugar/DsMonad.lhs deSugar/ 
DsUtils.lhs deSugar/Match.lhs deSugar/MatchCon.lhs deSugar/ 
MatchLit.lhs ghci/ByteCodeAsm.lhs ghci/ByteCodeFFI.lhs ghci/ 
ByteCodeGen.lhs ghci/ByteCodeInstr.lhs ghci/ByteCodeItbls.lhs ghci/ 
ByteCodeLink.lhs ghci/Debugger.hs ghci/GhciMonad.hs ghci/GhciTags.hs  
ghci/InteractiveUI.hs ghci/Linker.lhs ghci/ObjLink.lhs ghci/ 
RtClosureInspect.hs hsSyn/Convert.lhs hsSyn/HsBinds.lhs hsSyn/ 
HsDecls.lhs hsSyn/HsDoc.hs hsSyn/HsExpr.lhs hsSyn/HsImpExp.lhs hsSyn/ 
HsLit.lhs hsSyn/HsPat.lhs hsSyn/HsSyn.lhs hsSyn/HsTypes.lhs hsSyn/ 
HsUtils.lhs iface/BinIface.hs iface/BuildTyCl.lhs iface/IfaceEnv.lhs  
iface/IfaceSyn.lhs iface/IfaceType.lhs iface/LoadIface.lhs iface/ 
MkIface.lhs iface/TcIface.lhs main/BreakArray.hs main/CmdLineParser.hs  
main/CodeOutput.lhs main/Config.hs main/Constants.lhs main/ 
DriverMkDepend.hs main/DriverPhases.hs main/DriverPipeline.hs main/ 
DynFlags.hs main/ErrUtils.lhs main/Finder.lhs main/GHC.hs main/ 
HeaderInfo.hs main/HscMain.lhs main/HscStats.lhs main/HscTypes.lhs  
main/InteractiveEval.hs main/Main.hs main/PackageConfig.hs main/ 
Packages.lhs main/ParsePkgConf.hs main/PprTyThing.hs main/ 
StaticFlags.hs main/SysTools.lhs main/TidyPgm.lhs nativeGen/ 
AsmCodeGen.lhs nativeGen/GraphBase.hs nativeGen/GraphColor.hs  

Rank-2 polymorphism and pattern matching

2007-12-28 Thread Jim Apple
The following won't compile for me

isnull :: (forall a . [a]) - Bool
isnull ([] :: forall b . [b]) = True

   Couldn't match expected type `forall b. [b]'
   against inferred type `[a]'
In the pattern: []

Wrapping it in a constructor doesn't help, though I can define a null:

data NullList = NullList (forall a . [a])
null = NullList []

isnull2 :: NullList - Bool
isnull2 (NullList []) = True

Why?

Jim
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users