Refactor SrcLoc and SrcSpan The "Unhelpful" cases are now in a separate type. This allows us to improve various things, e.g.: * Most of the panic's in SrcLoc are now gone * The Lexer now works with RealSrcSpans rather than SrcSpans, i.e. it knows that it has real locations and thus can assume that the line number etc really exists * Some of the more suspicious cases are no longer necessary, e.g. we no longer need this case in advanceSrcLoc: advanceSrcLoc loc _ = loc -- Better than nothing More improvements can probably be made, e.g. tick locations can probably use RealSrcSpans too.
Merge in new code generator branch. This changes the new code generator to make use of the Hoopl package for dataflow analysis. Hoopl is a new boot package, and is maintained in a separate upstream git repository (as usual, GHC has its own lagging darcs mirror in http://darcs.haskell.org/packages/hoopl). During this merge I squashed recent history into one patch. I tried to rebase, but the history had some internal conflicts of its own which made rebase extremely confusing, so I gave up. The history I squashed was: - Update new codegen to work with latest Hoopl - Add some notes on new code gen to cmm-notes - Enable Hoopl lag package. - Add SPJ note to cmm-notes - Improve GC calls on new code generator. Work in this branch was done by: - Milan Straka <fox@ucw.cz> - John Dias <dias@cs.tufts.edu> - David Terei <davidterei@gmail.com> Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD and fixed a few bugs.
More modules that need LANGUAGE BangPatterns
Don't restrict filenames in line pragmas to printable characters; fixes #4207 "printable" is ASCII-only, whereas in other locales we can get things like # 1 "<lĂnea-de-orden>"
Remove an unnecessary #include
Fix #3741, simplifying things in the process The problem in #3741 was that we had confused column numbers with byte offsets, which fails in the case of UTF-8 (amongst other things). Fortunately we're tracking correct column offsets now, so we didn't have to make a calculation based on a byte offset. I got rid of two fields from the PState (last_line_len and last_offs).and one field from the AI (alex input) constructor.
Columns now start at 1, as lines already did Also corrected a couple of line 0's to line 1
Comments only
Hide warnings from alex/happy sources
Require a bang pattern when unlifted types are where/let bound; #3182 For now we only get a warning, rather than an error, because the alex and happy templates don't follow the new rules yet.
Merging in the new codegen branch This merge does not turn on the new codegen (which only compiles a select few programs at this point), but it does introduce some changes to the old code generator. The high bits: 1. The Rep Swamp patch is finally here. The highlight is that the representation of types at the machine level has changed. Consequently, this patch contains updates across several back ends. 2. The new Stg -> Cmm path is here, although it appears to have a fair number of bugs lurking. 3. Many improvements along the CmmCPSZ path, including: o stack layout o some code for infotables, half of which is right and half wrong o proc-point splitting
Fix CodingStyle#Warnings URLs
Use OPTIONS rather than OPTIONS_GHC for pragmas Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modules
annotate C-- calls that do not return * The correct definition of C-- requires that a procedure not 'fall off the end'. The 'never returns' annotation tells us if a (foreign) call is not going to return. Validated!
Document use of no-break space in lexer for C--
Added 'return' to C--, and made arguments to 'jump' into CmmExpr
parseInteger->parseUnsignedInteger to clarify meaning I decided against adding parseSignedInteger since octal and hex literals often have junk between the '-' and the digits, but, compare to Util.readRational which does handle signed numbers. Also since Integers - mathematically and in Haskell - can be negative, normally.
Fixed a minor redundancy in the C-- lexer
Fixed the C-- lexer to comply with the standard on hex escape sequences. The C-- standard [1] says in Section 3.3.5 "Character literals" that: - the hex escape sequence "must contain at least one and at most two hexdigits." - the octal escape sequence "must contain at least one and at most three octdigits." [1] Norman Ramsey, Simon Peyton Jones, and Christian Lindig. "The C-- Language Specication, Version 2.0 ( CVS Revision 1.128 )" <http://www.cminusminus.org/extern/man2.pdf>