|
|
1.1 root 1: .\" Copyright (c) 1980 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)chc.n 6.1 (Berkeley) 4/29/86
6: .\"
7: ." $Header: /na/franz/doc/RCS/chc.n,v 1.1 83/01/31 07:11:44 jkf Exp $
8: .Ap 3 Short\ Subjects.
9: .sp 2v
10: .tl ''\fB\s+2The Garbage Collector\s0\fP'
11: .pp
12: The garbage collector is invoked automatically whenever a collectable
13: data type runs out.
14: All data types are collectable except strings and atoms are not.
15: After a garbage collection finishes, the collector will call the function
16: .i gcafter
17: which should be a lambda of one argument.
18: The argument passed to
19: .i gcafter
20: is the name of the data type which ran out and caused the garbage collection.
21: It is
22: .i gcafter 's
23: responsibility to
24: allocate more pages of free space.
25: The default
26: .i gcafter
27: makes its decision based on the percentage of space still in
28: use after the garbage collection.
29: If there is a large percentage of space still in use,
30: .i gcafter
31: allocates a larger amount of free space than if only a small percentage of
32: space is still in use.
33: The default
34: .i gcafter
35: will also print a summary of the space in use if the variable
36: .i $gcprint
37: is non nil.
38: The summary always includes the state of the list and fixnum space and
39: will include another type if it caused the garbage collection.
40: The type which caused the garbage collection is preceded by an asterisk.
41: .sp 4v
42: .tl ''\s+2\fBDebugging\fP\s0''
43: .pp
44: There are two simple functions to help you debug your programs:
45: .i baktrace
46: and
47: .i showstack .
48: When an error occurs (or when you type the interrupt character),
49: you will be left at a break level with the state of the computation
50: frozen in the stack.
51: At this point, calling the function
52: .i showstack
53: will cause the contents of the lisp evaluation stack to be printed in
54: reverse chronological order (most recent first).
55: When the programs you are running are interpreted or traced, the output
56: of
57: .i showstack
58: can be very verbose.
59: The function
60: .i baktrace
61: prints a summary of what
62: .i showstack
63: prints.
64: That is, if showstack would print a list,
65: .i baktrace
66: would only print the first element of the list.
67: If you are running compiled code with the \fI(status\ translink)\fP non
68: nil, then fast links are being made.
69: In this case,
70: there is not enough information on the stack for
71: .i showstack
72: and
73: .i baktrace .
74: Thus, if you are debugging compiled code you should probably do
75: \fI(sstatus\ translink\ nil)\fP.
76: .pp
77: If the contents of the stack don't tell you enough about your problem, the
78: next thing you may
79: want to try is to run your program with
80: certain functions traced.
81: You can direct the trace package to stop program execution when it enters
82: a function, allowing you to examine the contents of variables or
83: call other functions.
84: The trace package is documented in Chapter 11.
85: .pp
86: It is also possible to single step the evaluator and to look at stack
87: frames within lisp.
88: The programs which
89: perform these actions are described in Chapters 14 and 15.
90: .bp
91: .tl ''\fB\s+2The Interpreter\'s Top Level\s0\fP''
92: .pp
93: The default top level interpreter for Franz, named
94: .i franz-top-level
95: is defined in /usr/lib/lisp/toplevel.l
96: It is given control when the lisp system starts up because the
97: variable top-level is bound to the symbol
98: .i franz-top-level .
99: The first action
100: .i franz-top-level
101: takes is to print out the name of the current
102: version of the lisp system.
103: Then it loads the file .lisprc from the HOME directory of the person
104: invoking the lisp system if that file exists.
105: The .lisprc file allows you to set up your own defaults, read in files,
106: set up autoloading or anything else you might want to do to personalize
107: the lisp system.
108: Next, the top level goes into a prompt-read-eval-print loop.
109: Each time around the loop, before printing the prompt it checks
110: if the variable user-top-level is bound.
111: If so, then the value of user-top-level will be
112: .i funcall ed.
113: This provides a convenient way for a user to introduce his own top level
114: (Liszt, the lisp compiler, is an example of a program which uses this).
115: If the user types a ^D (which is the end of file character), and the
116: standard input is not from a keyboard, the lisp system will exit.
117: If the standard input is a keyboard and if the value of
118: .i "(status\ ignoreeof)"
119: is nil, the lisp system will also exit.
120: Otherwise the end of file will be ignored.
121: When a
122: .i reset
123: is done
124: the current value of
125: .i errlist
126: is saved away and control is thrown back up to the top level where
127: .i eval
128: is mapped over the saved value of
129: .i errlist.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.