emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation to native


From: Matthew Mundell
Subject: Re: Compilation to native
Date: 20 Mar 2004 21:52:51 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Matthew Mundell <address@hidden> writes:

> >From etc/TODO:
>
>     * Investigate using GNU Lightning or similar system for incremental
>       compilation of selected bytecode functions to subrs.  Converting CCL
>       programs to native code is probably the first thing to try, though.
>
> Is there any work towards this?

Well, I have a start at generating native code from byte code at run
time, and invoking the code produced.  It uses the GNU Lightning
macros.  The generation is done in a modified copy of Fbyte_code,
called Fnative_compile_byte_code, by generating the code for each byte
code operation instead of performing the operation.

Enough is implemented to run the example function from the "Speed of
Byte-Code" node in the Elisp manual.  The function is:

(defun silly-loop (n)
  "Return time before and after N iterations of a loop."
  (let ((t1 (current-time-string)))
    (while (> (setq n (1- n))
                          0))
        (list t1 (current-time-string))))

Here is a set of results:

(silly-loop 100000000)
=> ("Sat Feb 28 10:04:39 2004" "Sat Feb 28 10:05:30 2004")     ; 51 secs

(byte-compile 'silly-loop)
(silly-loop 100000000)
=> ("Sat Feb 28 10:06:37 2004" "Sat Feb 28 10:06:53 2004")     ; 16 secs

(native-compile 'silly-loop)
(silly-loop 100000000)
=> ("Sat Feb 28 10:17:13 2004" "Sat Feb 28 10:17:22 2004")     ; 9 secs


The changes come to more than 25000 characters, so they're here:
    http://www.mundell.ukfsn.org/native/bytecode.c.diff
    http://www.mundell.ukfsn.org/native/eval.c.diff
    http://www.mundell.ukfsn.org/native/lisp.h.diff
Alternatively, the full files are available:
    http://www.mundell.ukfsn.org/native/bytecode.c
    http://www.mundell.ukfsn.org/native/eval.c
    http://www.mundell.ukfsn.org/native/lisp.h
Either way, this file is also required:
    http://www.mundell.ukfsn.org/native/native.el

The changes require NO_UNION_TYPE to be set, USE_LSB_TAG to be clear,
and EMACS_INT to be an int.  For now a fixed amount of memory is
allocated for the generated code.


Is this effort good enough to continue?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]