Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/HISTORY
ViewVC logotype

Diff of /sml/trunk/HISTORY

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1073, Fri Feb 15 22:07:38 2002 UTC revision 1189, Fri May 10 20:40:33 2002 UTC
# Line 14  Line 14 
14    
15  ----------------------------------------------------------------------  ----------------------------------------------------------------------
16  Name: Matthias Blume  Name: Matthias Blume
17    Date: 2002/05/10 16:40:00 EDT
18    Tag: blume-20020510-erg-textio
19    Description:
20    
21    Applied the following bugfix provided by Emden Gansner:
22    
23        Output is corrupted when outputSubstr is used rather than output.
24    
25        The problem occurs when a substring
26    
27            ss = (s, dataStart, dataLen)
28    
29        where dataStart > 0, fills a stream buffer with avail bytes left.
30        avail bytes of s, starting at index dataStart, are copied into the
31        buffer, the buffer is flushed, and then the remaining dataLen-avail
32        bytes of ss are copied into the beginning of the buffer. Instead of
33        starting this copy at index dataStart+avail in s, the current code
34        starts the copy at index avail.
35    
36        Fix:
37        In text-io-fn.sml, change line 695 from
38             val needsFlush = copyVec(v, avail, dataLen-avail, buf, 0)
39        to
40             val needsFlush = copyVec(v, dataStart+avail, dataLen-avail, buf, 0)
41    
42    ----------------------------------------------------------------------
43    Name: Matthias Blume
44    Date: 2002/04/12 13:55:00 EDT
45    Tag: blume-20020412-assyntax
46    Description:
47    
48    1. Grabbed newer assyntax.h from the XFree86 project.
49    2. Fiddled with how to compile X86.prim.asm without warnings.
50    3. (Very) Minor cleanup in CM.
51    
52    ----------------------------------------------------------------------
53    Name: Matthias Blume
54    Date: 2002/04/01 (no joke!) 17:07:00 EST
55    Tag: blume-20020401-x86div
56    Description:
57    
58    Added full support for div/mod/rem/quot on the x86, using the machine
59    instruction's two results (without clumsily recomputing the remainder)
60    directly where appropriate.
61    
62    Some more extensive power-of-two support was added to the x86 instruction
63    selector (avoiding expensive divs, mods, and muls where they can be
64    replaced with cheaper shifts and masks).  However, this sort of thing
65    ought to be done earlier, e.g., within the CPS optimizer so that
66    all architectures benefit from it.
67    
68    The compiler compiles to a fixed point, but changes might be somewhat
69    fragile nevertheless.  Please, report any strange things that you might
70    see wrt. div/mod/quot/rem...
71    
72    ----------------------------------------------------------------------
73    Name: Matthias Blume
74    Date: 2002/03/29 17:22:00
75    Tag: blume-20020329-div
76    Description:
77    
78    Fixed my broken div/mod logic.  Unfortunately, this means that the
79    inline code for div/mod now has one more comparison than before.
80    Fast paths (quotient > 0 or remainder = 0) are not affected, though.
81    The problem was with quotient = 0, because that alone does not tell
82    us which way the rounding went.  One then has to look at whether
83    remainder and divisor have the same sign...  :(
84    
85    Anyway, I replaced the bootfiles with fresh ones...
86    
87    ----------------------------------------------------------------------
88    Name: Matthias Blume
89    Date: 2002/03/29 14:10:00 EST
90    Tag: blume-20020329-inlprims
91    Description:
92    
93    NEW BOOTFILES!!!    Version number bumped to 110.39.3.
94    
95    Primops have changed. This means that the bin/boot-file formats have
96    changed as well.
97    
98    To make sure that there is no confusion, I made a new version.
99    
100    
101    CHANGES:
102    
103    * removed REMT from mltree (remainder should never overflow).
104    
105    * added primops to deal with divisions of all flavors to the frontend
106    
107    * handled these primops all the way through so they map to their respective
108      MLRISC support
109    
110    * used these primops in the implementation of Int, Int32, Word, Word32
111    
112    * removed INLDIV, INLMOD, and INLREM as they are no longer necessary
113    
114    * parameterized INLMIN, INLMAX, and INLABS by a numkind
115    
116    * translate.sml now deals with all flavors of INL{MIN,MAX,ABS}, including
117      floating point
118    
119    * used INL{MIN,MAX,ABS} in the implementation of Int, Int32, Word, Word32,
120      and Real (but Real.abs maps to a separate floating-point-only primop)
121    
122    
123    TODO items:
124    
125    * Hacked Alpha32 instruction selection, disabling the selection of REMx
126      instructions because the machine instruction encoder cannot handle
127      them.  (Hppa, PPC, and Sparc instruction selection did not handle
128      REM in the first place, and REM is supported by the x86 machine coder.)
129    
130    * Handle DIV and MOD with DIV_TO_NEGINF directly in the x86 instruction
131      selection phase.  (The two can be streamlined because the hardware
132      delivers both quotient and remainder at the same time anyway.)
133    
134    * Think about what to do with "valOf(Int32.minInt) div ~1" and friends.
135      (Currently the behavior is inconsistent both across architectures and
136      wrt. the draft Basis spec.)
137    
138    * Word8 should eventually be handled natively, too.
139    
140    * There seems to be one serious bug in mltree-gen.sml.  It appears, though,
141      as if there currently is no execution path that could trigger it in
142      SML/NJ.  (The assumptions underlying functions arith and promotable do not
143      hold for things like multiplication and division.)
144    
145    ----------------------------------------------------------------------
146    Name: Matthias Blume
147    Date: 2002/03/27 16:27:00 EST
148    Tag: blume-20020327-mlrisc-divisions
149    Description:
150    
151    Added support for all four division operations (ML's div, mod, quot,
152    and rem) to MLRISC.  In the course of doing so, I also rationalized
153    the naming (no more annoying switch-around of DIV and QUOT), by
154    parameterizing the operation by div_rounding_mode (which can be either
155    DIV_TO_ZERO or DIV_TO_NEGINF).
156    
157    The generic MLTreeGen functor takes care of compiling all four
158    operations down to only round-to-zero div.
159    
160    Missing pieces:
161    
162      * Doing something smarter than relying on MLTreeGen on architectures
163        like, e.g., the x86 where hardware division delivers both quotient and
164        remainder at the same time.  With this, the implementation of the
165        round-to-neginf operations could be further streamlined.
166    
167      * Remove inlining support for div/mod/rem from the frontend and replace it
168        with primops that get carried through to the backend.  Do this for all
169        int and word types.
170    
171    ----------------------------------------------------------------------
172    Name: Matthias Blume
173    Date: 2002/03/25 17:25:00 EST
174    Tag: blume-20020325-divmod
175    Description:
176    
177    I improved (hopefully without breaking them) the implementation of Int.div,
178    Int.mod, and Int.rem.   For this, the code in translate.sml now takes
179    advantage of the following observations:
180    
181      Let  q = x quot y      r = x rem y
182           d = x div  y      m = x mod y
183    
184    where "quot" is the round-to-zero version of integer division that
185    hardware usually provides.  Then we have:
186    
187         r = x - q * y        where neither the * nor the - will overflow
188         d = if q >= 0 orelse x = q * y then q else q - 1
189                              where neither the * nor the - will overflow
190         m = if q >= 0 orelse r = 0 then r else r + y
191                              where the + will not overflow
192    
193    This results in substantial simplification of the generated code.
194    The following table shows the number of CFG nodes and edges generated
195    for
196            fun f (x, y) = x OPER y
197            (* with OPER \in div, mod, quot, rem *)
198    
199    
200        OPER | nodes(old) | edges(old) | nodes(new) | edges(new)
201        --------------------------------------------------------
202         div |         24 |         39 |         12 |         16
203         mod |         41 |         71 |         12 |         16
204        quot |          8 |         10 |          8 |         10
205         rem |         10 |         14 |          8 |         10
206    
207    
208    ----------------------------------------------------------------------
209    Name: Matthias Blume
210    Date: 2002/03/25 22:06:00 EST
211    Tag: blume-20020325-cprotobug
212    Description:
213    
214    Fixed a bug in cproto (c prototype decoder).
215    
216    ----------------------------------------------------------------------
217    Name: Matthias Blume
218    Date: 2002/03/25 16:00:00 EST
219    Tag: blume-20020325-raw-primops
220    Description:
221    
222    I did some cleanup to Allen's new primop code and
223    replaced yesterday's bootfiles with new ones.
224    (But they are stored in the same place.)
225    
226    ----------------------------------------------------------------------
227    Name: Matthias Blume
228    Date: 2002/03/24 22:40:00 EST
229    Tag: blume-20020324-bootfiles
230    Description:
231    
232    Made the bootfiles that Allen asked for.
233    
234    ----------------------------------------------------------------------
235    Name: Allen Leung
236    Date: 2002/03/23 15:50:00 EST
237    Tag: leunga-20020323-flint-cps-rcc-primops
238    Description:
239    
240      1. Changes to FLINT primops:
241    
242        (* make a call to a C-function;
243         * The primop carries C function prototype information and specifies
244         * which of its (ML-) arguments are floating point. C prototype
245         * information is for use by the backend, ML information is for
246         * use by the CPS converter. *)
247      | RAW_CCALL of { c_proto: CTypes.c_proto,
248                       ml_args: ccall_type list,
249                       ml_res_opt: ccall_type option,
250                       reentrant : bool
251                     } option
252       (* Allocate uninitialized storage on the heap.
253        * The record is meant to hold short-lived C objects, i.e., they
254        * are not ML pointers.  With the tag, the representation is
255        * the same as RECORD with tag tag_raw32 (sz=4), or tag_fblock (sz=8)
256        *)
257      | RAW_RECORD of {tag:bool,sz:int}
258      and ccall_type = CCALL_INT32 | CCALL_REAL64 | CCALL_ML_PTR
259    
260      2.  These CPS primops are now overloaded:
261    
262           rawload of {kind:numkind}
263           rawstore of {kind:numkind}
264    
265          The one argument form is:
266    
267             rawload {kind} address
268    
269          The two argument form is:
270    
271             rawload {kind} [ml object, byte-offset]
272    
273      3. RAW_CCALL/RCC now takes two extra arguments:
274    
275         a. The first is whether the C call is reentrant, i.e., whether
276            ML state should be saved and restored.
277         b. The second argument is a string argument specifying the name of
278            library and the C function.
279    
280         These things are currently not handled in the code generator, yet.
281    
282      4. In CProto,
283    
284         An encoding type of "bool" means "ml object" and is mapped into
285         C prototype of PTR.  Note that "bool" is different than "string",
286         even though "string" is also mapped into PTR, because "bool"
287         is assigned an CPS type of BOGt, while "string" is assigned INT32t.
288    
289      5. Pickler/unpicker
290    
291         Changed to handle RAW_RECORD and newest RAW_CCALL
292    
293      6. MLRiscGen,
294    
295         1. Changed to handle the new rawload/rawstore/rawrecord operators.
296         2. Code for handling C Calls has been moved to a new module CPSCCalls,
297            in the file CodeGen/cpscompile/cps-c-calls.sml
298    
299      7. Added the conditional move operator
300    
301             condmove of branch
302    
303         to cps.  Generation of this is still buggy so it is currently
304         disabled.
305    
306    ----------------------------------------------------------------------
307    Name: Lal George
308    Date: 2002/03/22 14:18:25 EST
309    Tag: george-20020322-cps-branch-prob
310    Description:
311    
312    Implemented the Ball-Larus branch prediction-heuristics, and
313    incorporated graphical viewers for control flow graphs.
314    
315    Ball-Larus Heuristics:
316    ---------------------
317    See the file compiler/CodeGen/cpscompile/cpsBranchProb.sml.
318    
319    By design it uses the Dempster-Shafer theory for combining
320    probabilities.  For example, in the function:
321    
322        fun f(n,acc) = if n = 0 then acc else f(n-1, n*acc)
323    
324    the ball-larus heuristics predicts that the n=0 is unlikely
325    (OH-heuristic), and the 'then' branch is unlikely because of the
326    RH-heuristic -- giving the 'then' branch an even lower combined
327    probability using the Dempster-Shafer theory.
328    
329    Finally, John Reppy's loop analysis in MLRISC, further lowers the
330    probability of the 'then' branch because of the loop in the else
331    branch.
332    
333    
334    Graphical Viewing:
335    ------------------
336    I merely plugged in Allen's graphical viewers into the compiler. The
337    additional code is not much. At the top level, saying:
338    
339            Control.MLRISC.getFlag "cfg-graphical-view" := true;
340    
341    will display the graphical view of the control flow graph just before
342    back-patching.  daVinci must be in your path for this to work. If
343    daVinci is not available, then the default viewer can be changed
344    using:
345    
346            Control.MLRISC.getString "viewer"
347    
348    which can be set to "dot" or "vcg" for the corresponding viewers. Of
349    course, these viewers must be in your path.
350    
351    The above will display the compilation unit at the level of clusters,
352    many of which are small, boring, and un-interesting. Also setting:
353    
354            Control.MLRISC.getInt "cfg-graphical-view_size"
355    
356    will display clusters that are larger than the value set by the above.
357    
358    
359    ----------------------------------------------------------------------
360    Name: Matthias Blume
361    Date: 2002/03/21 22:20:00 EST
362    Tag: blume-20020321-kmp-bugfix
363    Description:
364    
365    Changed the interface to the KMP routine in PreString and fixed
366    a minor bug in one place where it was used.
367    
368    ----------------------------------------------------------------------
369    Name: Allen Leung
370    Date: 2002/03/21 20:30:00 EST
371    Tag: leunga-20020321-cfg
372    Description:
373    
374      Fixed a potential problem in cfg edge splitting.
375    
376    ----------------------------------------------------------------------
377    Name: Allen Leung
378    Date: 2002/03/21 17:15:00 EST
379    Tag: leunga-20020321-x86-fp-cfg
380    Description:
381    
382      1. Recoded the buggy parts of x86-fp.
383    
384         a. All the block reordering code has been removed.
385            We now depend on the block placement phases to do this work.
386    
387         b. Critical edge splitting code has been simplified and moved into the
388            CFG modules, as where they belong.
389    
390         Both of these were quite buggy and complex.  The code is now much, much
391         simpler.
392    
393      2. X86 backend.
394    
395         a. Added instructions for 64-bit support.  Instruction selection for
396            64-bit has not been committed, however, since that
397            requires changes to MLTREE which haven't been approved by
398            Lal and John.
399    
400         b. Added support for FUCOMI and FUCOMIP when generating code for
401            PentiumPro and above.  We only generate these instructions in
402            the fast-fp mode.
403    
404         c. Added cases for JP and JNP in X86FreqProps.
405    
406      3. CFG
407    
408         CFG now has a bunch of methods for edge splitting and merging.
409    
410      4. Machine description.
411    
412         John's simplification of MLTREE_BASIS.fcond broke a few machine
413         description things:
414    
415         rtl-build.{sig,sml} and hppa.mdl fixed.
416    
417         NOTE: the machine description stuff in the repository is still broken.
418               Again, I can't put my fixes in because that involves
419               changes to MLTREE.
420    
421    ----------------------------------------------------------------------
422    Name: Matthias Blume
423    Date: 2002/03/20 15:55:00 EST
424    Tag: blume-20020320-kmp
425    Description:
426    
427    Implemented Knuth-Morris-Pratt string matching in PreString and used
428    it for String.isSubstring, Substring.isSubstring, and
429    Substring.position.
430    
431    (Might need some stress-testing.  Simple examples worked fine.)
432    
433    ----------------------------------------------------------------------
434    Name: Matthias Blume
435    Date: 2002/03/19 16:37:00 EST
436    Tag: blume-20020319-witnesses
437    Description:
438    
439    Added a structure C.W and functions convert/Ptr.convert to ml-nlffi-lib.
440    
441    This implements a generic mechanism for changing constness qualifiers
442    anywhere within big C types without resorting to outright "casts".
443    (So far, functions such as C.rw/C.ro or C.Ptr.rw/C.Ptr.ro only let you
444    modify the constness at the outermost level.)
445    The implementation of "convert" is based on the idea of "witness"
446    values -- values that are not used by the operation but whose types
447    "testify" to their applicability.  On the implementation side, "convert"
448    is simply a projection (returning its second curried argument).  With
449    cross-module inlining, it should not result in any machine code being
450    generated.
451    
452    ----------------------------------------------------------------------
453    Name: Matthias Blume
454    Date: 2002/03/15 16:40:00 EST
455    Tag: blume-20020315-basis
456    Description:
457    
458    Provided (preliminary?) implementations for
459    
460      {String,Substring}.{concatWith,isSuffix,isSubstring}
461    
462    and
463    
464      Substring.full
465    
466    Those are in the Basis spec but they were missing in SML/NJ.
467    
468    ----------------------------------------------------------------------
469    Name: Matthias Blume
470    Date: 2002/03/14 21:30:00 EST
471    Tag: blume-20020314-controls
472    Description:
473    
474    Controls:
475    ---------
476    
477    1. Factored out the recently-added Controls : CONTROLS stuff and put
478       it into its own library $/controls-lib.cm.  The source tree for
479       this is under src/smlnj-lib/Controls.
480    
481    2. Changed the names of types and functions in this interface, so they
482       make a bit more "sense":
483    
484          module -> registry
485          'a registry -> 'a group
486    
487    3. The interface now deals in ref cells only.  The getter/setter interface
488       is (mostly) gone.
489    
490    4. Added a function that lets one register an already-existing ref cell.
491    
492    5. Made the corresponding modifications to the rest of the code so that
493       everything compiles again.
494    
495    6. Changed the implementation of Controls.MLRISC back to something closer
496       to the original.  In particular, this module (and therefore MLRISC)
497       does not depend on Controls.  There now is some link-time code in
498       int-sys.sml that registers the MLRISC controls with the Controls
499       module.
500    
501    CM:
502    ---
503    
504      * One can now specify the lambda-split aggressiveness in init.cmi.
505    
506    ----------------------------------------------------------------------
507    Name: Allen Leung
508    Date: 2002/03/13 17:30:00 EST
509    Tag: leunga-20020313-x86-fp-unary
510    Description:
511    
512    Bug fix for:
513    
514    > leunga@weaselbane:~/Yale/tmp/sml-dist{21} bin/sml
515    > Standard ML of New Jersey v110.39.1 [FLINT v1.5], March 08, 2002
516    > - fun f(x,(y,z)) = Real.~ y;
517    > [autoloading]
518    > [autoloading done]
519    >       fchsl   (%eax), 184(%esp)
520    > Error: MLRisc bug: X86MCEmitter.emitInstr
521    >
522    > uncaught exception Error
523    >   raised at: ../MLRISC/control/mlriscErrormsg.sml:16.14-16.19
524    
525    The problem was that the code generator did not generate any fp registers
526    in this case, and the ra didn't know that it needed to run the X86FP phase to
527    translate the pseudo fp instruction.   This only happened with unary fp
528    operators in certain situations.
529    
530    ----------------------------------------------------------------------
531    Name: Matthias Blume
532    Date: 2002/03/13 14:00:00 EST
533    Tag: blume-20020313-overload-etc
534    Description:
535    
536    1. Added _overload as a synonym for overload for backward compatibility.
537       (Control.overloadKW must be true for either version to be accepted.)
538    
539    2. Fixed bug in install script that caused more things to be installed
540       than what was requested in config/targets.
541    
542    3. Made CM aware of the (_)overload construct so that autoloading
543       works.
544    
545    ----------------------------------------------------------------------
546    Name: Matthias Blume
547    Date: 2002/03/12 22:03:00 EST
548    Tag: blume-20020312-url
549    Description:
550    
551    Forgot to update BOOT and srcarchiveurl.
552    
553    ----------------------------------------------------------------------
554    Name: Matthias Blume
555    Date: 2002/03/12 17:30:00 EST
556    Tag: blume-20020312-version110392
557    Description:
558    
559    Yet another version number bump (because of small changes to the
560    binfile format).  Version number is now 110.39.2.  NEW BOOTFILES!
561    
562    Changes:
563    
564      The new pid generation scheme described a few weeks ago was overly
565      complicated.  I implemented a new mechanism that is simpler and
566      provides a bit more "stability":  Once CM has seen a compilation
567      unit, it keeps its identity constant (as long as you do not delete
568      those crucial CM/GUID/* files).  This means that when you change
569      an interface, compile, then go back to the old interface, and
570      compile again, you arrive at the original pid.
571    
572      There now also is a mechanism that instructs CM to use the plain
573      environment hash as a module's pid (effectively making its GUID
574      the empty string).  For this, "noguid" must be specified as an
575      option to the .sml file in question within its .cm file.
576      This is most useful for code that is being generated by tools such
577      as ml-nlffigen (because during development programmers tend to
578      erase the tool's entire output directory tree including CM's cached
579      GUIDs).  "noguid" is somewhat dangerous (since it can be used to locally
580      revert to the old, broken behavior of SML/NJ, but in specific cases
581      where there is no danger of interface confusion, its use is ok
582      (I think).
583    
584      ml-nlffigen by default generates "noguid" annotations.  They can be
585      turned off by specifying -guid in its command line.
586    
587    ----------------------------------------------------------------------
588    Name: Lal George
589    Date: 2002/03/12 12 14:42:36 EST
590    Tag: george-20020312-frequency-computation
591    Description:
592    
593    Integrated jump chaining and static block frequency into the
594    compiler. More details and numbers later.
595    
596    ----------------------------------------------------------------------
597    Name: Lal George
598    Date: 2002/03/11 11 22:38:53 EST
599    Tag: george-20020311-jump-chain-elim
600    Description:
601    
602    Tested the jump chain elimination on all architectures (except the
603    hppa).  This is on by default right now and is profitable for the
604    alpha and x86, however, it may not be profitable for the sparc and ppc
605    when compiling the compiler.
606    
607    The gc test will typically jump to a label at the end of the cluster,
608    where there is another jump to an external cluster containing the actual
609    code to invoke gc. This is to allow factoring of common gc invocation
610    sequences. That is to say, we generate:
611    
612            f:
613               testgc
614               ja   L1      % jump if above to L1
615    
616            L1:
617               jmp L2
618    
619    
620    After jump chain elimination the 'ja L1' instructions is converted to
621    'ja L2'. On the sparc and ppc, many of the 'ja L2' instructions may end
622    up being implemented in their long form (if L2 is far away) using:
623    
624            jbe     L3      % jump if below or equal to L3
625            jmp     L2
626         L3:
627            ...
628    
629    
630    For large compilation units L2  may be far away.
631    
632    
633    ----------------------------------------------------------------------
634    Name: Matthias Blume
635    Date: 2002/03/11 13:30:00 EST
636    Tag: blume-20020311-mltreeeval
637    Description:
638    
639    A functor parameter was missing.
640    
641    ----------------------------------------------------------------------
642    Name: Allen Leung
643    Date: 2002/03/11 10:30:00 EST
644    Tag: leunga-20020311-runtime-string0
645    Description:
646    
647       The representation of the empty string now points to a
648    legal null terminated C string instead of unit.  It is now possible
649    to convert an ML string into C string with InlineT.CharVector.getData.
650    This compiles into one single machine instruction.
651    
652    ----------------------------------------------------------------------
653    Name: Allen Leung
654    Date: 2002/03/10 23:55:00 EST
655    Tag: leunga-20020310-x86-call
656    Description:
657    
658       Added machine generation for CALL instruction (relative displacement mode)
659    
660    ----------------------------------------------------------------------
661    Name: Matthias Blume
662    Date: 2002/03/08 16:05:00
663    Tag: blume-20020308-entrypoints
664    Description:
665    
666    Version number bumped to 110.39.1.  NEW BOOTFILES!
667    
668    Entrypoints: non-zero offset into a code object where execution should begin.
669    
670    - Added the notion of an entrypoint to CodeObj.
671    - Added reading/writing of entrypoint info to Binfile.
672    - Made runtime system bootloader aware of entrypoints.
673    - Use the address of the label of the first function given to mlriscGen
674      as the entrypoint.  This address is currently always 0, but it will
675      not be 0 once we turn on block placement.
676    - Removed the linkage cluster code (which was The Other Way(tm) of dealing
677      with entry points) from mlriscGen.
678    
679    ----------------------------------------------------------------------
680    Name: Allen Leung
681    Date: 2002/03/07 20:45:00 EST
682    Tag: leunga-20020307-x86-cmov
683    Description:
684    
685       Bug fixes for CMOVcc on x86.
686    
687       1. Added machine code generation for CMOVcc
688       2. CMOVcc is now generated in preference over SETcc on PentiumPro or above.
689       3. CMOVcc cannot have an immediate operand as argument.
690    
691    ----------------------------------------------------------------------
692    Name: Matthias Blume
693    Date: 2002/03/07 16:15:00 EST
694    Tag: blume-20020307-controls
695    Description:
696    
697    This is a very large but mostly boring patch which makes (almost)
698    every tuneable compiler knob (i.e., pretty much everything under
699    Control.* plus a few other things) configurable via both the command
700    line and environment variables in the style CM did its configuration
701    until now.
702    
703    Try starting sml with '-h' (or, if you are brave, '-H')
704    
705    To this end, I added a structure Controls : CONTROLS to smlnj-lib.cm which
706    implements the underlying generic mechanism.
707    
708    The interface to some of the existing such facilities has changed somewhat.
709    For example, the MLRiscControl module now provides mkFoo instead of getFoo.
710    (The getFoo interface is still there for backward-compatibility, but its
711    use is deprecated.)
712    
713    The ml-build script passes -Cxxx=yyy command-line arguments through so
714    that one can now twiddle the compiler settings when using this "batch"
715    compiler.
716    
717    TODO items:
718    
719    We should go through and throw out all controls that are no longer
720    connected to anything.  Moreover, we should go through and provide
721    meaningful (and correct!) documentation strings for those controls
722    that still are connected.
723    
724    Currently, multiple calls to Controls.new are accepted (only the first
725    has any effect).  Eventually we should make sure that every control
726    is being made (via Controls.new) exactly once.  Future access can then
727    be done using Controls.acc.
728    
729    Finally, it would probably be a good idea to use the getter-setter
730    interface to controls rather than ref cells.  For the time being, both
731    styles are provided by the Controls module, but getter-setter pairs are
732    better if thread-safety is of any concern because they can be wrapped.
733    
734    *****************************************
735    
736    One bug fix: The function blockPlacement in three of the MLRISC
737    backpatch files used to be hard-wired to one of two possibilities at
738    link time (according to the value of the placementFlag).  But (I
739    think) it should rather sense the flag every time.
740    
741    *****************************************
742    
743    Other assorted changes (by other people who did not supply a HISTORY entry):
744    
745    1. the cross-module inliner now works much better (Monnier)
746    2. representation of weights, frequencies, and probabilities in MLRISC
747       changed in preparation of using those for weighted block placement
748       (Reppy, George)
749    
750    ----------------------------------------------------------------------
751    Name: Lal George
752    Date: 2002/03/07 14:44:24 EST 2002
753    Tag: george-20020307-weighted-block-placement
754    
755    Tested the weighted block placement optimization on all architectures
756    (except the hppa) using AMPL to generate the block and edge frequencies.
757    Changes were required in the machine properties to correctly
758    categorize trap instructions. There is an MLRISC flag
759    "weighted-block-placement" that can be used to enable weighted block
760    placement, but this will be ineffective without block/edge
761    frequencies (coming soon).
762    
763    
764    ----------------------------------------------------------------------
765    Name: Lal George
766    Date: 2002/03/05 17:24:48 EST
767    Tag: george-20020305-linkage-cluster
768    
769    In order to support the block placement optimization, a new cluster
770    is generated as the very first cluster (called the linkage cluster).
771    It contains a single jump to the 'real' entry point for the compilation
772    unit. Block placement has no effect on the linkage cluster itself, but
773    all the other clusters  have full freedom in the manner in which they
774    reorder blocks or functions.
775    
776    On the x86 the typical linkage code that is generated is:
777       ----------------------
778            .align 2
779       L0:
780            addl    $L1-L0, 72(%esp)
781            jmp     L1
782    
783    
784            .align  2
785       L1:
786       ----------------------
787    
788    72(%esp) is the memory location for the stdlink register. This
789    must contain the address of the CPS function being called. In the
790    above example, it contains the address of  L0; before
791    calling L1 (the real entry point for the compilation unit), it
792    must contain the address for L1, and hence
793    
794            addl $L1-L0, 72(%esp)
795    
796    I have tested this on all architectures except the hppa.The increase
797    in code size is of course negligible
798    
799    ----------------------------------------------------------------------
800    Name: Allen Leung
801    Date: 2002/03/03 13:20:00 EST
802    Tag: leunga-20020303-mlrisc-tools
803    
804      Added #[ ... ] expressions to mlrisc tools
805    
806    ----------------------------------------------------------------------
807    Name: Matthias Blume
808    Date: 2002/02/27 12:29:00 EST
809    Tag: blume-20020227-cdebug
810    Description:
811    
812    - made types in structure C and C_Debug to be equal
813    - got rid of code duplication (c-int.sml vs. c-int-debug.sml)
814    - there no longer is a C_Int_Debug (C_Debug is directly derived from C)
815    
816    ----------------------------------------------------------------------
817    Name: Matthias Blume
818    Date: 2002/02/26 12:00:00 EST
819    Tag: blume-20020226-ffi
820    Description:
821    
822    1. Fixed a minor bug in CM's "noweb" tool:
823       If numbering is turned off, then truly don't number (i.e., do not
824       supply the -L option to noweb).  The previous behavior was to supply
825       -L'' -- which caused noweb to use the "default" line numbering scheme.
826       Thanks to Chris Richards for pointing this out (and supplying the fix).
827    
828    2. Once again, I reworked some aspects of the FFI:
829    
830       A. The incomplete/complete type business:
831    
832       - Signatures POINTER_TO_INCOMPLETE_TYPE and accompanying functors are
833         gone!
834       - ML types representing an incomplete type are now *equal* to
835         ML types representing their corresponding complete types (just like
836         in C).  This is still safe because ml-nlffigen will not generate
837         RTTI for incomplete types, nor will it generate functions that
838         require access to such RTTI.   But when ML code generated from both
839         incomplete and complete versions of the C type meet, the ML types
840         are trivially interoperable.
841    
842         NOTE:  These changes restore the full generality of the translation
843         (which was previously lost when I eliminated functorization)!
844    
845       B. Enum types:
846    
847       - Structure C now has a type constructor "enum" that is similar to
848         how the "su" constructor works.  However, "enum" is not a phantom
849         type because each "T enum" has values (and is isomorphic to
850         MLRep.Signed.int).
851       - There are generic access operations for enum objects (using
852         MLRep.Signed.int).
853       - ml-nlffigen will generate a structure E_foo for each "enum foo".
854         * The structure contains the definition of type "mlrep" (the ML-side
855         representation type of the enum).  Normally, mlrep is the same
856         as "MLRep.Signed.int", but if ml-nlffigen was invoked with "-ec",
857         then mlrep will be defined as a datatype -- thus facilitating
858         pattern matching on mlrep values.
859         ("-ec" will be suppressed if there are duplicate values in an
860          enumeration.)
861         * Constructors ("-ec") or values (no "-ec") e_xxx of type mlrep
862         will be generated for each C enum constant xxx.
863         * Conversion functions m2i and i2m convert between mlrep and
864         MLRep.Signed.int.  (Without "-ec", these functions are identities.)
865         * Coversion functions c and ml convert between mlrep and "tag enum".
866         * Access functions (get/set) fetch and store mlrep values.
867       - By default (unless ml-nlffigen was invoked with "-nocollect"), unnamed
868         enumerations are merged into one single enumeration represented by
869         structure E_'.
870    
871    ----------------------------------------------------------------------
872    Name: Allen Leung
873    Date: 2002/02/25 04:45:00 EST
874    Tag: leunga-20020225-cps-spill
875    
876    This is a new implementation of the CPS spill phase.
877    The new phase is in the new file compiler/CodeGen/cpscompile/spill-new.sml
878    In case of problems, replace it with the old file spill.sml
879    
880    The current compiler runs into some serious performance problems when
881    constructing a large record.  This can happen when we try to compile a
882    structure with many items.  Even a very simple structure like the following
883    makes the compiler slow down.
884    
885        structure Foo = struct
886           val x_1 = 0w1 : Word32.int
887           val x_2 = 0w2 : Word32.int
888           val x_3 = 0w3 : Word32.int
889           ...
890           val x_N = 0wN : Word32.int
891        end
892    
893    The following table shows the compile time, from N=1000 to N=4000,
894    with the old compiler:
895    
896    N
897    1000   CPS 100 spill                           0.04u  0.00s  0.00g
898           MLRISC ra                               0.06u  0.00s  0.05g
899              (spills = 0 reloads = 0)
900           TOTAL                                   0.63u  0.07s  0.21g
901    
902    1100   CPS 100 spill                           8.25u  0.32s  0.64g
903           MLRISC ra                               5.68u  0.59s  3.93g
904              (spills = 0 reloads = 0)
905           TOTAL                                   14.71u  0.99s  4.81g
906    
907    1500   CPS 100 spill                           58.55u  2.34s  1.74g
908           MLRISC ra                               5.54u  0.65s  3.91g
909              (spills = 543 reloads = 1082)
910           TOTAL                                   65.40u  3.13s  6.00g
911    
912    2000   CPS 100 spill                           126.69u  4.84s  3.08g
913           MLRISC ra                               0.80u  0.10s  0.55g
914              (spills = 42 reloads = 84)
915           TOTAL                                   129.42u  5.10s  4.13g
916    
917    3000   CPS 100 spill                           675.59u  19.03s  11.64g
918           MLRISC ra                               2.69u  0.27s  1.38g
919              (spills = 62 reloads = 124)
920           TOTAL                                   682.48u  19.61s  13.99g
921    
922    4000   CPS 100 spill                           2362.82u  56.28s  43.60g
923           MLRISC ra                               4.96u  0.27s  2.72g
924              (spills = 85 reloads = 170)
925           TOTAL                                   2375.26u  57.21s  48.00g
926    
927    As you can see the old cps spill module suffers from some serious
928    performance problem.  But since I cannot decipher the old code fully,
929    instead of patching the problems up, I'm reimplementing it
930    with a different algorithm.  The new code is more modular,
931    smaller when compiled, and substantially faster
932    (O(n log n) time and O(n) space).  Timing of the new spill module:
933    
934    4000  CPS 100 spill                           0.02u  0.00s  0.00g
935          MLRISC ra                               0.25u  0.02s  0.15g
936             (spills=1 reloads=3)
937          TOTAL                                   7.74u  0.34s  1.62g
938    
939    Implementation details:
940    
941    As far as I can tell, the purpose of the CPS spill module is to make sure the
942    number of live variables at any program point (the bandwidth)
943    does not exceed a certain limit, which is determined by the
944    size of the spill area.
945    
946    When the bandwidth is too large, we decrease the register pressure by
947    packing live variables into spill records.  How we achieve this is
948    completely different than what we did in the old code.
949    
950    First, there is something about the MLRiscGen code generator
951    that we should be aware of:
952    
953    o MLRiscGen performs code motion!
954    
955       In particular, it will move floating point computations and
956       address computations involving only the heap pointer to
957       their use sites (if there is only a single use).
958       What this means is that if we have a CPS record construction
959       statement
960    
961           RECORD(k,vl,w,e)
962    
963       we should never count the new record address w as live if w
964       has only one use (which is often the case).
965    
966       We should do something similar to floating point, but the transformation
967       there is much more complex, so I won't deal with that.
968    
969    Secondly, there are now two new cps primops at our disposal:
970    
971     1. rawrecord of record_kind option
972        This pure operator allocates some uninitialized storage from the heap.
973        There are two forms:
974    
975         rawrecord NONE [INT n]  allocates a tagless record of length n
976         rawrecord (SOME rk) [INT n] allocates a tagged record of length n
977                                     and initializes the tag.
978    
979     2. rawupdate of cty
980          rawupdate cty (v,i,x)
981          Assigns to x to the ith component of record v.
982          The storelist is not updated.
983    
984    We use these new primops for both spilling and increment record construction.
985    
986     1. Spilling.
987    
988        This is implemented with a linear scan algorithm (but generalized
989        to trees).  The algorithm will create a single spill record at the
990        beginning of the cps function and use rawupdate to spill to it,
991        and SELECT or SELp to reload from it.  So both spills and reloads
992        are fine-grain operations.  In contrast, in the old algorithm
993        "spills" have to be bundled together in records.
994    
995        Ideally, we should sink the spill record construction to where
996        it is needed.  We can even split the spill record into multiple ones
997        at the places where they are needed.  But CPS is not a good
998        representation for global code motion, so I'll keep it simple and
999        am not attempting this.
1000    
1001     2. Incremental record construction (aka record splitting).
1002    
1003        Long records with many component values which are simulatenously live
1004        (recall that single use record addresses are not considered to
1005         be live) are constructed with rawrecord and rawupdate.
1006        We allocate space on the heap with rawrecord first, then gradually
1007        fill it in with rawupdate.  This is the technique suggested to me
1008        by Matthias.
1009    
1010        Some restrictions on when this is applicable:
1011        1. It is not a VECTOR record.  The code generator currently does not handle
1012           this case. VECTOR record uses double indirection like arrays.
1013        2. All the record component values are defined in the same "basic block"
1014           as the record constructor.  This is to prevent speculative
1015           record construction.
1016    
1017    ----------------------------------------------------------------------
1018    Name: Allen Leung
1019    Date: 2002/02/22 01:02:00 EST
1020    Tag: leunga-20020222-mlrisc-tools
1021    
1022    Minor bug fixes in the parser and rewriter
1023    
1024    ----------------------------------------------------------------------
1025    Name: Allen Leung
1026    Date: 2002/02/21 20:20:00 EST
1027    Tag: leunga-20020221-peephole
1028    
1029    Regenerated the peephole files.  Some contained typos in the specification
1030    and some didn't compile because of pretty printing bugs in the old version
1031    of 'nowhere'.
1032    
1033    ----------------------------------------------------------------------
1034    Name: Allen Leung
1035    Date: 2002/02/19 20:20:00 EST
1036    Tag: leunga-20020219-mlrisc-tools
1037    Description:
1038    
1039       Minor bug fixes to the mlrisc-tools library:
1040    
1041       1.  Fixed up parsing colon suffixed keywords
1042       2.  Added the ability to shut the error messages up
1043       3.  Reimplemented the pretty printer and fixed up/improved
1044           the pretty printing of handle and -> types.
1045       4.  Fixed up generation of literal symbols in the nowhere tool.
1046       5.  Added some SML keywords to to sml.sty
1047    
1048    ----------------------------------------------------------------------
1049    Name: Matthias Blume
1050    Date: 2002/02/19 16:20:00 EST
1051    Tag: blume-20020219-cmffi
1052    Description:
1053    
1054    A wild mix of changes, some minor, some major:
1055    
1056    * All C FFI-related libraries are now anchored under $c:
1057        $/c.cm      --> $c/c.cm
1058        $/c-int.cm  --> $c/internals/c-int.cm
1059        $/memory.cm --> $c/memory/memory.cm
1060    
1061    * "make" tool (in CM) now treats its argument pathname slightly
1062      differently:
1063        1. If the native expansion is an absolute name, then before invoking
1064           the "make" command on it, CM will apply OS.Path.mkRelative
1065           (with relativeTo = OS.FileSys.getDir()) to it.
1066        2. The argument will be passed through to subsequent phases of CM
1067           processing without "going native".  In particular, if the argument
1068           was an anchored path, then "make" will not lose track of that anchor.
1069    
1070    * Compiler backends now "know" their respective C calling conventions
1071      instead of having to be told about it by ml-nlffigen.  This relieves
1072      ml-nlffigen from one of its burdens.
1073    
1074    * The X86Backend has been split into X86CCallBackend and X86StdCallBackend.
1075    
1076    * Export C_DEBUG and C_Debug from $c/c.cm.
1077    
1078    * C type encoding in ml-nlffi-lib has been improved to model the conceptual
1079      subtyping relationship between incomplete pointers and their complete
1080      counterparts.  For this, ('t, 'c) ptr has been changed to 'o ptr --
1081      with the convention of instantiating 'o with ('t, 'c) obj whenever
1082      the pointer target type is complete.  In the incomplete case, 'o
1083      will be instantiated with some "'c iobj" -- a type obtained by
1084      using one of the functors PointerToIncompleteType or PointerToCompleteType.
1085    
1086      Operations that work on both incomplete and complete pointer types are
1087      typed as taking an 'o ptr while operations that require the target to
1088      be known are typed as taking some ('t, 'c) obj ptr.
1089    
1090      voidptr is now a bit "more concrete", namely "type voidptr = void ptr'"
1091      where void is an eqtype without any values.  This makes it possible
1092      to work on voidptr values using functions meant to operate on light
1093      incomplete pointers.
1094    
1095    * As a result of the above, signature POINTER_TO_INCOMPLETE_TYPE has
1096      been vastly simplified.
1097    
1098    ----------------------------------------------------------------------
1099    Name: Matthias Blume
1100    Date: 2002/02/19 10:48:00 EST
1101    Tag: blume-20020219-pqfix
1102    Description:
1103    
1104    Applied Chris Okasaki's bug fix for priority queues.
1105    
1106    ----------------------------------------------------------------------
1107    Name: Matthias Blume
1108  Date: 2002/02/15 17:05:00  Date: 2002/02/15 17:05:00
1109  Tag: Release_110_39  Tag: Release_110_39
1110  Description:  Description:

Legend:
Removed from v.1073  
changed lines
  Added in v.1189

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0