Next: , Previous: , Up: The Compiler   [Contents][Index]


4.2 Calling the Compiler

Functions may be compiled using compile, compile-file, or compile-from-stream.

Function: compile name &optional definition

This function compiles the function whose name is name. If name is nil, the compiled function object is returned. If definition is supplied, it should be a lambda expression that is to be compiled and then placed in the function cell of name. As per the proposed X3J13 cleanup “compile-argument-problems”, definition may also be an interpreted function.

The return values are as per the proposed X3J13 cleanup “compiler-diagnostics”. The first value is the function name or function object. The second value is nil if no compiler diagnostics were issued, and t otherwise. The third value is nil if no compiler diagnostics other than style warnings were issued. A non-nil value indicates that there were “serious” compiler diagnostics issued, or that other conditions of type error or warning (but not style-warning) were signaled during compilation.

Function: compile-file input-pathname &key :output-file :error-file :trace-file :error-output :verbose :print :progress :load :block-compile :entry-points :byte-compile :xref

The CMUCL compile-file is extended through the addition of several new keywords and an additional interpretation of input-pathname:

input-pathname

If this argument is a list of input files, rather than a single input pathname, then all the source files are compiled into a single object file. In this case, the name of the first file is used to determine the default output file names. This is especially useful in combination with block-compile.

:output-file

This argument specifies the name of the output file. t gives the default name, nil suppresses the output file.

:error-file

A listing of all the error output is directed to this file. If there are no errors, then no error file is produced (and any existing error file is deleted.) t gives "name.err" (the default), and nil suppresses the output file.

:error-output

If t (the default), then error output is sent to *error-output*. If a stream, then output is sent to that stream instead. If nil, then error output is suppressed. Note that this error output is in addition to (but the same as) the output placed in the error-file.

:verbose

If t (the default), then the compiler prints to error output at the start and end of compilation of each file. See compile-verbose.

:print

If t (the default), then the compiler prints to error output when each function is compiled. See compile-print.

:progress

If t (default nil), then the compiler prints to error output progress information about the phases of compilation of each function. This is a CMUCL extension that is useful mainly in large block compilations. See compile-progress.

:trace-file

If t, several of the intermediate representations (including annotated assembly code) are dumped out to this file. t gives "name.trace". Trace output is off by default. See trace-files.

:load

If t, load the resulting output file.

:block-compile

Controls the compile-time resolution of function calls. By default, only self-recursive calls are resolved, unless an ext:block-start declaration appears in the source file. See compile-file-block.

:entry-points

If non-nil, then this is a list of the names of all functions in the file that should have global definitions installed (because they are referenced in other files.) See compile-file-block.

:byte-compile

If t, compiling to a compact interpreted byte code is enabled. Possible values are t, nil, and :maybe (the default.) See byte-compile-default and see byte-compile.

:xref

If non-nil, enable recording of cross-reference information. The default is the value of c:*record-xref-info*. See xref. Note that the compiled fasl file will also contain cross-reference information and loading the fasl later will populate the cross-reference database.

The return values are as per the proposed X3J13 cleanup “compiler-diagnostics”. The first value from compile-file is the truename of the output file, or nil if the file could not be created. The interpretation of the second and third values is described above for compile.

Variable: *compile-verbose*
Variable: *compile-print*
Variable: *compile-progress*

These variables determine the default values for the :verbose, :print and :progress arguments to compile-file.

Function: extensions:compile-from-stream input-stream &key :error-stream :trace-stream :block-compile :entry-points :byte-compile

This function is similar to compile-file, but it takes all its arguments as streams. It reads Common Lisp code from input-stream until end of file is reached, compiling into the current environment. This function returns the same two values as the last two values of compile. No output files are produced.


Next: , Previous: , Up: The Compiler   [Contents][Index]