Next: , Previous: , Up: Top   [Contents][Index]

21 Byte Compilation

SXEmacs Lisp has a compiler that translates functions written in elisp into a special representation called byte-code that can be executed more efficiently. The compiler replaces Lisp function definitions with byte-code. When a byte-coded function is called, its definition is evaluated by the byte-code interpreter.

Because the byte-compiled code is evaluated by the byte-code interpreter, instead of being executed directly by the machine’s hardware (as true compiled code is), byte-code is completely transportable from machine to machine without recompilation. It is not, however, as fast as true compiled code.

In general, any version of ((S)X)Emacs can run byte-compiled code produced by recent earlier versions of ((S)X)Emacs, but the reverse is not true. In particular, if you compile a program with SXEmacs 22, the compiled code may not run in earlier versions of XEmacs. Also byte-compiled code is not interchangable with different flavours of Emacs, that is byte compiled code from SXEmacs may not run in FSF Emacs and vice versa.

The first time a compiled-function object is executed, the byte-code instructions are validated and the byte-code is further optimized. An invalid-byte-code error is signaled if the byte-code is invalid, for example if it contains invalid opcodes. This usually means a bug in the byte compiler.

See Compilation Errors, for how to investigate errors occurring in byte compilation.

Next: , Previous: , Up: Top   [Contents][Index]