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 670, Sun Jun 18 13:10:57 2000 UTC revision 680, Mon Jul 3 06:35:55 2000 UTC
# Line 13  Line 13 
13  Description:  Description:
14  ----------------------------------------------------------------------  ----------------------------------------------------------------------
15  Name: Matthias Blume  Name: Matthias Blume
16    Date: 2000/07/02 15:36:00 JST
17    Tag: blume-20000702-manual
18    Description:
19    
20    Small corrections and updates to CM manual.
21    
22    ----------------------------------------------------------------------
23    Name: Matthias Blumen
24    Date: 2000/06/29 16:04:00 JST
25    Tag: blume-20000629-yacctool
26    Description:
27    
28    Changes:
29    
30    1. Class "mlyacc" now takes separate arguments to pass options to
31       generated .sml- and .sig-files independently.
32    2. Corresponding CM manual updates.
33    3. BTrace module now also reports call sites.  (However, for loop clusters
34       it only shows from where the cluster was entered.)  There are associated
35       modifications to core.sml, internals.{sig,sml}, btrace.sml, and btimp.sml.
36    
37    ----------------------------------------------------------------------
38    Name: Matthias Blume
39    Date: 2000/06/27 16:51:00 JST
40    Tag: blume-20000627-noweb
41    Description:
42    
43    Changes:
44    
45     1. Implemented "subdir" and "witness" options for noweb tool.
46        This caused some slight internal changes in CM's tool implementation.
47     2. Fixed bug in "tool plugin" mechanism.  This is essentially cleaning
48        some remaining issues from earlier path anchor changes.
49     3. Updated CM manual accordingly.
50    
51     4. Changed implementation of back-tracing so that I now consider it
52        ready for prime-time.
53    
54        In particular, you don't have to explicitly trigger the back-trace
55        anymore.  Instead, if you are running BTrace-instrumented code and
56        there is an uncaught exception (regardless of whether or not it was
57        raised in instrumented code), the top-level evalloop will print
58        the back-trace.
59    
60        Features:
61    
62          - Instrumented and uninstrumented code work together seemlessly.
63            (Of course, uninstrumented code is never mentioned in actual
64             back-traces.)
65    
66          - Asymptotic time- and space-complexity of instrumented code is
67            equal to that of uninstrumented code.  (This means that
68            tail-recursion is preserved by the instrumentation phase.)
69    
70          - Modules whose code has been instrumented in different sessions
71            work together without problem.
72    
73          - There is no penalty whatsoever on uninstrumented code.
74    
75          - There is no penalty on "raise" expressions, even in
76            instrumented code.
77    
78        A potential bug (or perhaps it is a feature, too):
79    
80          A back-trace reaches no further than the outermost instrumented
81          non-trivial "raise".  Here, a "trivial" raise is one that is the
82          sole RHS of a "handle" rule.  Thus, back-traces reach trough
83    
84               <exp> handle e => raise e
85    
86          and even
87    
88               <exp> handle Foo => raise Bar
89    
90          and, of course, through
91    
92               <exp> handle Foo => ...
93    
94         if the exception was not Foo.
95    
96         Back-traces always reach right through any un-instrumented code
97         including any of its "handle" expressions, trivial or not.
98    
99       To try this out, do the following:
100    
101         - Erase all existing binfiles for your program.
102           (You may keep binfiles for those modules where you think you
103            definitely don't need back-tracing.)
104         - Turn on back-trace instrumentation:
105              SMLofNJ.Internals.BTrace.mode (SOME true);
106         - Recompile your program.  (I.e., run "CM.make" or "use".)
107         - You may now turn instrumentation off again (if you want):
108              SMLofNJ.Internals.BTrace.mode (SOME false);
109         - Run your program as usual.  If it raises an exception that
110           reaches the interactive toplevel, then a back-trace will
111           automatically be printed.  After that, the toplevel loop
112           will print the exception history as usual.
113    
114    ----------------------------------------------------------------------
115    Name: Matthias Blume
116    Date: 2000/06/26 09:56:46 JST
117    Tag: blume-20000626-setup
118    Description:
119    
120    CM: - setup-parameter to "sml" added; this can be used to run arbitrary
121          ML code before and after compiling a file (e.g., to set compiler
122          flags)
123    
124    Compiler: - improved btrace API (in core.sml, internals.{sig,sml})
125              - associated changes to btrace.sml (BTrace instrumentation pass)
126              - cleaner implementation of btimp.sml (BTrace tracing and report
127                module)
128    
129    CM manual: * new path encoding documented
130               * description of setup-parameter to "sml" added
131    
132    The biggest user-visible change to back-tracing is that it is no
133    longer necessary to compile all traced modules within the same
134    session.  (This was a real limitation.)
135    
136    ----------------------------------------------------------------------
137    Name: Matthias Blume
138    Date: 2000/06/24 12:40:00 JST
139    Tag: blume-20000624-startup
140    Description:
141    
142    Fixes startup slowdown problem.  (I was calling SrcPath.sync a _tad_
143    bit too often -- to put it mildly. :)
144    
145    ----------------------------------------------------------------------
146    Name: Matthias Blume
147    Date: 2000/06/23 18:20:00 JST
148    Tag: blume-20000623-btrace
149    Description:
150    
151    This updates adds a backtrace facility to aid programmers in debugging
152    their programs.  This involves the following changes:
153    
154    1. Module system/smlnj/init/core.sml (structure _Core) now has hooks for
155       keeping track of the current call stack.  When programs are compiled
156       in a special mode, the compiler will insert calls to these hooks
157       into the user program.
158       "Hook" means that it is possible for different implementations of
159       back-tracing to register themselves (at different times).
160    
161    2. compiler/MiscUtil/profile/btrace.sml implements the annotation phase
162       as an Absyn.dec->Absyn.dec rewrite.  Normally this phase is turned off.
163       It can be turned on using this call:
164         SMLofNJ.Internals.BTrace.mode (SOME true);
165       Turning it off again:
166         SMLofNJ.Internals.BTrace.mode (SOME false);
167       Querying the current status:
168         SMLofNJ.Internals.BTrace.mode NONE;
169       Annotated programs are about twice as big as normal ones, and they
170       run a factor of 2 to 4 slower with a dummy back-trace plugin (one
171       where all hooks do nothing).  The slowdown with a plugin that is
172       actually useful (such as the one supplied by default) is even greater,
173       but in the case of the default plugin it is still only an constant
174       factor (amortized).
175    
176    3. system/Basis/Implementation/NJ/internals.{sig,sml} have been augmented
177       with a sub-structure BTrace for controlling back-tracing.  In particular,
178       the above-mentioned function "mode" controls whether the annotation
179       phase is invoked by the compiler.  Another important function is
180       "trigger": when called it aborts the current execution and causes
181       the top-level loop to print a full back-trace.
182    
183    4. compiler/MiscUtil/profile/btimp.sml is the current default plugin
184       for back-tracing.  It keeps track of the dynamic call stack and in
185       addition to that it keeps a partial history at each "level" of that
186       stack.  For example, if a tail-calls b, b tail-calls c, and c tail-calls
187       d and b (at separate times, dynamically), then the report will show:
188    
189       GOTO   d
190             /c
191       GOTO  \b
192       CALL   a
193    
194       This shows that there was an initial non-tail call of a, then a
195       tail-call to b or c, looping behavior in a cluster of functions that
196       consist of b and c, and then a goto from that cluster (i.e., either from
197       b or from c) to d.
198    
199       Note that (depending on the user program) the amount of information
200       that the back-trace module has to keep track of at each level is bounded
201       by a constant.  Thus, the whole implementation has the same asymptotical
202       complexity as the original program (both in space and in time).
203    
204    5. compiler/TopLevel/interact/evalloop.sml has been modified to
205       handle the special exception SMLofNJ.Internals.BTrace.BTrace
206       which is raised by the "trigger" function mentioned above.
207    
208    Notes on usage:
209    
210    - Annotated code works well together with unannotated code:
211    Unannotated calls simply do not show up at all in the backtrace.
212    
213    - It is not a good idea to let modules that were annotated during
214    different sessions run at the same time.  This is because the compiler
215    chooses small integers to identify individual functions, and there
216    will be clashes if different modules were compiled in separate sessions.
217    (Nothing will crash, and you will even be told about the clashes, but
218    back-trace information will in general not be useful.)
219    
220    - Back-tracing can be confused by callcc and capture.
221    
222    - The only way of getting a back-trace right now is to explicitly
223    invoke the "trigger" function from your user program.  Eventually, we
224    should make every exception carry back-trace information (if
225    available).  But since this creates more overhead at "raise"-time
226    (similar to the current exnHistory overhead), I have not yet
227    implemented this.  (The implementation will be rather easy.)  With
228    exceptions carrying back-trace information, this facility will be even
229    more useful because users don't need to modify their programs...
230    
231    - While it is possible to compile the compiler with back-trace
232    annotations turned on (I did it to get some confidence in
233    correctness), you must make absolutely sure that core.sml and
234    btimp.sml are compiled WITHOUT annotation!  (core.sml cannot actually
235    be compiled with annotation because there is no core access yet, but
236    if you compile btimp.sml with annotation, then the system will go into
237    an infinite recursion and crash.)
238    Since CM currently does not know about BTrace, the only way to turn
239    annotations on and off for different modules of the compiler is to
240    interrupt CMB.make, change the settings, and re-invoke it.  Of course,
241    this is awkward and clumsy.
242    
243    Sample sessions:
244    
245    Standard ML of New Jersey v110.28.1 [FLINT v1.5], June 5, 2000
246    - SMLofNJ.Internals.BTrace.mode (SOME true);
247    [autoloading]
248    [autoloading done]
249    val it = false : bool
250    - structure X = struct
251    -     fun main n = let
252    -         fun a (x, 0) = d x
253    -           | a (x, n) = b (x, n - 1)
254    -         and b (x, n) = c (x, n)
255    -         and c (x, n) = a (x, n)
256    -         and d x = e (x, 3)
257    -         and e (x, 0) = f x
258    -           | e (x, n) = e (x, n - 1)
259    -         and f 0 = SMLofNJ.Internals.BTrace.trigger ()
260    -           | f n = n * g (n - 1)
261    -         and g n = a (n, 3)
262    -     in
263    -         f n
264    -     end
265    - end;
266    structure X : sig val main : int -> int end
267    - X.main 3;
268    *** BACK-TRACE ***
269    GOTO   stdIn:4.2-13.20: X.main[2].f
270    GOTO-( stdIn:4.2-13.20: X.main[2].e
271    GOTO   stdIn:4.2-13.20: X.main[2].d
272         / stdIn:4.2-13.20: X.main[2].a
273         | stdIn:4.2-13.20: X.main[2].b
274    GOTO-\ stdIn:4.2-13.20: X.main[2].c
275    CALL   stdIn:4.2-13.20: X.main[2].g
276    GOTO   stdIn:4.2-13.20: X.main[2].f
277    GOTO-( stdIn:4.2-13.20: X.main[2].e
278    GOTO   stdIn:4.2-13.20: X.main[2].d
279         / stdIn:4.2-13.20: X.main[2].a
280         | stdIn:4.2-13.20: X.main[2].b
281    GOTO-\ stdIn:4.2-13.20: X.main[2].c
282    CALL   stdIn:4.2-13.20: X.main[2].g
283    GOTO   stdIn:4.2-13.20: X.main[2].f
284    GOTO-( stdIn:4.2-13.20: X.main[2].e
285    GOTO   stdIn:4.2-13.20: X.main[2].d
286         / stdIn:4.2-13.20: X.main[2].a
287         | stdIn:4.2-13.20: X.main[2].b
288    GOTO-\ stdIn:4.2-13.20: X.main[2].c
289    CALL   stdIn:4.2-13.20: X.main[2].g
290    GOTO   stdIn:4.2-13.20: X.main[2].f
291    CALL   stdIn:2.15-17.4: X.main[2]
292    -
293    
294    (Note that because of a FLINt bug the above code currently does not
295    compile without BTrace turned on.)
296    
297    Here is another example, using my modified Tiger compiler:
298    
299    Standard ML of New Jersey v110.28.1 [FLINT v1.5], June 5, 2000
300    - SMLofNJ.Internals.BTrace.mode (SOME true);
301    [autoloading]
302    [autoloading done]
303    val it = false : bool
304    - CM.make "sources.cm";
305    [autoloading]
306    ...
307    [autoloading done]
308    [scanning sources.cm]
309    [parsing (sources.cm):parse.sml]
310    [creating directory CM/SKEL ...]
311    [parsing (sources.cm):tiger.lex.sml]
312    ...
313    [wrote CM/sparc-unix/semant.sml]
314    [compiling (sources.cm):main.sml]
315    [wrote CM/sparc-unix/main.sml]
316    [New bindings added.]
317    val it = true : bool
318    - Main.compile ("../testcases/merge.tig", "foo.out");
319    *** BACK-TRACE ***
320    CALL   lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trvar
321    CALL   lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp
322    CALL   lib/semant.sml:289.3-295.22: SemantFun[2].transExp.trexp.check[2]
323    GOTO   lib/semant.sml:289.3-295.22: SemantFun[2].transExp.trexp.check[2]
324    CALL   lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp
325    CALL   lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp
326    CALL   lib/semant.sml:488.3-505.6: SemantFun[2].transDec.trdec[2].transBody[2]
327         / lib/semant.sml:411.65-543.8: SemantFun[2].transDec
328    CALL-\ lib/semant.sml:413.2-540.9: SemantFun[2].transDec.trdec[2]
329    CALL   lib/semant.sml:99.2-396.21: SemantFun[2].transExp.trexp
330    CALL   lib/semant.sml:8.52-558.4: SemantFun[2].transProg[2]
331    CALL   main.sml:1.18-118.4: Main.compile[2]
332    -
333    
334    ----------------------------------------------------------------------
335    Name: Matthias Blumen
336    Date: 2000/06/21 18:00:00 JST
337    Tag: blume-20000621-manual
338    Description:
339    
340    CM manual update: Path environments documented.
341    
342    ----------------------------------------------------------------------
343    Name: Matthias Blume
344    Date: 2000/06/19 13:40:00
345    Tag: blume-20000619-manual
346    Description:
347    
348    CM manual and system/README update.  This only covers the fact that
349    there are no more implicit anchors.  (Path environments and the "bind"
350    option to "cm" have yet to be documented.)
351    
352    ----------------------------------------------------------------------
353    Name: Matthias Blume
354    Date: 2000/06/19 11:05:00 JST
355    Tag: blume-20000619-chdir-bugfix
356    Description:
357    
358    Fixed a bug in new SrcPath module that sometimes led to a bad chDir call.
359    
360    ----------------------------------------------------------------------
361    Name: Matthias Blume
362  Date: 2000/06/18 22:00:10 JST  Date: 2000/06/18 22:00:10 JST
363  Tag: blume-20000618-implicit-anchors-really-gone  Tag: blume-20000618-implicit-anchors-really-gone
364  Description:  Description:

Legend:
Removed from v.670  
changed lines
  Added in v.680

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