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
 [smlnj] / sml / trunk / HISTORY

# Diff of /sml/trunk/HISTORY

revision 1158, Fri Mar 22 01:21:25 2002 UTC revision 1180, Tue Mar 26 22:24:24 2002 UTC
# Line 13  Line 13
13  Description:  Description:
14
15  ----------------------------------------------------------------------  ----------------------------------------------------------------------
16    Name: Matthias Blume
17    Date: 2002/03/25 17:25:00 EST
18    Tag: blume-20020325-divmod
19    Description:
20
21    I improved (hopefully without breaking them) the implementation of Int.div,
22    Int.mod, and Int.rem.   For this, the code in translate.sml now takes
23    advantage of the following observations:
24
25      Let  q = x quot y      r = x rem y
26           d = x div  y      m = x mod y
27
28    where "quot" is the round-to-zero version of integer division that
29    hardware usually provides.  Then we have:
30
31         r = x - q * y        where neither the * nor the - will overflow
32         d = if q >= 0 orelse x = q * y then q else q - 1
33                              where neither the * nor the - will overflow
34         m = if q >= 0 orelse r = 0 then r else r + y
35                              where the + will not overflow
36
37    This results in substantial simplification of the generated code.
38    The following table shows the number of CFG nodes and edges generated
39    for
40            fun f (x, y) = x OPER y
41            (* with OPER \in div, mod, quot, rem *)
42
43
44        OPER | nodes(old) | edges(old) | nodes(new) | edges(new)
45        --------------------------------------------------------
46         div |         24 |         39 |         12 |         16
47         mod |         41 |         71 |         12 |         16
48        quot |          8 |         10 |          8 |         10
49         rem |         10 |         14 |          8 |         10
50
51
52    ----------------------------------------------------------------------
53    Name: Matthias Blume
54    Date: 2002/03/25 22:06:00 EST
55    Tag: blume-20020325-cprotobug
56    Description:
57
58    Fixed a bug in cproto (c prototype decoder).
59
60    ----------------------------------------------------------------------
61    Name: Matthias Blume
62    Date: 2002/03/25 16:00:00 EST
63    Tag: blume-20020325-raw-primops
64    Description:
65
66    I did some cleanup to Allen's new primop code and
67    replaced yesterday's bootfiles with new ones.
68    (But they are stored in the same place.)
69
70    ----------------------------------------------------------------------
71    Name: Matthias Blume
72    Date: 2002/03/24 22:40:00 EST
73    Tag: blume-20020324-bootfiles
74    Description:
75
77
78    ----------------------------------------------------------------------
79    Name: Allen Leung
80    Date: 2002/03/23 15:50:00 EST
81    Tag: leunga-20020323-flint-cps-rcc-primops
82    Description:
83
84      1. Changes to FLINT primops:
85
86        (* make a call to a C-function;
87         * The primop carries C function prototype information and specifies
88         * which of its (ML-) arguments are floating point. C prototype
89         * information is for use by the backend, ML information is for
90         * use by the CPS converter. *)
91      | RAW_CCALL of { c_proto: CTypes.c_proto,
92                       ml_args: ccall_type list,
93                       ml_res_opt: ccall_type option,
94                       reentrant : bool
95                     } option
96       (* Allocate uninitialized storage on the heap.
97        * The record is meant to hold short-lived C objects, i.e., they
98        * are not ML pointers.  With the tag, the representation is
99        * the same as RECORD with tag tag_raw32 (sz=4), or tag_fblock (sz=8)
100        *)
101      | RAW_RECORD of {tag:bool,sz:int}
102      and ccall_type = CCALL_INT32 | CCALL_REAL64 | CCALL_ML_PTR
103
104      2.  These CPS primops are now overloaded:
105
107           rawstore of {kind:numkind}
108
109          The one argument form is:
110
112
113          The two argument form is:
114
115             rawload {kind} [ml object, byte-offset]
116
117      3. RAW_CCALL/RCC now takes two extra arguments:
118
119         a. The first is whether the C call is reentrant, i.e., whether
120            ML state should be saved and restored.
121         b. The second argument is a string argument specifying the name of
122            library and the C function.
123
124         These things are currently not handled in the code generator, yet.
125
126      4. In CProto,
127
128         An encoding type of "bool" means "ml object" and is mapped into
129         C prototype of PTR.  Note that "bool" is different than "string",
130         even though "string" is also mapped into PTR, because "bool"
131         is assigned an CPS type of BOGt, while "string" is assigned INT32t.
132
133      5. Pickler/unpicker
134
135         Changed to handle RAW_RECORD and newest RAW_CCALL
136
137      6. MLRiscGen,
138
139         1. Changed to handle the new rawload/rawstore/rawrecord operators.
140         2. Code for handling C Calls has been moved to a new module CPSCCalls,
141            in the file CodeGen/cpscompile/cps-c-calls.sml
142
143      7. Added the conditional move operator
144
145             condmove of branch
146
147         to cps.  Generation of this is still buggy so it is currently
148         disabled.
149
150    ----------------------------------------------------------------------
151    Name: Lal George
152    Date: 2002/03/22 14:18:25 EST
153    Tag: george-20020322-cps-branch-prob
154    Description:
155
156    Implemented the Ball-Larus branch prediction-heuristics, and
157    incorporated graphical viewers for control flow graphs.
158
159    Ball-Larus Heuristics:
160    ---------------------
161    See the file compiler/CodeGen/cpscompile/cpsBranchProb.sml.
162
163    By design it uses the Dempster-Shafer theory for combining
164    probabilities.  For example, in the function:
165
166        fun f(n,acc) = if n = 0 then acc else f(n-1, n*acc)
167
168    the ball-larus heuristics predicts that the n=0 is unlikely
169    (OH-heuristic), and the 'then' branch is unlikely because of the
170    RH-heuristic -- giving the 'then' branch an even lower combined
171    probability using the Dempster-Shafer theory.
172
173    Finally, John Reppy's loop analysis in MLRISC, further lowers the
174    probability of the 'then' branch because of the loop in the else
175    branch.
176
177
178    Graphical Viewing:
179    ------------------
180    I merely plugged in Allen's graphical viewers into the compiler. The
181    additional code is not much. At the top level, saying:
182
183            Control.MLRISC.getFlag "cfg-graphical-view" := true;
184
185    will display the graphical view of the control flow graph just before
186    back-patching.  daVinci must be in your path for this to work. If
187    daVinci is not available, then the default viewer can be changed
188    using:
189
190            Control.MLRISC.getString "viewer"
191
192    which can be set to "dot" or "vcg" for the corresponding viewers. Of
193    course, these viewers must be in your path.
194
195    The above will display the compilation unit at the level of clusters,
196    many of which are small, boring, and un-interesting. Also setting:
197
198            Control.MLRISC.getInt "cfg-graphical-view_size"
199
200    will display clusters that are larger than the value set by the above.
201
202
203    ----------------------------------------------------------------------
204    Name: Matthias Blume
205    Date: 2002/03/21 22:20:00 EST
206    Tag: blume-20020321-kmp-bugfix
207    Description:
208
209    Changed the interface to the KMP routine in PreString and fixed
210    a minor bug in one place where it was used.
211
212    ----------------------------------------------------------------------
213  Name: Allen Leung  Name: Allen Leung
214  Date: 2002/03/21 20:30:00 EST  Date: 2002/03/21 20:30:00 EST
215  Tag: leunga-20020321-cfg  Tag: leunga-20020321-cfg

Legend:
 Removed from v.1158 changed lines Added in v.1180