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

Legend:
Removed from v.672  
changed lines
  Added in v.679

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