Ticket #645: rts-V-flag.patch

File rts-V-flag.patch, 37.7 KB (added by simonmar, 9 years ago)
2New patches:
4[new RTS flag: -V to modify the resolution of the RTS timer
5Simon Marlow <[email protected]>**20060228134746
7 Also, now an arbitrarily short context switch interval may now be
8 specified, as we increase the RTS ticker's resolution to match the
9 requested context switch interval.  This also applies to +RTS -i (heap
10 profiling) and +RTS -I (the idle GC timer).  +RTS -V is actually only
11 required for increasing the resolution of the profile timer.
12] {
13hunk ./ghc/docs/users_guide/runtime_control.xml 87
15+  <sect2 id="rts-options-misc">
16+    <title>Miscellaneous RTS options</title>
18+    <variablelist>
19+     <varlistentry>
20+       <term><option>-V<replaceable>secs</replaceable></option></term>
21+       <indexterm><primary><option>-V</option></primary><secondary>RTS
22+       option</secondary></indexterm>
23+       <listitem>
24+         <para>Sets the interval that the RTS clock ticks at.  The
25+         runtime uses a single timer signal to count ticks; this timer
26+         signal is used to control the context switch timer (<xref
27+         linkend="sec-using-concurrent" />) and the heap profiling
28+         timer <xref linkend="rts-options-heap-prof" />.  Also, the
29+         time profiler uses the RTS timer signal directly to record
30+         time profiling samples.</para>
32+         <para>Normally, setting the <option>-V</option> option
33+         directly is not necessary: the resolution of the RTS timer is
34+         adjusted automatically if a short interval is requested with
35+         the <option>-C</option> or <option>-i</option> options.
36+         However, setting <option>-V</option> is required in order to
37+         increase the resolution of the time profiler.</para>
38+       </listitem>
39+     </varlistentry>
40+    </variablelist>
41+  </sect2>
42hunk ./ghc/docs/users_guide/using.xml 1517
43-           switches occur every 20ms.  Note that GHC's internal timer ticks
44-           every 20ms, and the context switch timer is always a multiple of
45-           this timer, so 20ms is the maximum granularity available for timed
46-           context switches.</para>
47+           switches occur every 20ms.</para>
48hunk ./ghc/includes/Cmm.h 508
50-/* -----------------------------------------------------------------------------
51-   Misc junk
52-   -------------------------------------------------------------------------- */
54-#define TICK_MILLISECS   (1000/TICK_FREQUENCY)   /* ms per tick */
55hunk ./ghc/includes/RtsFlags.h 45
56-    int idleGCDelayTicks;      /* in milliseconds */
57+    int idleGCDelayTime;       /* in milliseconds */
58hunk ./ghc/includes/RtsFlags.h 116
59+struct MISC_FLAGS {
60+    int tickInterval;     /* in milliseconds */
63hunk ./ghc/includes/RtsFlags.h 306
64+    struct MISC_FLAGS        MiscFlags;
65hunk ./ghc/includes/mkDerivedConstants.c 370
66+    struct_field_("RtsFlags_MiscFlags_tickInterval",
67+                 RTS_FLAGS, MiscFlags.tickInterval);
68hunk ./ghc/rts/PrimOps.cmm 1957
69-    time = foreign "C" getourtimeofday();
70-    target = (R1 / (TICK_MILLISECS*1000)) + time;
71+    time = foreign "C" getourtimeofday() [R1];
72+    target = (R1 / (TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags))*1000)) + time;
73hunk ./ghc/rts/Profiling.c 280
74-       fprintf(prof_file, "\"%d ms\"\n", TICK_MILLISECS);
75+       fprintf(prof_file, "\"%d ms\"\n", RtsFlags.MiscFlags.tickInterval);
76hunk ./ghc/rts/Profiling.c 733
77-           total_prof_ticks / (StgFloat) TICK_FREQUENCY,
78-           total_prof_ticks, TICK_MILLISECS);
79+           total_prof_ticks * RtsFlags.MiscFlags.tickInterval,
80+           total_prof_ticks, RtsFlags.MiscFlags.tickInterval);
81hunk ./ghc/rts/Proftimer.c 59
83-    RtsFlags.ProfFlags.profileIntervalTicks =
84-       RtsFlags.ProfFlags.profileInterval / TICK_MILLISECS;
85hunk ./ghc/rts/RtsFlags.c 29
86-#include "Timer.h"             /* CS_MIN_MILLISECS */
87hunk ./ghc/rts/RtsFlags.c 175
88-    RtsFlags.GcFlags.idleGCDelayTicks   = 300 / TICK_MILLISECS; /* ticks */
89+    RtsFlags.GcFlags.idleGCDelayTime    = 300; /* millisecs */
90hunk ./ghc/rts/RtsFlags.c 217
91-    RtsFlags.ConcFlags.ctxtSwitchTime  = CS_MIN_MILLISECS;  /* In milliseconds */
92+    RtsFlags.MiscFlags.tickInterval       = 50;  /* In milliseconds */
93+    RtsFlags.ConcFlags.ctxtSwitchTime    = 50;  /* In milliseconds */
94hunk ./ghc/rts/RtsFlags.c 221
95-    RtsFlags.ParFlags.nNodes           = 1;
96+    RtsFlags.ParFlags.nNodes             = 1;
97hunk ./ghc/rts/RtsFlags.c 811
98-                   /* Convert to ticks */
99+                   /* Convert to millisecs */
100hunk ./ghc/rts/RtsFlags.c 813
101-                   if (cst > 0 && cst < TICK_MILLISECS) {
102-                       cst = TICK_MILLISECS;
103-                   } else {
104-                       cst = cst / TICK_MILLISECS;
105-                   }
106-                   RtsFlags.GcFlags.idleGCDelayTicks = cst;
107+                   RtsFlags.GcFlags.idleGCDelayTime = cst;
108hunk ./ghc/rts/RtsFlags.c 1009
109-                   cst = (cst / CS_MIN_MILLISECS) * CS_MIN_MILLISECS;
110-                   if (cst != 0 && cst < CS_MIN_MILLISECS)
111-                       cst = CS_MIN_MILLISECS;
113hunk ./ghc/rts/RtsFlags.c 1023
114-                   cst = (cst / CS_MIN_MILLISECS) * CS_MIN_MILLISECS;
115-                   if (cst != 0 && cst < CS_MIN_MILLISECS)
116-                       cst = CS_MIN_MILLISECS;
118hunk ./ghc/rts/RtsFlags.c 1027
119+             case 'V': /* master tick interval */
120+               if (rts_argv[arg][2] == '\0') {
121+                   RtsFlags.MiscFlags.tickInterval = 0;
122+                   // turns off ticks completely
123+               } else {
124+                   I_ cst; /* tmp */
126+                   /* Convert to milliseconds */
127+                   cst = (I_) ((atof(rts_argv[arg]+2) * 1000));
128+                   RtsFlags.MiscFlags.tickInterval = cst;
129+               }
130+               break;
132hunk ./ghc/rts/RtsFlags.c 1140
134+    // Determine what tick interval we should use for the RTS timer
135+    // by taking the shortest of the various intervals that we need to
136+    // monitor.
137+    if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
138+       RtsFlags.MiscFlags.tickInterval =
139+           stg_min(RtsFlags.ConcFlags.ctxtSwitchTime,
140+                   RtsFlags.MiscFlags.tickInterval);
141+    }
143+    if (RtsFlags.GcFlags.idleGCDelayTime > 0) {
144+       RtsFlags.MiscFlags.tickInterval =
145+           stg_min(RtsFlags.GcFlags.idleGCDelayTime,
146+                   RtsFlags.MiscFlags.tickInterval);
147+    }
149+#ifdef PROFILING
150+    if (RtsFlags.ProfFlags.profileInterval > 0) {
151+       RtsFlags.MiscFlags.tickInterval =
152+           stg_min(RtsFlags.ProfFlags.profileInterval,
153+                   RtsFlags.MiscFlags.tickInterval);
154+    }
157+    if (RtsFlags.ConcFlags.ctxtSwitchTicks > 0) {
158+       RtsFlags.ConcFlags.ctxtSwitchTicks =
159+           RtsFlags.ConcFlags.ctxtSwitchTime / RtsFlags.MiscFlags.tickInterval;
160+    } else {
161+       RtsFlags.ConcFlags.ctxtSwitchTicks = 0;
162+    }
164+#ifdef PROFILING
165+    RtsFlags.ProfFlags.profileIntervalTicks =
166+       RtsFlags.ProfFlags.profileInterval / RtsFlags.MiscFlags.tickInterval;
168hunk ./ghc/rts/RtsStartup.c 205
169-    startTimer(TICK_MILLISECS);
170+    startTimer();
171hunk ./ghc/rts/Schedule.c 2703
172-  RtsFlags.ConcFlags.ctxtSwitchTicks =
173-      RtsFlags.ConcFlags.ctxtSwitchTime / TICK_MILLISECS;
175hunk ./ghc/rts/Timer.c 54
176-          * If we've been inactive for idleGCDelayTicks (set by +RTS
177+          * If we've been inactive for idleGCDelayTime (set by +RTS
178hunk ./ghc/rts/Timer.c 61
179-             ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTicks;
180+             ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTime /
181+                 RtsFlags.MiscFlags.tickInterval;
182hunk ./ghc/rts/Timer.c 68
183-                 ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTicks;
184+                 ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTime /
185+                     RtsFlags.MiscFlags.tickInterval;
186hunk ./ghc/rts/Timer.c 91
187-startTimer(nat ms)
189hunk ./ghc/rts/Timer.c 97
190-  return startTicker(ms, handle_tick);
191+  return startTicker(RtsFlags.MiscFlags.tickInterval, handle_tick);
192hunk ./ghc/rts/Timer.c 101
195hunk ./ghc/rts/Timer.h 3
196- * (c) The GHC Team, 1995-2005
197+ * (c) The GHC Team, 1995-2006
198hunk ./ghc/rts/Timer.h 12
199-# define TICK_MILLISECS   (1000/TICK_FREQUENCY)   /* ms per tick */
201-/* Context switch timing constants. Context switches happen after a
202- * whole number of ticks, the default being every tick.
203- */
204-#define CS_MIN_MILLISECS TICK_MILLISECS       /* milliseconds per slice */
206hunk ./ghc/rts/Timer.h 14
207-extern int startTimer(nat ms);
208+extern int startTimer(void);
209hunk ./ghc/rts/posix/Itimer.c 213
210-  return ((lnat)tv.tv_sec * TICK_FREQUENCY +
211-         (lnat)tv.tv_usec * TICK_FREQUENCY / 1000000);
212+  return (((lnat)tv.tv_sec * 1000) / RtsFlags.MiscFlags.tickInterval,
213+         (lnat)tv.tv_usec / (RtsFlags.MiscFlags.tickInterval*1000));
215hunk ./ghc/rts/posix/Select.c 129
216-             * TICK_MILLISECS * 1000;
217+             * RtsFlags.MiscFlags.tickInterval * 1000;
222[slightly better dependencies for GenApply.hs
223Simon Marlow <[email protected]>**20060227153828]
224[x86_64: include .type and .size directives in the output, for valgrind
225Simon Marlow <[email protected]>**20060227152822]
226[The initStablePtrTable should be called before ACQUIRE_LOCK(&stable_mutex)
227[email protected]**20060222202912]
228[support LOCK_DEBUG for Windows
229[email protected]**20060222201721]
230[mmap() errors on Darwin: use errorBelch/exit instead of barf()
231Simon Marlow <[email protected]>**20060227111103
233 The most likely cause is out-of-memory, not an RTS error.
235[remove empty .SECONDARY target
236Simon Marlow <[email protected]>**20060227105939
238 This works around a problem with recent versions of GNU make that take
239 a long time when all targets are declared intermediate with
240 .SECONDARY.  See
242   https://savannah.gnu.org/bugs/?func=detailitem&item_id=15584
244 for discussion of the GNU make issue.
246[these tables have four columns, not three
247[email protected]**20060225215945]
248[Remove comment about imports and exports not being in the renamer result.
249Lemmih <[email protected]>**20060226120407]
250[NCG: fix mkRegRegMoveInstr for x86-64
251[email protected]**20060225225920]
252[NCG: Fix Typo in Register Allocator Loop Patch
253[email protected]**20060225033954
255 Fix previous patch "NCG: Handle loops in register allocator"
256 Of course, I broke it when correcting a style problem just before committing.
258[NCG: Handle loops in register allocator
259[email protected]**20060225031434
261 Fill in the missing parts in the register allocator so that it can
262 handle loops.
264 *) The register allocator now runs in the UniqSuppy monad, as it needs
265    to be able to generate unique labels for fixup code blocks.
267 *) A few functions have been added to RegAllocInfo:
268        mkRegRegMoveInstr -- generates a good old move instruction
269        mkBranchInstr     -- used to be MachCodeGen.genBranch
270        patchJump         -- Change the destination of a jump
272 *) The register allocator now makes sure that only one spill slot is used
273    for each temporary, even if it is spilled and reloaded several times.
274    This obviates the need for memory-to-memory moves in fixup code.
278 *) The case where the fixup code needs to cyclically permute a group of
279    registers is currently unhandled. This will need more work once we come
280    accross code where this actually happens.
282 *) Register allocation for code with loop is probably very inefficient
283    (both at compile-time and at run-time).
285 *) We still cannot compile the RTS via NCG, for various other reasons.
288[Oops, I got a little trigger happy while trimming package.conf.in.
289Lemmih <[email protected]>**20060224223704]
290[Prettify parts of RnNames. No change of functionality.
291Lemmih <[email protected]>**20060224215020]
292[Remove duplicate code from RnNames.
293Lemmih <[email protected]>**20060224212748]
294[Remove non-existing modules from package.conf.in
295Lemmih <[email protected]>**20060224203727]
296[Remove some unused bindings frm RnNames.
297Lemmih <[email protected]>**20060224165409]
298[Rather large refactoring of RnNames.
299Lemmih <[email protected]>**20060224154704
301 This restructoring makes the renamed export and import lists
302 available in IDE mode.
305[add file to go with "extract some of the generic..." patch
306Simon Marlow <[email protected]>**20060224144126]
307[extract some of the generic C-- optimisations from the NCG
308Simon Marlow <[email protected]>**20060224111753]
309[oops, undo accidental addition of package-time settings
310Simon Marlow <[email protected]>**20060224143051]
311[turn off a trace
312Simon Marlow <[email protected]>**20060224124608]
313[add instance Outputable CLabel
314Simon Marlow <[email protected]>**20060224124349]
315[-O2 implies -optc-O2 now
316Simon Marlow <[email protected]>**20060224124033]
317[lag/drag/void: add an extra assertion, and some commentary
318Simon Marlow <[email protected]>**20060223155120]
319[lag/drag/void profiling fix
320Simon Marlow <[email protected]>**20060223155046
322 We were searching the wrong part of the heap for dead objects, this
323 was broken by recent changes to the step structure: from-space is now
324 in step->old_blocks, not step->blocks.  Fortunately some assertions in
325 ProfHeap picked up the problem.
327[add (trivial) support for STM objects in lag/drag/void profiling
328Simon Marlow <[email protected]>**20060223154859]
329[bugfix for LDV profiling on 64-bit platforms
330Simon Marlow <[email protected]>**20060223150904
332 There was an integer overflow in the definition of LDV_RECORD_CREATE
333 when StgWord is 64 bits.
335[warning fix
336Simon Marlow <[email protected]>**20060223144537]
337[further fix for floating point primitives
338Simon Marlow <[email protected]>**20060223143013]
339[Comment wibbles
340[email protected]**20060223142101]
341[Wibbles to instance validity checking
342[email protected]**20060223134154]
343[Fix comment
344[email protected]**20060223130104]
345[Improve error reporting for type-improvement errors
346[email protected]**20060223130029]
347[Reject polytypes in instance declarations (for now anyway)
348[email protected]**20060223125958]
349[Remove duplicate comment
350[email protected]**20060210104028]
351[Add renamed fixities to HsGroup.
352Lemmih <[email protected]>**20060222173648]
353[oops, initialize atomic_modify_mutvar_mutex
354Simon Marlow <[email protected]>**20060222163827]
355[check black holes before doing GC in scheduleDoHeapProfile()
356Simon Marlow <[email protected]>**20060222160733
358 fixes #687, see comment for details.
360[fix for ASSIGN_BaseReg() in the unregisterised way
361Simon Marlow <[email protected]>**20060222141836]
362[floating-point fix for x86_64
363Simon Marlow <[email protected]>**20060222140719
365 For 32-bit float primtives like sinFloat#, we currently call the
366 double versions of the C library functions (sin(), cos() etc.).  It
367 seems more correct to call the float versions (sinf(), cosf() etc.).
368 This makes a difference on x86_64, I'm not entirely sure why, but this
369 way at least generates more consistent results and avoids extra
370 promotion/demotion instructions when calling these primitives.
373[fix a deadlock in atomicModifyMutVar#
374Simon Marlow <[email protected]>**20060221163711
376 atomicModifyMutVar# was re-using the storage manager mutex (sm_mutex)
377 to get its atomicity guarantee in SMP mode. But recently the addition
378 of a call to dirty_MUT_VAR() to implement the read barrier lead to a
379 rare deadlock case, because dirty_MUT_VAR() very occasionally needs to
380 allocate a new block to chain on the mutable list, which requires
381 sm_mutex.
383[warning fix
384Simon Marlow <[email protected]>**20060221163308]
385[Mention the 'Encoding' module in package.conf.in
386Lemmih <[email protected]>**20060221105147]
387[Loosen the rules for instance declarations (Part 3)
388Ross Paterson <[email protected]>**20060213161044
390 Relax the restrictions on derived instances in the same way, so we
391 can write
393        data MinHeap h a = H a (h a) deriving (Show)
395[If we don't have libreadline then we need some dummy definition for complete* functions.
396[email protected]**20060212095019]
397[SMP bugfix: reload capability from task->cap after scheduleDoGC
398[email protected]**20060212034736]
399[SMP support (xchg(), cas() and mb()) for PowerPC
400[email protected]**20060212033352]
401[Bugfix in completion code for :set and :unset.
402Lemmih <[email protected]>**20060210181319]
403[Completion for :set, :unset and :undef.
404Lemmih <[email protected]>**20060210171728]
405[oops, forgot some more SMP->THREADED_RTS conversions
406Simon Marlow <[email protected]>**20060210153236]
407[fix test for REG_BaseReg (it's spelled REG_Base)
408Simon Marlow <[email protected]>**20060210123552]
409[Change CVS for _darcs in dirs to prune during make dist
410Duncan Coutts <[email protected]>**20060209093204]
411[fix for dirty_MUT_VAR: don't try to recordMutableCap in gen 0
412Simon Marlow <[email protected]>**20060210120021]
413[STM fix from Tim Harris
414Simon Marlow <[email protected]>**20060210112111
416 Fixes assertion failures with STM and -debug.  Tim says:
417 Sorry, it's a problem in how nested transactions are handled in
418 non-SMP builds.  It'll bite when trying to commit a nested transaction
419 which has read from a TVar but not updated it.
421 The call to validate_and_acquire_ownership in
422 stmCommitNestedTransaction should be the same as that in
423 stmCommitNestedTransaction, i.e.:
425   result = validate_and_acquire_ownership(trec, (!use_read_phase), TRUE);
428[improvement to the deadlock detection
429Simon Marlow <[email protected]>*-20060209123056
431 When the RTS is idle, as detected by the timer signal, instead of
432 prodding capabilities from the signal handler (which is not guaranteed
433 to work - pthread_cond_signal() can't be called from signal handlers),
434 create a new thread to do it.
436[Simplify the -B handling. The interface to the ghc library has changed slightly.
437Lemmih <[email protected]>**20060210094601]
438[Fix desugaring of unboxed tuples
439[email protected]**20060209175328
441 This patch is a slightly-unsatisfactory fix to desugaring unboxed
442 tuples; it fixes ds057 which has been failing for some time.
444 Unsatisfactory because rather ad hoc -- but that applies to lots
445 of the unboxed tuple stuff.
448[x86_64: fix case of out-of-range operands to leaq
449Simon Marlow <[email protected]>**20060209162247]
450[Merge the smp and threaded RTS ways
451Simon Marlow <[email protected]>**20060209154449
453 Now, the threaded RTS also includes SMP support.  The -smp flag is a
454 synonym for -threaded.  The performance implications of this are small
455 to negligible, and it results in a code cleanup and reduces the number
456 of combinations we have to test.
458[change dirty_MUT_VAR() to use recordMutableCap()
459Simon Marlow <[email protected]>**20060209150420
460 rather than recordMutableGen(), the former works better in SMP
462[improvement to the deadlock detection
463Simon Marlow <[email protected]>**20060209123056
465 When the RTS is idle, as detected by the timer signal, instead of
466 prodding capabilities from the signal handler (which is not guaranteed
467 to work - pthread_cond_signal() can't be called from signal handlers),
468 create a new thread to do it.
470[Fix typo
471[email protected]**20060209124208]
472[Fix instance rules for functional dependencies
473[email protected]**20060209113531
475 GHC 6.4 implements a rather relaxed version of the Coverage Condition
476 which is actually too relaxed: the compiler can get into an infinite loop
477 as a result.
479 This commit fixes the problem (see Note [Coverage condition] in FunDeps.lhs)
480 and documents the change.
482 I also took the opportunity to add documentation about functional dependencies,
483 taken from the Hugs manual with kind permission of Mark Jones
486[fix for the unregisterised way
487Simon Marlow <[email protected]>**20060209105058
489 We always assign to BaseReg on return from resumeThread(), but in
490 cases where BaseReg is not an lvalue (eg. unreg) we need to disable
491 this assigment.  See comments for more details.
493[prof/smp combination probably doesn't work, disable it
494Simon Marlow <[email protected]>**20060209104815]
495[tiny panic msg fix
496Simon Marlow <[email protected]>**20060209102540]
497[Loosen the rules for instance declarations (Part 2)
498[email protected]**20060209102129
500 Tidying up to Ross's  patch, plus adding documenation for it.
504[relaxed instance termination test
505Ross Paterson <[email protected]>**20060206111651
507 With -fglasgow-exts but not -fallow-undecidable-instances, GHC 6.4
508 requires that instances be of the following form:
510  (1) each assertion in the context must constrain distinct variables
511      mentioned in the head, and
513  (2) at least one argument of the head must be a non-variable type.
515 This patch replaces these rules with the requirement that each assertion
516 in the context satisfy
518  (1) no variable has more occurrences in the assertion than in the head, and
520  (2) the assertion has fewer constructors and variables (taken together
521      and counting repetitions) than the head.
523 This allows all instances permitted by the old rule, plus such instances as
525        instance C a
526        instance Show (s a) => Show (Sized s a)
527        instance (Eq a, Show b) => C2 a b
528        instance C2 Int a => C3 Bool [a]
529        instance C2 Int a => C3 [a] b
530        instance C4 a a => C4 [a] [a]
532 but still ensures that under any substitution assertions in the context
533 will be smaller than the head, so context reduction must terminate.
535 This is probably the best we can do if we consider each instance in
536 isolation.
538[Fix CPP failure by adding space before hASH_TBL_SIZE
539[email protected]**20060209093704]
540[an LDV profiling fix (might just fix ASSERTIONs, I'm not sure)
541Simon Marlow <[email protected]>**20060208170744]
542[Do type refinement in TcIface
543[email protected]**20060208154412
545 This commit fixes a bug in 6.4.1 and the HEAD.  Consider this code,
546 recorded **in an interface file**
548     \(x::a) -> case y of
549                 MkT -> case x of { True -> ... }
550 (where MkT forces a=Bool)
552 In the "case x" we need to know x's type, because we use that
553 to find which module to look for "True" in. x's type comes from
554 the envt, so we must refine the envt. 
556 The alternative would be to record more info with an IfaceCase,
557 but that would change the interface file format.
559 (This stuff will go away when we have proper coercions.)
562[Add mapOccEnv
563[email protected]**20060208154343]
564[A little more debug printing
565[email protected]**20060208150701]
566[Show types of case result when debug is on
567[email protected]**20060208150357]
568[fix installation of binary dist when the PS docs aren't present
569Simon Marlow <[email protected]>**20060208153259
571 Fixes #660
573[fix a bug in closure_sizeW_()
574Simon Marlow <[email protected]>**20060208145451]
575[make the smp way RTS-only, normal libraries now work with -smp
576Simon Marlow <[email protected]>**20060208143348
578 We had to bite the bullet here and add an extra word to every thunk,
579 to enable running ordinary libraries on SMP.  Otherwise, we would have
580 needed to ship an extra set of libraries with GHC 6.6 in addition to
581 the two sets we already ship (normal + profiled), and all Cabal
582 packages would have to be compiled for SMP too.  We decided it best
583 just to take the hit now, making SMP easily accessible to everyone in
584 GHC 6.6.
586 Incedentally, although this increases allocation by around 12% on
587 average, the performance hit is around 5%, and much less if your inner
588 loop doesn't use any laziness.
590[add -dfaststring-stats to dump some stats about the FastString hash table
591Simon Marlow <[email protected]>**20060208131018]
592[fix a warning
593Simon Marlow <[email protected]>**20060207132323]
594[catch up with changes to Distribution.ParseUtils.ParseResult
595Simon Marlow <[email protected]>**20060207111111]
596[Wibble to type signature
597[email protected]**20060207171254]
598[Empty forall should disable implicit quantification
599[email protected]**20060207085137]
600[Remove unused constructor in SourceTypeCtxt
601[email protected]**20060206112031]
602[Basic completion in GHCi
603Simon Marlow <[email protected]>**20060206122654
605 This patch adds completion support to GHCi when readline is being
606 used.  Completion of identifiers (in scope only, but including
607 qualified identifiers) in expressions is provided.  Also, completion
608 of commands (:cmd), and special completion for certain commands
609 (eg. module names for the :module command) are also provided.
611[Improve error report for pattern guards
612[email protected]**20060206101730]
613[Add bang patterns
614[email protected]**20060203175108
616 This commit adds bang-patterns,
617        enabled by -fglasgow-exts or -fbang-patterns
618        diabled by -fno-bang-patterns
620 The idea is described here
621        http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/BangPatterns
624[Add Bag.anyBag (analogous to List.any)
625[email protected]**20060203174627]
626[Deal correctly with lazy patterns and GADTs
627[email protected]**20060202130409]
628[Record the type in TuplePat (necessary for GADTs)
629[email protected]**20060202124405
631 We must record the type of a TuplePat after typechecking, just like a ConPatOut,
632 so that desugaring works correctly for GADTs. See comments with the declaration
633 of HsPat.TuplePat, and test gadt15
636[Improve error reporting in Core Lint
637[email protected]**20060202124327]
638[don't clean ghc-inplace when cleaning stages other than 1
639Simon Marlow <[email protected]>**20060202124359]
640[Improve error reporting in typechecker
641[email protected]**20060201170332]
642[Trim imports
643[email protected]**20060201170248]
644[Yet another fix to an old hi-boot-6 file
645[email protected]**20060201105544]
646[Kinding wibble in TH brackets
647[email protected]**20060131175730]
648[Use extraGHCiLibraries (if supplied) in GHCi linker rather than extraLibraries
649Duncan Coutts <[email protected]>**20051207105654
650 Also extend the parser.
652[combine libraries/.darcs-boring and .darcs-boring
653Simon Marlow <[email protected]>**20060131161530]
654[Fix long-standing bug in CPR analysis
655[email protected]**20060131153247
657        MERGE TO STABLE
659 For a long time (2002!) the CPR analysis done by
660 dmdAnalTopRhs has been bogus.  In particular, it's possible
661 for a newtype constructor to look CPR-ish when it simply isn't.
663 This fixes it.  Test is stranal/newtype
668[More hi-boot-6 updates
669[email protected]**20060131130926]
670[Fix TcUnify.subFunTys in AppTy case
673 subFunTys wasn't dealing correctly with the case where the type
674 to be split was of form (a ty1), where a is a type variable.
676 This shows up when compiling
677        Control.Arrow.Transformer.Stream
678 in package arrows.
680 This commit fixes it.
684[Error message wibble
686[Add mkHsCoerce to avoid junk in typechecked code
689 Avoiding identity coercions is a Good Thing generally, but
690 it turns out that the desugarer has trouble recognising
691 'otherwise' and 'True' guards if they are wrapped in an
692 identity coercion; and that leads to bogus overlap warnings.
695[Improve error messsage when argument count varies
697[fix bug #664 in printSample()
698Simon Marlow <simonmar@microsoft.com>**20060130115301
699 printSample() was attempting to round the fractional part of the time,
700 but not propagated to the non-fractional part.  It's probably better not
701 to attempt to round the time at all.
703[Fix hi-boot file for earlier versions of GHC
705[Fix typo in boxy matching
707[fix one case where -q wasn't honoured
708Simon Marlow <simonmar@microsoft.com>**20060127104715]
709[Check for GMP.framework on all Darwin platforms, not just PPC
711[Simon's big boxy-type commit
714 This very large commit adds impredicativity to GHC, plus
715 numerous other small things.
717 *** WARNING: I have compiled all the libraries, and
718 ***         a stage-2 compiler, and everything seems
719 ***         fine.  But don't grab this patch if you
720 ***         can't tolerate a hiccup if something is
721 ***         broken.
723 The big picture is this:
725 a) GHC handles impredicative polymorphism, as described in the
726    "Boxy types: type inference for higher-rank types and
727    impredicativity" paper
729 b) GHC handles GADTs in the new simplified (and very sligtly less
730    epxrssive) way described in the
731    "Simple unification-based type inference for GADTs" paper
734 But there are lots of smaller changes, and since it was pre-Darcs
735 they are not individually recorded.
737 Some things to watch out for:
739 c)   The story on lexically-scoped type variables has changed, as per
740      my email.  I append the story below for completeness, but I
741      am still not happy with it, and it may change again.  In particular,
742      the new story does not allow a pattern-bound scoped type variable
743      to be wobbly, so (\(x::[a]) -> ...) is usually rejected.  This is
744      more restrictive than before, and we might loosen up again.
746 d)   A consequence of adding impredicativity is that GHC is a bit less
747      gung ho about converting automatically between
748        (ty1 -> forall a. ty2)    and    (forall a. ty1 -> ty2)
749      In particular, you may need to eta-expand some functions to make
750      typechecking work again.
752      Furthermore, functions are now invariant in their argument types,
753      rather than being contravariant.  Again, the main consequence is
754      that you may occasionally need to eta-expand function arguments when
755      using higher-rank polymorphism.
758 Please test, and let me know of any hiccups
761 Scoped type variables in GHC
762 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
763        January 2006
765 0) Terminology.
767    A *pattern binding* is of the form
768        pat = rhs
770    A *function binding* is of the form
771        f pat1 .. patn = rhs
773    A binding of the formm
774        var = rhs
775    is treated as a (degenerate) *function binding*.
778    A *declaration type signature* is a separate type signature for a
779    let-bound or where-bound variable:
780        f :: Int -> Int
782    A *pattern type signature* is a signature in a pattern:
783        \(x::a) -> x
784        f (x::a) = x
786    A *result type signature* is a signature on the result of a
787    function definition:
788        f :: forall a. [a] -> a
789        head (x:xs) :: a = x
791    The form
792        x :: a = rhs
793    is treated as a (degnerate) function binding with a result
794    type signature, not as a pattern binding.
796 1) The main invariants:
798      A) A lexically-scoped type variable always names a (rigid)
799        type variable (not an arbitrary type).  THIS IS A CHANGE.
800         Previously, a scoped type variable named an arbitrary *type*.
802      B) A type signature always describes a rigid type (since
803        its free (scoped) type variables name rigid type variables).
804        This is also a change, a consequence of (A).
806      C) Distinct lexically-scoped type variables name distinct
807        rigid type variables.  This choice is open;
809 2) Scoping
811 2(a) If a declaration type signature has an explicit forall, those type
812    variables are brought into scope in the right hand side of the
813    corresponding binding (plus, for function bindings, the patterns on
814    the LHS). 
815        f :: forall a. a -> [a]
816        f (x::a) = [x :: a, x]
817    Both occurences of 'a' in the second line are bound by
818    the 'forall a' in the first line
820    A declaration type signature *without* an explicit top-level forall
821    is implicitly quantified over all the type variables that are
822    mentioned in the type but not already in scope.  GHC's current
823    rule is that this implicit quantification does *not* bring into scope
824    any new scoped type variables.
825        f :: a -> a
826        f x = ...('a' is not in scope here)...
827    This gives compatibility with Haskell 98
829 2(b) A pattern type signature implicitly brings into scope any type
830    variables mentioned in the type that are not already into scope.
831    These are called *pattern-bound type variables*.
832        g :: a -> a -> [a]
833        g (x::a) (y::a) = [y :: a, x]
834    The pattern type signature (x::a) brings 'a' into scope.
835    The 'a' in the pattern (y::a) is bound, as is the occurrence on
836    the RHS. 
838    A pattern type siganture is the only way you can bring existentials
839    into scope.
840        data T where
841          MkT :: forall a. a -> (a->Int) -> T
843        f x = case x of
844                MkT (x::a) f -> f (x::a)
846 2a) QUESTION
847        class C a where
848          op :: forall b. b->a->a
850        instance C (T p q) where
851          op = <rhs>
852     Clearly p,q are in scope in <rhs>, but is 'b'?  Not at the moment.
853     Nor can you add a type signature for op in the instance decl.
854     You'd have to say this:
855        instance C (T p q) where
856          op = let op' :: forall b. ...
857                   op' = <rhs>
858               in op'
860 3) A pattern-bound type variable is allowed only if the pattern's
861    expected type is rigid.  Otherwise we don't know exactly *which*
862    skolem the scoped type variable should be bound to, and that means
863    we can't do GADT refinement.  This is invariant (A), and it is a
864    big change from the current situation.
866        f (x::a) = x    -- NO; pattern type is wobbly
868        g1 :: b -> b
869        g1 (x::b) = x   -- YES, because the pattern type is rigid
871        g2 :: b -> b
872        g2 (x::c) = x   -- YES, same reason
874        h :: forall b. b -> b
875        h (x::b) = x    -- YES, but the inner b is bound
877        k :: forall b. b -> b
878        k (x::c) = x    -- NO, it can't be both b and c
880 3a) You cannot give different names for the same type variable in the same scope
881     (Invariant (C)):
883        f1 :: p -> p -> p               -- NO; because 'a' and 'b' would be
884        f1 (x::a) (y::b) = (x::a)       --     bound to the same type variable
886        f2 :: p -> p -> p               -- OK; 'a' is bound to the type variable
887        f2 (x::a) (y::a) = (x::a)       --     over which f2 is quantified
888                                        -- NB: 'p' is not lexically scoped
890        f3 :: forall p. p -> p -> p     -- NO: 'p' is now scoped, and is bound to
891        f3 (x::a) (y::a) = (x::a)       --     to the same type varialble as 'a'
893        f4 :: forall p. p -> p -> p     -- OK: 'p' is now scoped, and its occurences
894        f4 (x::p) (y::p) = (x::p)       --     in the patterns are bound by the forall
897 3b) You can give a different name to the same type variable in different
898     disjoint scopes, just as you can (if you want) give diferent names to
899     the same value parameter
901        g :: a -> Bool -> Maybe a
902        g (x::p) True  = Just x  :: Maybe p
903        g (y::q) False = Nothing :: Maybe q
905 3c) Scoped type variables respect alpha renaming. For example,
906     function f2 from (3a) above could also be written:
907        f2' :: p -> p -> p
908        f2' (x::b) (y::b) = x::b
909    where the scoped type variable is called 'b' instead of 'a'.
912 4) Result type signatures obey the same rules as pattern types signatures.
913    In particular, they can bind a type variable only if the result type is rigid
915        f x :: a = x    -- NO
917        g :: b -> b
918        g x :: b = x    -- YES; binds b in rhs
920 5) A *pattern type signature* in a *pattern binding* cannot bind a
921    scoped type variable
923        (x::a, y) = ...         -- Legal only if 'a' is already in scope
925    Reason: in type checking, the "expected type" of the LHS pattern is
926    always wobbly, so we can't bind a rigid type variable.  (The exception
927    would be for an existential type variable, but existentials are not
928    allowed in pattern bindings either.)
930    Even this is illegal
931        f :: forall a. a -> a
932        f x = let ((y::b)::a, z) = ...
933              in
934    Here it looks as if 'b' might get a rigid binding; but you can't bind
935    it to the same skolem as a.
937 6) Explicitly-forall'd type variables in the *declaration type signature(s)*
938    for a *pattern binding* do not scope AT ALL.
940        x :: forall a. a->a       -- NO; the forall a does
941        Just (x::a->a) = Just id  --     not scope at all
943        y :: forall a. a->a
944        Just y = Just (id :: a->a)  -- NO; same reason
946    THIS IS A CHANGE, but one I bet that very few people will notice.
947    Here's why:
949        strange :: forall b. (b->b,b->b)
950        strange = (id,id)
952        x1 :: forall a. a->a
953        y1 :: forall b. b->b
954        (x1,y1) = strange
956     This is legal Haskell 98 (modulo the forall). If both 'a' and 'b'
957     both scoped over the RHS, they'd get unified and so cannot stand
958     for distinct type variables. One could *imagine* allowing this:
960        x2 :: forall a. a->a
961        y2 :: forall a. a->a
962        (x2,y2) = strange
964     using the very same type variable 'a' in both signatures, so that
965     a single 'a' scopes over the RHS.  That seems defensible, but odd,
966     because though there are two type signatures, they introduce just
967     *one* scoped type variable, a.
969 7) Possible extension.  We might consider allowing
970        \(x :: [ _ ]) -> <expr>
971     where "_" is a wild card, to mean "x has type list of something", without
972     naming the something.
975[add double colon and double arrow symbols (-fglasgow-exts)
976Simon Marlow <simonmar@microsoft.com>**20060125135501]
977[Fix conDeclFVs for GADTs, to fix bogus unused-import warning
979[make the par# primop actually do something
980Simon Marlow <simonmar@microsoft.com>**20060124162521]
981[Update Cachegrind support for changes to the Valgrind CLI
982Simon Marlow <simonmar@microsoft.com>**20060124154732]
983[send usage info to stdout, not stderr
984Simon Marlow <simonmar@microsoft.com>**20060124145551]
986Dinko Tenev <dinko.tenev@gmail.com>**20060122222446]
987[remove old CVS stuff, replace with darcs
988Simon Marlow <simonmar@microsoft.com>**20060120151322]
989[implement clean/dirty TSOs
990Simon Marlow <simonmar@microsoft.com>**20060123164930
991 Along the lines of the clean/dirty arrays and IORefs implemented
992 recently, now threads are marked clean or dirty depending on whether
993 they need to be scanned during a minor GC or not.  This should speed
994 up GC when there are lots of threads, especially if most of them are
995 idle.
997[Better error message for Template Haskell pattern brackets
999[remove old comment
1000Simon Marlow <simonmar@microsoft.com>**20060123140530]
1001[Fix for feature request #655 (Loading the GHC library from GHCi.)
1002Lemmih <lemmih@gmail.com>**20060123110625
1003 Moved the utility functions out of hschooks, avoided
1004 linking the GHC library with hschooks.o and
1005 added a couple of symbols to the linkers export list.
1007[Make hsc2hs emit the full path name in {-# LINE #-} pagmas.
1008Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060122011831
1009 For one thing this is the right thing to do anyway, it's what other tools do.
1010 Secondly it allows haddock to produce accurate source code links.
1012[MFLAGS += -f Makefile
1013Simon Marlow <simonmar@microsoft.com>**20060123094837
1014 merged from CVS, because Tailor isn't merging the libraries subdir
1016[undo accidental commit of snapshot version
1017Simon Marlow <simonmar@microsoft.com>**20060122175817]
1018[TAG final switch to darcs, this repo is now live
1019Simon Marlow <simonmar@microsoft.com>**20060120134630]
1020Patch bundle hash: