This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / man / mono.1
1 .\" 
2 .\" mono manual page.
3 .\" (C) 2003 Ximian, Inc. 
4 .\" Author:
5 .\"   Miguel de Icaza (miguel@gnu.org)
6 .\"
7 .de Sp \" Vertical space (when we can't use .PP)
8 .if t .sp .5v
9 .if n .sp
10 ..
11 .TH Mono "Mono 1.0"
12 .SH NAME
13 mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
14 .SH SYNOPSIS
15 .PP
16 .B mono [options] file [arguments...]
17 .SH DESCRIPTION
18 \fImono\fP is a runtime implementation of the ECMA Common Language
19 Infrastructure.  This can be used to run ECMA and .NET applications.
20 .PP
21 The runtime contains a native code generator that transforms the
22 Common Intermediate Language into native code.
23 .PP
24 The code generator can operate in two modes: just in time compilation
25 (JIT) or ahead of time compilation (AOT).  Since code can be
26 dynamically loaded, the runtime environment and the JIT are always
27 present, even if code is compiled ahead of time.
28 .PP
29 The runtime loads ths specified
30 .I file
31 and optionally passes
32 the
33 .I arguments
34 to it.  The 
35 .I file
36 is an ECMA assembly.  They typically have a .exe or .dll extension.
37 .PP
38 The runtime provides a number of configuration options for running
39 applications, for developping and debugging, and for testing and
40 debugging the runtime itself.
41 .SH RUNTIME OPTIONS
42 The following options are available:
43 .TP
44 .I "--aot"
45 This option is used to precompile the CIL code in the specified
46 assembly to native code.  The generated code is stored in a file with
47 the extension .so.  This file will be automatically picked up by the
48 runtime when the assembly is executed.  
49 .Sp 
50 Ahead-of-Time compilation is most useful if you use it in combination
51 with the -O=all,-shared flag which enables all of the optimizations in
52 the code generator to be performed.  Some of those optimizations are
53 not practical for Just-in-Time compilation since they might be very
54 time consuming.
55 .Sp
56 Unlike the .NET Framework, Ahead-of-Time compilation will not generate
57 domain independent code: it generates the same code that the
58 Just-in-Time compiler would produce.   Since most applications use a
59 single domain, this is fine.   If you want to optimize the generated
60 code for use in multi-domain applications, consider using the
61 -O=shared flag.
62 .Sp
63 This pre-compiles the methods, but the original assembly is still
64 required to execute as this one contains the metadata and exception
65 information which is not availble on the generated file.  When
66 precompiling code, you might want to compile with all optimizations
67 (-O=all).  Pre-compiled code is position independent code.
68 .Sp
69 Pre compilation is just a mechanism to reduce startup time, and avoid
70 just-in-time compilation costs.  The original assembly must still be
71 present, as the metadata is contained there.
72 .TP
73 .I "--config filename"
74 Load the specified configuration file instead of the default one(s).
75 The default files are /etc/mono/config and ~/.mono/config or the file
76 specified in the MONO_CONFIG environment variable, if set.  See the
77 mono-config(5) man page for details on the format of this file.
78 .TP
79 .I "--help", "-h"
80 Displays usage instructions.
81 .TP
82 .I "--optimize=MODE", "-O=mode"
83 MODE is a comma separated list of optimizations.  They also allow
84 optimizations to be turned off by prefixing the optimization name with
85 a minus sign.
86 .Sp
87 The following optimizations are implemented:
88 .nf
89              all        Turn on all optimizations
90              peephole   Peephole postpass
91              branch     Branch optimizations
92              inline     Inline method calls
93              cfold      Constant folding
94              consprop   Constant propagation
95              copyprop   Copy propagation
96              deadce     Dead code elimination
97              linears    Linear scan global reg allocation
98              cmov       Conditional moves
99              shared     Emit per-domain code
100              sched      Instruction scheduling
101              intrins    Intrinsic method implementations
102              tailc      Tail recursion and tail calls
103              loop       Loop related optimizations
104              leaf       Leaf procedures optimizations
105              profile    Use profiling information
106 .fi
107 .Sp
108 For example, to enable all the optimization but dead code
109 elimination and inlining, you can use:
110 .nf
111         -O=all,-deadce,-inline
112 .fi
113 .TP
114 .I "-V", "--version"
115 Prints JIT version information.
116
117
118 .SH DEVELOPMENT OPTIONS
119 The following options are used to help when developing a JITed application.
120 .TP
121 .I "--debug"
122 Turns on the debugging mode in the runtime.  If an assembly was
123 compiled with debugging information, it will produce line number
124 information for stack traces. 
125 .TP
126 .I "--profile[=profiler[:profiler_args]]"
127 Instructs the runtime to collect profiling information about execution
128 times and memory allocation, and dump it at the end of the execution.
129 If a profiler is not specified, the default profiler is used. profiler_args 
130 is a profiler-specific string of options for the profiler itself.
131 .PP
132 The default profiler accepts -time and -alloc to options to disable
133 the time profiling or the memory allocation profilng.
134 .SH JIT MAINTAINER OPTIONS
135 The maintainer options are only used by those developing the runtime
136 itself, and not typically of interest to runtime users or developers.
137 .TP
138 .I "--compile name"
139 This compiles a method (namespace.name:methodname), this is used for
140 testing the compiler performance or to examine the output of the code
141 generator. 
142 .TP
143 .I "--compileall"
144 Compiles all the methods in an assembly.  This is used to test the
145 compiler performance or to examine the output of the code generator
146 .TP 
147 .I "--graph=TYPE METHOD"
148 This generates a postscript file with a graph with the details about
149 the specified method (namespace.name:methodname).  This requires `dot'
150 and ghostview to be installed (it expects Ghostview to be called
151 "gv"). 
152 .PP
153 The following graphs are available:
154 .nf
155           cfg        Control Flow Graph (CFG)
156           dtree      Dominator Tree
157           code       CFG showing code
158           ssa        CFG showing code after SSA translation
159           optcode    CFG showing code after IR optimizations
160 .fi
161 .Sp
162 Some graphs will only be available if certain optimizations are turned
163 on.
164 .TP
165 .I "--ncompile"
166 Instruct the runtime on the number of times that the method specified
167 by --compile (or all the methods if --compileall is used) to be
168 compiled.  This is used for testing the code generator performance. 
169 .TP
170 .I "-v", "--verbose"
171 Increases the verbosity level, each time it is listed, increases the
172 verbosity level to include more information (including, for example, 
173 a disassembly of the native code produced, code selector info etc.).
174 .TP
175 .I "--break method"
176 Inserts a breakpoint before the method whose name is `method'
177 (namespace.class:methodname).  Use `Main' as method name to insert a
178 breakpoint on the application's main method.
179 .TP
180 .I "--breakonex"
181 Inserts a breakpoint on exceptions.  This allows you to debug your
182 application with a native debugger when an exception is thrown.
183 .TP
184 .I "--trace[=expression]"
185 Shows method names as they are invoked.  By default all methods are
186 traced. 
187 .PP
188 The trace can be customized to include or exclude methods, classes or
189 assemblies.  A trace expression is a comma separated list of targets,
190 each target can be prefixed with a minus sign to turn off a particular
191 target.  The words `program' and `all' have special meaning.
192 `program' refers to the main program being executed, and `all' means
193 all the method calls. 
194 .PP
195 Assemblies are specified by their name, for example, to trace all
196 calls in the System assembly, use:
197 .nf
198
199         mono --trace=System app.exe
200
201 .fi
202 Classes are specified with the T: prefix.  For example, to trace all
203 calls to the System.String class, use:
204 .nf
205
206         mono --trace=T:System.String app.exe
207
208 .fi
209 And individual methods are referenced with the M: prefix, and the
210 standar method notation:
211 .nf
212
213         mono --trace=M:System.Console.WriteLine app.exe
214
215 .fi
216 As previously noted, various rules can be specified at once:
217 .nf
218
219         mono --trace=T:System.String,T:System.Random app.exe
220
221 .fi
222 You can exclude pieces, the next example traces calls to
223 System.String except for the System.String:Concat method.
224 .nf
225
226         mono --trace=T:System.String,-M:System.String:Concat
227
228 .fi
229 Finally, namespaces can be specified using the N: prefix:
230 .nf
231
232         mono --trace=N:System.Xml
233
234 .fi
235 .SH ENVIRONMENT VARIABLES
236 .TP
237 .I "GC_DONT_GC"
238 Turns off the garbage collection in Mono.  This should be only used
239 for debugging purposes
240 .TP
241 .I "MONO_ASPNET_NODELETE"
242 If set to any value, temporary source files generated by ASP.NET support
243 classes will not be removed. They will be kept in the user's temporary
244 directory.
245 .TP
246 .I "MONO_CFG_DIR"
247 If set, this variable overrides the default system configuration directory
248 ($PREFIX/etc). It's used to locate machine.config file.
249 .TP
250 .I "MONO_CONFIG"
251 If set, this variable overrides the default runtime configuration file
252 ($PREFIX/etc/mono/config). The --config command line options overrides the
253 environment variable.
254 .TP
255 .I "MONO_LOG_LEVEL"
256 If set, the logging level is changed to the set value. Possible values
257 are "error", "critical", "warning", "message", "info", "debug". The
258 default value is "error". Messages with a logging level greater then
259 or equal to the log level will be printed to stdout/stderr.
260 .TP
261 .I "MONO_LOG_MASK"
262 If set, the log mask is changed to the set value. Possible values are
263 "asm" (assembly loader), "type", "dll" (native library loader), "gc"
264 (garbage collector), "cfg" (config file loader), "all". The default value is
265 "all". Changing the mask value allows you to display only messages for
266 a certain component. You can use multiple masks by comma separating
267 them. For example to see config file messages and assembly loader
268 messages set you mask to "asm,cfg".
269 .TP
270 .I "MONO_DEBUG"
271 If set, enables some features of the runtime useful for debugging.
272 It makes the runtime display the stack traces for all the threads
273 running and exit when mono is interrupted (Ctrl-C) and print some
274 additional messages on error conditions. It may not exit cleanly. Use at
275 your own risk.
276 .TP
277 .I "MONO_DISABLE_AIO"
278 If set, tells mono NOT to attempt using native asynchronous I/O services. In
279 that case, the threadpool is used for asynchronous I/O on files and sockets.
280 .TP
281 .I "MONO_DISABLE_SHM"
282 If this variable is set, it disables the shared memory part of the
283 Windows I/O Emulation layer, and handles (files, events, mutexes,
284 pipes) will not be shared across processes.  Process creation is also
285 disabled.  This option is only available on Unix.
286 .TP
287 .I "MONO_EGD_SOCKET"
288 For platforms that do not otherwise have a way of obtaining random bytes
289 this can be set to the name of a file system socket on which an egd or
290 prngd daemon is listening.
291 .TP
292 .I "MONO_EXTERNAL_ENCODINGS"
293 If set, contains a colon-separated list of text encodings to try when
294 turning externally-generated text (e.g. command-line arguments or
295 filenames) into Unicode.  The encoding names come from the list
296 provided by iconv, and the special case "default_locale" which refers
297 to the current locale's default encoding.
298 .IP
299 When reading externally-generated text strings UTF-8 is tried first,
300 and then this list is tried in order with the first successful
301 conversion ending the search.  When writing external text (e.g. new
302 filenames or arguments to new processes) the first item in this list
303 is used, or UTF-8 if the environment variable is not set.
304 .TP
305 .I "MONO_MANAGED_WATCHER"
306 If set to any value, System.IO.FileSystemWatcher will use the default
307 managed implementation (slow). If unset, mono will try to use FAM under
308 Unix systems and native API calls on Windows, falling back to the
309 managed implementation on error.
310 .TP
311 .I "MONO_PATH"
312 Provides a search path to the runtime where to look for library files.
313 Directories are separated by the platform path separator (colons on unix). Example:
314 .B /home/username/lib:/usr/local/mono/lib
315 .TP
316 .I "MONO_GAC_PREFIX"
317 Provides a prefix the runtime uses to look for Global Assembly Caches.
318 Directories are separated by the platform path separator (colons on
319 unix). MONO_GAC_PREFIX should point to the top directory of a prefixed
320 install. Or to the directory provided in the gacutil /gacdir command. Example:
321 .B /home/username/.mono:/usr/local/mono/
322 .TP 
323 .I "MONO_SHARED_DIR"
324 If set its the directory where the ".wapi" handle state is stored.
325 This is the directory where the Windows I/O Emulation layer stores its
326 shared state data (files, events, mutexes, pipes).  By default Mono
327 will store the ".wapi" directory in the users's home directory.
328 .SH FILES
329 On Unix assemblies are loaded from the installation lib directory.  If you set
330 `prefix' to /usr, the assemblies will be located in /usr/lib.  On
331 Windows, the assemblies are loaded from the directory where mono and
332 mint live.
333 .PP
334 /etc/mono/config, ~/.mono/config
335 .PP
336 Mono runtime configuration file.  See the mono-config(5) manual page
337 for more information.
338 .SH MAILING LISTS
339 Visit http://mail.ximian.com/mailman/mono-list for details.
340 .SH WEB SITE
341 Visit: http://www.go-mono.com for details
342 .SH SEE ALSO
343 .BR mcs(1), mint(1), monodis(1), mono-config(5).
344 .PP
345 For ASP.NET-related documentation, see the xsp(1) manual page
346
347