Re: GSoC compiler work, SICL
Bruno Haible <[email protected]> Wed, 21 Mar 2018 22:35:39 +0100
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <1576653.WVKhgEISBS@omega> |
Hi Charles,
> As GSoC applications have opened and the deadline for submissions is
> approaching, I'd like to reach out again to the clisp developers.
Good that you ask again. (Your first mail came in a period where
I was pretty busy, sorry about that.)
> It seems that the overall evaluation of the feasibility of adding
> native file compilation or ahead of time compilation to machine code
> is that it is way too ambitious. On the other hand, various
> self-contained bugs such as improving local inlining would not be
> enough to form a project on its own. ...
> A good compromise seems to be adding pieces of SICL to clisp, with
> Cleavir being the most useful.
I agree with these evaluations.
> * Probably the easiest piece to add are the various ANSI CL modules,
> such as sequence functions, reader, and loop, among others. Of course,
> this isn't extremely useful given that CLISP already conforms to ANSI
> CL, but there are some novel techniques that Robert Strandh has
> introduced that make it worthwhile to look into replacing some of
> clisp's implementations.
These parts of clisp (sequence functions, reader, and loop, and others)
are pretty well implemented and optimized, in my opinion. You would have
to be *very convincing* about the benefits of Robert Strandh's implementation
of these, before these get approved for addition to clisp.
The situation is different, however, regarding the compiler: clisp's
compiler does only superficial optimizations (no data flow analysis,
no inlining of local functions).
> * The most useful addition would be to add some form of compiler IR
> from SICL. Robert Strandh has told me that a simple Cleavir-based
> compiler should not be 'too much work'. My understanding is that clisp
> does not do a lot of lisp level optimization, especially type informed
> ones, so that adding the Cleavir compiler would be a huge win as it is
> being used to do all the heavy lisp side optimizations in Clasp.
I agree with all of this.
> The benefits are:
> 1. Having a compiler written in lisp for easier debugging, along with
> the general advantages of lisp.
> 2. Type inferencing
> 3. Loop optimizations
> 4. First-class environments
> 5. Other optimizations
Re 1: clisp's existing compiler is written in Lisp as well. So I don't
see this as a valid argument.
Re 2: Yes, definitely.
Re 3: clisp's LOOP has a number of optimizations already in the macro.
It is possible that cleavir adds more optimizations to it, but this would
not be the major benefit.
Re 4: clisp also has first class environments, I would say. What is the
difference with the cleavir ones?
Re 5: It's here that I see the biggest potential wins: inlining of local
functions, data-flow optimizations, and Scheme-like optimizations.
> SICL is written in such a way where pieces can be selected in a
> modular fashion, so that, for example, once the basic structures are
> in place, pieces can be incrementally added to CLISP. For the purposes
> of GSoC, this means that there would be a guaranteed deliverable, with
> the possibility of some of the above extra pieces if time permits.
This is good; however, we should still strive to define the functionality
of the deliverables. For example, pick the right ones among these:
- Make the SICL compiler core run in clisp.
- Connect it to the clisp LAP assembler as backend, so that it can be
used to create compiled clisp functions.
- Make the SICL compiler understand elements of the clisp lexical
environment (i.e. make it possible to use (declare (compile)) in a
function that is not defined at the top-level).
- Make the COMPILE function work flawlessly in all cases.
- Make the DISASSEMBLE function work flawlessly in all cases.
- Make the COMPILE-FILE function work flawlessly in all cases.
This implies proper handling of LOAD-TIME-VALUE.
> I have been able to get in touch with the SICL people, with more
> discussoin forthcoming. If there are also willing clisp developers
> available to mentor the clisp side of this project
Yes, I am willing to mentor you with this kind of project.
Sam, are you willing as well?
Bruno
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel