12 |
Tag: <post-commit CVS tag> |
Tag: <post-commit CVS tag> |
13 |
Description: |
Description: |
14 |
---------------------------------------------------------------------- |
---------------------------------------------------------------------- |
15 |
|
Name: Lal George |
16 |
|
Date: 2000/12/08 09:54:02 EST 2000 |
17 |
|
Tag: Release_110_31 |
18 |
|
Description: |
19 |
|
|
20 |
|
- Version 110.31 |
21 |
|
---------------------------------------------------------------------- |
22 |
|
Name: Allen Leung |
23 |
|
Date: Thu Dec 7 22:01:04 EST 2000 |
24 |
|
Tag: leunga-20001207-cell-monster-hack |
25 |
|
Description: |
26 |
|
|
27 |
|
Major MLRISC internal changes. Affect all clients. |
28 |
|
Summary: |
29 |
|
|
30 |
|
1. Type CELLS.cell = int is now replaced by a datatype. |
31 |
|
As a result, the old regmap is now gone. Almost all interfaces |
32 |
|
in MLRISC change as a consequence. |
33 |
|
|
34 |
|
2. A new brand version of machine description tool (v3.0) that generates |
35 |
|
modules expecting the new interface. The old version is removed. |
36 |
|
|
37 |
|
3. The RA interface has been further abstracted into two new functors. |
38 |
|
RISC_RA and X86RA. These functors have much simpler interfaces. |
39 |
|
[See also directory MLRISC/demo.] |
40 |
|
|
41 |
|
4. Some other new source->source code generation tools are available: |
42 |
|
|
43 |
|
a. MLRISC/Tools/RewriteGen -- generate rewriters from rules. |
44 |
|
b. MLRISC/Tools/WhereGen -- expands conditional pattern matching rules. |
45 |
|
I use this tool to generate the peephole optimizers---with the new |
46 |
|
cell type changes, peephole rules are becoming difficult to write |
47 |
|
without conditional pattern matching. |
48 |
|
|
49 |
|
5. More Intmap -> IntHashTable change. Previous changes by Matthias didn't |
50 |
|
cover the entire MLRISC source tree so many things broke. |
51 |
|
|
52 |
|
6. CM files have been moved to the subdirectory MLRISC/cm. |
53 |
|
They are moved because there are a lot of them and they clutter up the |
54 |
|
root dir. |
55 |
|
|
56 |
|
7. More detailed documentation to come... |
57 |
|
|
58 |
|
NOTE: To rebuild from 110.30 (ftp distribution), you'll have to do |
59 |
|
a makeml -rebuild first. This is because of other other |
60 |
|
changes that Matthias has made (see below). |
61 |
|
|
62 |
|
|
63 |
|
---------------------------------------------------------------------- |
64 |
|
Name: Matthias Blume |
65 |
|
Date: 2000/11/30 23:12:00 JST |
66 |
|
Tag: blume-20001130-filereorg |
67 |
|
Description: |
68 |
|
|
69 |
|
Some manual updates and some file reorganizations in CM. |
70 |
|
|
71 |
|
---------------------------------------------------------------------- |
72 |
|
Name: Matthias Blume |
73 |
|
Date: 2000/11/24 17:45:00 JST |
74 |
|
Tag: blume-20001124-link |
75 |
|
Description: |
76 |
|
|
77 |
|
Drastically improved link traversal code for the case that the dynamic |
78 |
|
value was already loaded at bootstrap time. As a result, CM and CMB |
79 |
|
now both load blazingly fast -- even on a very slow machine. Also, |
80 |
|
memory consumption has been further reduced by this. |
81 |
|
|
82 |
|
Warning: The format of the PIDMAP file has changed. THerefore, to |
83 |
|
bootstrap you have to do this: |
84 |
|
|
85 |
|
1. Run CMB.make |
86 |
|
2. Make a symbolic link for the boot directory: |
87 |
|
ln -s sml.boot.ARCH-OS xxx |
88 |
|
3. "Rebuild" the boot directory: |
89 |
|
./makeml -boot xxx -rebuild sml ; rm xxx |
90 |
|
4. Boot normally: |
91 |
|
./makeml |
92 |
|
|
93 |
|
---------------------------------------------------------------------- |
94 |
|
Name: Matthias Blume |
95 |
|
Date: 2000/11/21 21:20:00 JST |
96 |
|
Tag: blume-20001121-tools |
97 |
|
Description: |
98 |
|
|
99 |
|
Continued hacking on autoloading problem -- with success this time. |
100 |
|
Also changed tool-plugin mechanism. See new CM manual. |
101 |
|
|
102 |
|
---------------------------------------------------------------------- |
103 |
|
Name: Matthias Blume |
104 |
|
Date: 2000/11/19 14:30:00 JST |
105 |
|
Tag: blume-20001119-autoload |
106 |
|
Description: |
107 |
|
|
108 |
|
Some hacking to make autoloading faster. Success for CMB, no success |
109 |
|
so far for CM. There is a reduced structure CM' that autoloads faster. |
110 |
|
(This is a temporary, non-documented hack to be eliminated again when |
111 |
|
the general problem is solved.) |
112 |
|
|
113 |
|
---------------------------------------------------------------------- |
114 |
|
Name: Matthias Blume |
115 |
|
Date: 2000/11/17 14:10:00 JST |
116 |
|
Tag: blume-20001117-pickle-lib |
117 |
|
Description: |
118 |
|
|
119 |
|
1. Eliminated comp-lib.cm |
120 |
|
2. Made pickle-lib.cm |
121 |
|
3. Eliminated all uses of intset.sml (from comp-lib.cm) |
122 |
|
4. Replaced all uses of intmap.{sig,sml} (from comp-lib.cm) with |
123 |
|
equivalent constructs from smlnj-lib.cm (INtHashTable). |
124 |
|
5. Point 4. also goes for those uses of intmap.* in MLRISC. |
125 |
|
Duplicated intmap modules thrown out. |
126 |
|
6. Hunted down all duplicated SCC code and replaced it with |
127 |
|
equivalent stuff (GraphSCCFn from smlnj-lib.cm). |
128 |
|
7. Rewrote Feedback module. |
129 |
|
8. Moved sortedlist.sml into viscomp-lib.cm. Eventually it |
130 |
|
should be thrown out and equivalent modules from smlnj-lib.cm |
131 |
|
should be used (IntRedBlackSet, IntListSet, ...). |
132 |
|
|
133 |
|
Confirmed that compiler compiles to fixpoint. |
134 |
|
|
135 |
|
---------------------------------------------------------------------- |
136 |
|
Name: Allen Leung |
137 |
|
Date: 2000/11/10 18:00:00 |
138 |
|
Tag: leunga-20001110-new-x86-fp |
139 |
|
|
140 |
|
A new x86 floating point code generator has been added. |
141 |
|
By default this is turned off. To turn this on, do: |
142 |
|
|
143 |
|
CM.autoload "$smlnj/compiler.cm"; |
144 |
|
Compiler.Control.MLRISC.getFlag "x86-fast-fp" := true; |
145 |
|
|
146 |
|
Changes: |
147 |
|
|
148 |
|
1. Changed FTAN to FPTAN so that the assembly output is correct. |
149 |
|
2. Changed the extension callback for FTANGENT to generate: |
150 |
|
|
151 |
|
fptan |
152 |
|
fstp %st(0) |
153 |
|
instead of |
154 |
|
fptan |
155 |
|
fstpl ftempmem |
156 |
|
|
157 |
|
3. Numerous assembly fixes for x86. |
158 |
|
|
159 |
|
5. Cleaned up the machine code output module x86/x86MC.sml and added |
160 |
|
support for a whole bunch of instructions and addressing modes: |
161 |
|
|
162 |
|
fadd/fsub/fsubr/fmul/fdiv/fdivr %st, %st(n) |
163 |
|
faddp/fsubp/fsubrp/fmulp/fdivp/fdivrp %st, %st(n) |
164 |
|
fadd/fsub/fsubr/fmul/fdiv/fdivr %st(n), %st |
165 |
|
fiadd/fisub/fisubr/fimul/fidiv/fidivr mem |
166 |
|
fxch %st(n) |
167 |
|
fld %st(n) |
168 |
|
fst %st(n) |
169 |
|
fst mem |
170 |
|
fstp %st(n) |
171 |
|
fucom %st(n) |
172 |
|
fucomp %st(n) |
173 |
|
|
174 |
|
All these are now generated when the fast fp mode is turned on. |
175 |
|
|
176 |
|
6. Removed the dedicated registers %st(0), ..., %st(7) from X86CpsRegs |
177 |
|
|
178 |
|
---------------------------------------------------------------------- |
179 |
|
Name: Matthias Blume |
180 |
|
Date: 2000/11/09 11:20:00 JST |
181 |
|
Tag: blume-20001109-scc |
182 |
|
Description: |
183 |
|
|
184 |
|
Eliminated some code duplication: |
185 |
|
|
186 |
|
1. Added "where" clause to GraphSCCFn in SML/NJ Library. |
187 |
|
(Otherwise the functor is useless.) |
188 |
|
2. Used GraphSCCFn where SCCUtilFun was used previously. |
189 |
|
3. Got rid of SCCUtilFun (in comp-lib.cm). |
190 |
|
|
191 |
|
---------------------------------------------------------------------- |
192 |
|
Name: Lal George |
193 |
|
Date: 2000/11/06 09:02:21 EST 2000 |
194 |
|
Tag: Release_110_30 |
195 |
|
Description: |
196 |
|
|
197 |
|
- Version 110.30 |
198 |
|
---------------------------------------------------------------------- |
199 |
|
Name: Matthias Blume |
200 |
|
Date: 2000/11/04 14:45:00 |
201 |
|
Tag: blume-20001104-mlbuild |
202 |
|
Description: |
203 |
|
|
204 |
|
- Made ml-build faster on startup. |
205 |
|
- Documentation fixes. |
206 |
|
|
207 |
|
---------------------------------------------------------------------- |
208 |
|
Name: Matthias Blume |
209 |
|
Date: 2000/11/02 17:00:00 JST |
210 |
|
Tag: blume-20001102-condcomp |
211 |
|
Description: |
212 |
|
|
213 |
|
- Small tweaks to pickler -- new BOOTFILES! |
214 |
|
- Version bumped to 110.29.2. |
215 |
|
- Added conditional compilation facility to init.cmi (see comment there). |
216 |
|
---------------------------------------------------------------------- |
217 |
|
Name: Allen Leung |
218 |
|
Date: 2000/10/23 19:31:00 |
219 |
|
Tag: leunga-20001023-demo-ra |
220 |
|
|
221 |
|
1. Minor RA changes that improves spilling on x86 (affects Moby and C-- only) |
222 |
|
2. Test programs for the graph library updated |
223 |
|
3. Some new MLRISC demo programs added |
224 |
|
|
225 |
|
---------------------------------------------------------------------- |
226 |
|
Name: Matthias Blume |
227 |
|
Date: 2000/08/31 22:15:00 JST |
228 |
|
Tag: blume-20001017-errmsg |
229 |
|
Description: |
230 |
|
|
231 |
|
More error message grief: Where there used to be no messages, there |
232 |
|
now were some that had bogus error regions. Fixed. |
233 |
|
|
234 |
|
---------------------------------------------------------------------- |
235 |
|
Name: Matthias Blume |
236 |
|
Date: 2000/08/31 17:30:00 JST |
237 |
|
Tag: blume-20001017-v110p29p1 |
238 |
|
Description: |
239 |
|
|
240 |
|
I made a version 110.29.1 with new bootfiles. |
241 |
|
|
242 |
|
Changes: Modified pickler/unpickler for faster and leaner unpickling. |
243 |
|
CM documentation changes and a small bugfix in CM's error reporting. |
244 |
|
|
245 |
|
---------------------------------------------------------------------- |
246 |
|
Name: Lal George |
247 |
|
Date: 2000/09/27 14:42:35 EDT |
248 |
|
Tag: george-20000927-nodestatus |
249 |
|
Description: |
250 |
|
|
251 |
|
Changed the type of the nodestatus, so that: |
252 |
|
|
253 |
|
SPILLED(~1) is now SPILLED |
254 |
|
SPILLED(m) where m>=0 is now MEMREG(m) |
255 |
|
SPILLED(s) where s<~1 is now SPILL_LOC(~s) |
256 |
|
|
257 |
|
---------------------------------------------------------------------- |
258 |
|
Name: Matthias Blume |
259 |
|
Date: 2000/09/07 14:45:00 JST |
260 |
|
Tag: blume-20000907-cmerrmsg |
261 |
|
Description: |
262 |
|
|
263 |
|
Small tweak to CM to avoid getting ML syntax error messages twice. |
264 |
|
|
265 |
|
---------------------------------------------------------------------- |
266 |
|
Name: Matthias Blume |
267 |
|
Date: 2000/08/31 18:00:00 JST |
268 |
|
Tag: blume-20000831-cvsbootfiles |
269 |
|
Description: |
270 |
|
|
271 |
|
New URL for boot files (because the 110.29 files on the BL server do |
272 |
|
now work correctly with my updated install scripts for yacc and lex). |
273 |
|
|
274 |
|
---------------------------------------------------------------------- |
275 |
|
Name: Matthias Blume |
276 |
|
Date: 2000/08/08 12:33:00 JST |
277 |
|
Tag: blume-20000808-manual |
278 |
|
Description: |
279 |
|
|
280 |
|
Tiny update to CM manual. |
281 |
|
|
282 |
|
---------------------------------------------------------------------- |
283 |
|
Name: Allen Leung |
284 |
|
Date: 2000/08/7 19:31:00 |
285 |
|
Tag: leunga-20000807-a-whole-bunch-of-stuff |
286 |
|
|
287 |
|
Moby, C--, SSA, x86, machine descriptions etc. Should only affect C-- |
288 |
|
and Mobdy. |
289 |
|
|
290 |
|
1. x86 |
291 |
|
|
292 |
|
a. Fixes to peephole module by John and Dan. |
293 |
|
b. Assembly fix to SETcc by Allen. |
294 |
|
c. Fix to c-call by John. |
295 |
|
d. Fix to spilling by John. (This one deals with the missing FSTPT case) |
296 |
|
e. Instruction selection optimization to SETcc as suggested by John. |
297 |
|
|
298 |
|
For example, |
299 |
|
|
300 |
|
MV(32, x, COND(32, CMP(32, LT, a, b), LI 1, LI 0)) |
301 |
|
|
302 |
|
should generate: |
303 |
|
|
304 |
|
MOVL a, x |
305 |
|
SUBL b, x |
306 |
|
SHRL 31, x |
307 |
|
|
308 |
|
2. IR stuff |
309 |
|
|
310 |
|
A bunch of new DJ-graph related algorithms added. These |
311 |
|
speed up SSA construction. |
312 |
|
|
313 |
|
3. SSA + Scheduling |
314 |
|
|
315 |
|
Added code for SSA and scheduling to the repository |
316 |
|
|
317 |
|
---------------------------------------------------------------------- |
318 |
|
Name: Lal George |
319 |
|
Date: 2000/07/27 11:53:14 EDT |
320 |
|
|
321 |
|
Tag: lal-20000727-linux-ppc |
322 |
|
Description: |
323 |
|
|
324 |
|
Made changes to support Linux PPC. |
325 |
|
p.s. I have confirmation that the 110.29 boot files work fine. |
326 |
|
|
327 |
|
---------------------------------------------------------------------- |
328 |
|
Name: Matthias Blume |
329 |
|
Date: 2000/07/27 17:40:00 JST |
330 |
|
Tag: blume-20000727-scripts |
331 |
|
Description: |
332 |
|
|
333 |
|
!!!! WARNING !!!! |
334 |
|
You must recompile the runtime system! |
335 |
|
!!!! WARNING !!!! |
336 |
|
|
337 |
|
This is basically another round of script-enhancements: |
338 |
|
|
339 |
|
1. sml, ml-build, and ml-makedepend accept options -D and -U to define |
340 |
|
and undefine CM preprocessor symbols. |
341 |
|
|
342 |
|
2. ml-build avoids generating a new heap image if it finds that the |
343 |
|
existing one is still ok. (The condition is that no ML file had to |
344 |
|
be recompiled and all ML files are found to be older that the heap |
345 |
|
file.) |
346 |
|
|
347 |
|
To make this work smoothly, I also hacked the runtime system as |
348 |
|
well as SMLofNJ.SysInfo to get access to the heap image suffix |
349 |
|
(.sparc-solaris, ...) that is currently being used. |
350 |
|
|
351 |
|
Moreover, the signature of CM.mk_standalone has changed. See the |
352 |
|
CM manual. |
353 |
|
|
354 |
|
3. ml-makedepend accepts additional options -n, -a, and -o. (See the |
355 |
|
CM manual for details.) |
356 |
|
|
357 |
|
4. More CM manual updates: |
358 |
|
- all of the above has been documented. |
359 |
|
- there is now a section describing the (CM-related) command line |
360 |
|
arguments that are accepted by the "sml" command |
361 |
|
|
362 |
|
---------------------------------------------------------------------- |
363 |
|
Name: Matthias Blume |
364 |
|
Date: 2000/07/25 16:20:00 JST |
365 |
|
Tag: blume-20000725-makedepend |
366 |
|
Description: |
367 |
|
|
368 |
|
Added a script called ml-makedepend. This can be used in makefiles |
369 |
|
for Unix' make in a way very similar to the "makedepend" command for |
370 |
|
C. |
371 |
|
|
372 |
|
The script internally uses function CM.sources. |
373 |
|
|
374 |
|
Synopsis: |
375 |
|
|
376 |
|
ml-makedepend [-f makefile] cmfile targetname |
377 |
|
|
378 |
|
The default for the makefile is "makefile" (or "Makefile" should |
379 |
|
"makefile" not exist). |
380 |
|
|
381 |
|
ml-makedepend adds a cmfile/targetname-specific section to this |
382 |
|
makefile (after removing the previous version of this section). The |
383 |
|
section contains a single dependency specification with targetname on |
384 |
|
the LHS (targetname is an arbitrary name), and a list of files derived |
385 |
|
from the cmfile on the RHS. Some of the files on the RHS are |
386 |
|
ARCH/OPSYS-specific. Therefore, ml-makedepend inserts references to |
387 |
|
"make" variables $(ARCH) and $(OPSYS) in place of the corresponding |
388 |
|
path names. The makefile writer is responsible for making sure that |
389 |
|
these variables have correct at the time "make" is invoked. |
390 |
|
|
391 |
|
---------------------------------------------------------------------- |
392 |
|
Name: Matthias Blume |
393 |
|
Date: 2000/07/22 23:30:00 JST |
394 |
|
Tag: blume-20000722-urlupdate |
395 |
|
Description: |
396 |
|
|
397 |
|
Changed BOOT and config/srcarchiveurl to point to BL server: |
398 |
|
|
399 |
|
ftp://ftp.research.bell-labs.com/dist/smlnj/working/110.29/ |
400 |
|
|
401 |
|
---------------------------------------------------------------------- |
402 |
|
Name: Matthias Blume |
403 |
|
Date: 2000/07/18 18:00:00 JST |
404 |
|
Tag: blume-20000718-Version_110_29 |
405 |
|
Description: |
406 |
|
|
407 |
|
1. Updated src/compiler/TopLevel/main/version.sml to version 110.29 |
408 |
|
|
409 |
|
2. Updated config/version to 110.29 |
410 |
|
|
411 |
|
3. Updated config/srcarchiveurl |
412 |
|
|
413 |
|
3. New boot files! |
414 |
|
ftp://ftp.cs.princeton.edu/pub/people/blume/sml/110.29-autofetch |
415 |
|
|
416 |
|
---------------------------------------------------------------------- |
417 |
|
Name: Matthias Blume |
418 |
|
Date: 2000/07/11 13:58:00 JST |
419 |
|
Tag: blume-20000711-doctypo |
420 |
|
Description: |
421 |
|
|
422 |
|
Fixed a few typos in CM manual. |
423 |
|
|
424 |
|
---------------------------------------------------------------------- |
425 |
|
Name: Allen Leung |
426 |
|
Date: 2000/06/15 00:38:00 |
427 |
|
Tag: leunga-20000704-sparc-x86 |
428 |
|
|
429 |
|
1. x86 peephole improvement sp += k; sp -= k => nop [from John] |
430 |
|
2. fix to x86 RET bug [found by Dan Grossman] |
431 |
|
3. sparc assembly bug fix for ticc instructions [found by Fermin] |
432 |
|
|
433 |
|
Affects c-- and moby only |
434 |
|
|
435 |
|
---------------------------------------------------------------------- |
436 |
|
Name: Matthias Blume |
437 |
|
Date: 2000/07/04 15:26:00 |
438 |
|
Tag: blume-20000704-trigger |
439 |
|
Description: |
440 |
|
|
441 |
|
1. Improvements to CM manual. |
442 |
|
2. SMLofNJ.Internals.BTrace.trigger reinstated as an alternative way |
443 |
|
of getting a back-trace. The function, when called, raises an |
444 |
|
internal exception which explicitly carries the full back-trace history, |
445 |
|
so it is unaffected by any intervening handle-raise pairs ("trivial" |
446 |
|
or not). The interactive loop will print that history once it arrives |
447 |
|
at top level. |
448 |
|
Short of having all exceptions implicitly carry the full history, the |
449 |
|
recommended way of using this facility is: |
450 |
|
- compile your program with instrumentation "on" |
451 |
|
- run it, when it raises an exception, look at the history |
452 |
|
- if the history is "cut off" because of some handler, go and modify |
453 |
|
your program so that it explicitly calls BTrace.trigger |
454 |
|
- recompile (still instrumented), and rerun; look at the full history |
455 |
|
|
456 |
|
---------------------------------------------------------------------- |
457 |
|
Name: Matthias Blume |
458 |
|
Date: 2000/07/03 15:36:00 JST |
459 |
|
Tag: blume-20000702-manual |
460 |
|
Description: |
461 |
|
|
462 |
|
Small corrections and updates to CM manual. |
463 |
|
|
464 |
|
---------------------------------------------------------------------- |
465 |
|
Name: Matthias Blume |
466 |
|
Date: 2000/06/29 16:04:00 JST |
467 |
|
Tag: blume-20000629-yacctool |
468 |
|
Description: |
469 |
|
|
470 |
|
Changes: |
471 |
|
|
472 |
|
1. Class "mlyacc" now takes separate arguments to pass options to |
473 |
|
generated .sml- and .sig-files independently. |
474 |
|
2. Corresponding CM manual updates. |
475 |
|
3. BTrace module now also reports call sites. (However, for loop clusters |
476 |
|
it only shows from where the cluster was entered.) There are associated |
477 |
|
modifications to core.sml, internals.{sig,sml}, btrace.sml, and btimp.sml. |
478 |
|
|
479 |
|
---------------------------------------------------------------------- |
480 |
|
Name: Matthias Blume |
481 |
|
Date: 2000/06/27 16:51:00 JST |
482 |
|
Tag: blume-20000627-noweb |
483 |
|
Description: |
484 |
|
|
485 |
|
Changes: |
486 |
|
|
487 |
|
1. Implemented "subdir" and "witness" options for noweb tool. |
488 |
|
This caused some slight internal changes in CM's tool implementation. |
489 |
|
2. Fixed bug in "tool plugin" mechanism. This is essentially cleaning |
490 |
|
some remaining issues from earlier path anchor changes. |
491 |
|
3. Updated CM manual accordingly. |
492 |
|
|
493 |
|
4. Changed implementation of back-tracing so that I now consider it |
494 |
|
ready for prime-time. |
495 |
|
|
496 |
|
In particular, you don't have to explicitly trigger the back-trace |
497 |
|
anymore. Instead, if you are running BTrace-instrumented code and |
498 |
|
there is an uncaught exception (regardless of whether or not it was |
499 |
|
raised in instrumented code), the top-level evalloop will print |
500 |
|
the back-trace. |
501 |
|
|
502 |
|
Features: |
503 |
|
|
504 |
|
- Instrumented and uninstrumented code work together seemlessly. |
505 |
|
(Of course, uninstrumented code is never mentioned in actual |
506 |
|
back-traces.) |
507 |
|
|
508 |
|
- Asymptotic time- and space-complexity of instrumented code is |
509 |
|
equal to that of uninstrumented code. (This means that |
510 |
|
tail-recursion is preserved by the instrumentation phase.) |
511 |
|
|
512 |
|
- Modules whose code has been instrumented in different sessions |
513 |
|
work together without problem. |
514 |
|
|
515 |
|
- There is no penalty whatsoever on uninstrumented code. |
516 |
|
|
517 |
|
- There is no penalty on "raise" expressions, even in |
518 |
|
instrumented code. |
519 |
|
|
520 |
|
A potential bug (or perhaps it is a feature, too): |
521 |
|
|
522 |
|
A back-trace reaches no further than the outermost instrumented |
523 |
|
non-trivial "raise". Here, a "trivial" raise is one that is the |
524 |
|
sole RHS of a "handle" rule. Thus, back-traces reach trough |
525 |
|
|
526 |
|
<exp> handle e => raise e |
527 |
|
|
528 |
|
and even |
529 |
|
|
530 |
|
<exp> handle Foo => raise Bar |
531 |
|
|
532 |
|
and, of course, through |
533 |
|
|
534 |
|
<exp> handle Foo => ... |
535 |
|
|
536 |
|
if the exception was not Foo. |
537 |
|
|
538 |
|
Back-traces always reach right through any un-instrumented code |
539 |
|
including any of its "handle" expressions, trivial or not. |
540 |
|
|
541 |
|
To try this out, do the following: |
542 |
|
|
543 |
|
- Erase all existing binfiles for your program. |
544 |
|
(You may keep binfiles for those modules where you think you |
545 |
|
definitely don't need back-tracing.) |
546 |
|
- Turn on back-trace instrumentation: |
547 |
|
SMLofNJ.Internals.BTrace.mode (SOME true); |
548 |
|
- Recompile your program. (I.e., run "CM.make" or "use".) |
549 |
|
- You may now turn instrumentation off again (if you want): |
550 |
|
SMLofNJ.Internals.BTrace.mode (SOME false); |
551 |
|
- Run your program as usual. If it raises an exception that |
552 |
|
reaches the interactive toplevel, then a back-trace will |
553 |
|
automatically be printed. After that, the toplevel loop |
554 |
|
will print the exception history as usual. |
555 |
|
|
556 |
|
---------------------------------------------------------------------- |
557 |
|
Name: Matthias Blume |
558 |
|
Date: 2000/06/26 09:56:46 JST |
559 |
|
Tag: blume-20000626-setup |
560 |
|
Description: |
561 |
|
|
562 |
|
CM: - setup-parameter to "sml" added; this can be used to run arbitrary |
563 |
|
ML code before and after compiling a file (e.g., to set compiler |
564 |
|
flags) |
565 |
|
|
566 |
|
Compiler: - improved btrace API (in core.sml, internals.{sig,sml}) |
567 |
|
- associated changes to btrace.sml (BTrace instrumentation pass) |
568 |
|
- cleaner implementation of btimp.sml (BTrace tracing and report |
569 |
|
module) |
570 |
|
|
571 |
|
CM manual: * new path encoding documented |
572 |
|
* description of setup-parameter to "sml" added |
573 |
|
|
574 |
|
The biggest user-visible change to back-tracing is that it is no |
575 |
|
longer necessary to compile all traced modules within the same |
576 |
|
session. (This was a real limitation.) |
577 |
|
|
578 |
|
---------------------------------------------------------------------- |
579 |
|
Name: Matthias Blume |
580 |
|
Date: 2000/06/24 12:40:00 JST |
581 |
|
Tag: blume-20000624-startup |
582 |
|
Description: |
583 |
|
|
584 |
|
Fixes startup slowdown problem. (I was calling SrcPath.sync a _tad_ |
585 |
|
bit too often -- to put it mildly. :) |
586 |
|
|
587 |
|
---------------------------------------------------------------------- |
588 |
|
Name: Matthias Blume |
589 |
|
Date: 2000/06/23 18:20:00 JST |
590 |
|
Tag: blume-20000623-btrace |
591 |
|
Description: |
592 |
|
|
593 |
|
This updates adds a backtrace facility to aid programmers in debugging |
594 |
|
their programs. This involves the following changes: |
595 |
|
|
596 |
|
1. Module system/smlnj/init/core.sml (structure _Core) now has hooks for |
597 |
|
keeping track of the current call stack. When programs are compiled |
598 |
|
in a special mode, the compiler will insert calls to these hooks |
599 |
|
into the user program. |
600 |
|
"Hook" means that it is possible for different implementations of |
601 |
|
back-tracing to register themselves (at different times). |
602 |
|
|
603 |
|
2. compiler/MiscUtil/profile/btrace.sml implements the annotation phase |
604 |
|
as an Absyn.dec->Absyn.dec rewrite. Normally this phase is turned off. |
605 |
|
It can be turned on using this call: |
606 |
|
SMLofNJ.Internals.BTrace.mode (SOME true); |
607 |
|
Turning it off again: |
608 |
|
SMLofNJ.Internals.BTrace.mode (SOME false); |
609 |
|
Querying the current status: |
610 |
|
SMLofNJ.Internals.BTrace.mode NONE; |
611 |
|
Annotated programs are about twice as big as normal ones, and they |
612 |
|
run a factor of 2 to 4 slower with a dummy back-trace plugin (one |
613 |
|
where all hooks do nothing). The slowdown with a plugin that is |
614 |
|
actually useful (such as the one supplied by default) is even greater, |
615 |
|
but in the case of the default plugin it is still only an constant |
616 |
|
factor (amortized). |
617 |
|
|
618 |
|
3. system/Basis/Implementation/NJ/internals.{sig,sml} have been augmented |
619 |
|
with a sub-structure BTrace for controlling back-tracing. In particular, |
620 |
|
the above-mentioned function "mode" controls whether the annotation |
621 |
|
phase is invoked by the compiler. Another important function is |
622 |
|
"trigger": when called it aborts the current execution and causes |
623 |
|
the top-level loop to print a full back-trace. |
624 |
|
|
625 |
|
4. compiler/MiscUtil/profile/btimp.sml is the current default plugin |
626 |
|
for back-tracing. It keeps track of the dynamic call stack and in |
627 |
|
addition to that it keeps a partial history at each "level" of that |
628 |
|
stack. For example, if a tail-calls b, b tail-calls c, and c tail-calls |
629 |
|
d and b (at separate times, dynamically), then the report will show: |
630 |
|
|
631 |
|
GOTO d |
632 |
|
/c |
633 |
|
GOTO \b |
634 |
|
CALL a |
635 |
|
|
636 |
|
This shows that there was an initial non-tail call of a, then a |
637 |
|
tail-call to b or c, looping behavior in a cluster of functions that |
638 |
|
consist of b and c, and then a goto from that cluster (i.e., either from |
639 |
|
b or from c) to d. |
640 |
|
|
641 |
|
Note that (depending on the user program) the amount of information |
642 |
|
that the back-trace module has to keep track of at each level is bounded |
643 |
|
by a constant. Thus, the whole implementation has the same asymptotical |
644 |
|
complexity as the original program (both in space and in time). |
645 |
|
|
646 |
|
5. compiler/TopLevel/interact/evalloop.sml has been modified to |
647 |
|
handle the special exception SMLofNJ.Internals.BTrace.BTrace |
648 |
|
which is raised by the "trigger" function mentioned above. |
649 |
|
|
650 |
|
Notes on usage: |
651 |
|
|
652 |
|
- Annotated code works well together with unannotated code: |
653 |
|
Unannotated calls simply do not show up at all in the backtrace. |
654 |
|
|
655 |
|
- It is not a good idea to let modules that were annotated during |
656 |
|
different sessions run at the same time. This is because the compiler |
657 |
|
chooses small integers to identify individual functions, and there |
658 |
|
will be clashes if different modules were compiled in separate sessions. |
659 |
|
(Nothing will crash, and you will even be told about the clashes, but |
660 |
|
back-trace information will in general not be useful.) |
661 |
|
|
662 |
|
- Back-tracing can be confused by callcc and capture. |
663 |
|
|
664 |
|
- The only way of getting a back-trace right now is to explicitly |
665 |
|
invoke the "trigger" function from your user program. Eventually, we |
666 |
|
should make every exception carry back-trace information (if |
667 |
|
available). But since this creates more overhead at "raise"-time |
668 |
|
(similar to the current exnHistory overhead), I have not yet |
669 |
|
implemented this. (The implementation will be rather easy.) With |
670 |
|
exceptions carrying back-trace information, this facility will be even |
671 |
|
more useful because users don't need to modify their programs... |
672 |
|
|
673 |
|
- While it is possible to compile the compiler with back-trace |
674 |
|
annotations turned on (I did it to get some confidence in |
675 |
|
correctness), you must make absolutely sure that core.sml and |
676 |
|
btimp.sml are compiled WITHOUT annotation! (core.sml cannot actually |
677 |
|
be compiled with annotation because there is no core access yet, but |
678 |
|
if you compile btimp.sml with annotation, then the system will go into |
679 |
|
an infinite recursion and crash.) |
680 |
|
Since CM currently does not know about BTrace, the only way to turn |
681 |
|
annotations on and off for different modules of the compiler is to |
682 |
|
interrupt CMB.make, change the settings, and re-invoke it. Of course, |
683 |
|
this is awkward and clumsy. |
684 |
|
|
685 |
|
Sample sessions: |
686 |
|
|
687 |
|
Standard ML of New Jersey v110.28.1 [FLINT v1.5], June 5, 2000 |
688 |
|
- SMLofNJ.Internals.BTrace.mode (SOME true); |
689 |
|
[autoloading] |
690 |
|
[autoloading done] |
691 |
|
val it = false : bool |
692 |
|
- structure X = struct |
693 |
|
- fun main n = let |
694 |
|
- fun a (x, 0) = d x |
695 |
|
- | a (x, n) = b (x, n - 1) |
696 |
|
- and b (x, n) = c (x, n) |
697 |
|
- and c (x, n) = a (x, n) |
698 |
|
- and d x = e (x, 3) |
699 |
|
- and e (x, 0) = f x |
700 |
|
- | e (x, n) = e (x, n - 1) |
701 |
|
- and f 0 = SMLofNJ.Internals.BTrace.trigger () |
702 |
|
- | f n = n * g (n - 1) |
703 |
|
- and g n = a (n, 3) |
704 |
|
- in |
705 |
|
- f n |
706 |
|
- end |
707 |
|
- end; |
708 |
|
structure X : sig val main : int -> int end |
709 |
|
- X.main 3; |
710 |
|
*** BACK-TRACE *** |
711 |
|
GOTO stdIn:4.2-13.20: X.main[2].f |
712 |
|
GOTO-( stdIn:4.2-13.20: X.main[2].e |
713 |
|
GOTO stdIn:4.2-13.20: X.main[2].d |
714 |
|
/ stdIn:4.2-13.20: X.main[2].a |
715 |
|
| stdIn:4.2-13.20: X.main[2].b |
716 |
|
GOTO-\ stdIn:4.2-13.20: X.main[2].c |
717 |
|
CALL stdIn:4.2-13.20: X.main[2].g |
718 |
|
GOTO stdIn:4.2-13.20: X.main[2].f |
719 |
|
GOTO-( stdIn:4.2-13.20: X.main[2].e |
720 |
|
GOTO stdIn:4.2-13.20: X.main[2].d |
721 |
|
/ stdIn:4.2-13.20: X.main[2].a |
722 |
|
| stdIn:4.2-13.20: X.main[2].b |
723 |
|
GOTO-\ stdIn:4.2-13.20: X.main[2].c |
724 |
|
CALL stdIn:4.2-13.20: X.main[2].g |
725 |
|
GOTO stdIn:4.2-13.20: X.main[2].f |
726 |
|
GOTO-( stdIn:4.2-13.20: X.main[2].e |
727 |
|
GOTO stdIn:4.2-13.20: X.main[2].d |
728 |
|
/ stdIn:4.2-13.20: X.main[2].a |
729 |
|
| stdIn:4.2-13.20: X.main[2].b |
730 |
|
GOTO-\ stdIn:4.2-13.20: X.main[2].c |
731 |
|
CALL stdIn:4.2-13.20: X.main[2].g |
732 |
|
GOTO stdIn:4.2-13.20: X.main[2].f |
733 |
|
CALL stdIn:2.15-17.4: X.main[2] |
734 |
|
- |
735 |
|
|
736 |
|
(Note that because of a FLINt bug the above code currently does not |
737 |
|
compile without BTrace turned on.) |
738 |
|
|
739 |
|
Here is another example, using my modified Tiger compiler: |
740 |
|
|
741 |
|
Standard ML of New Jersey v110.28.1 [FLINT v1.5], June 5, 2000 |
742 |
|
- SMLofNJ.Internals.BTrace.mode (SOME true); |
743 |
|
[autoloading] |
744 |
|
[autoloading done] |
745 |
|
val it = false : bool |
746 |
|
- CM.make "sources.cm"; |
747 |
|
[autoloading] |
748 |
|
... |
749 |
|
[autoloading done] |
750 |
|
[scanning sources.cm] |
751 |
|
[parsing (sources.cm):parse.sml] |
752 |
|
[creating directory CM/SKEL ...] |
753 |
|
[parsing (sources.cm):tiger.lex.sml] |
754 |
|
... |
755 |
|
[wrote CM/sparc-unix/semant.sml] |
756 |
|
[compiling (sources.cm):main.sml] |
757 |
|
[wrote CM/sparc-unix/main.sml] |
758 |
|
[New bindings added.] |
759 |
|
val it = true : bool |
760 |
|
- Main.compile ("../testcases/merge.tig", "foo.out"); |
761 |
|
*** BACK-TRACE *** |
762 |
|
CALL lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trvar |
763 |
|
CALL lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp |
764 |
|
CALL lib/semant.sml:289.3-295.22: SemantFun[2].transExp.trexp.check[2] |
765 |
|
GOTO lib/semant.sml:289.3-295.22: SemantFun[2].transExp.trexp.check[2] |
766 |
|
CALL lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp |
767 |
|
CALL lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp |
768 |
|
CALL lib/semant.sml:488.3-505.6: SemantFun[2].transDec.trdec[2].transBody[2] |
769 |
|
/ lib/semant.sml:411.65-543.8: SemantFun[2].transDec |
770 |
|
CALL-\ lib/semant.sml:413.2-540.9: SemantFun[2].transDec.trdec[2] |
771 |
|
CALL lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp |
772 |
|
CALL lib/semant.sml:8.52-558.4: SemantFun[2].transProg[2] |
773 |
|
CALL main.sml:1.18-118.4: Main.compile[2] |
774 |
|
- |
775 |
|
|
776 |
|
---------------------------------------------------------------------- |
777 |
Name: Matthias Blumen |
Name: Matthias Blumen |
778 |
Date: 2000/06/21 18:00:00 JST |
Date: 2000/06/21 18:00:00 JST |
779 |
Tag: blume-20000621-manual |
Tag: blume-20000621-manual |