XCL
Peter Graves, of ABCL fame, has been working on this new Common Lisp compiler for a while now. Here's how he describes it:
XCL is a new, native-code CL implementation that features a kernel written in a very restricted subset of C++ and an optimizing compiler, written in Lisp, with backends for x86 and x86-64. It runs on Linux and Windows [...]
XCL supports threads on both Linux and Windows, and in principle the compiler is re-entrant.
Recently, and this is the actual news, Peter made available a link to a source code snapshot in #lisp
. I couldn't resist trying it out, so here are some superficial first impressions:
It has an interpreter written in C++ and it uses that to bootstrap itself. This is similar to what ABCL does, though it seems that, at this point, it doesn't actually compile (all of?) its own Lisp code. Also, Peter says he's working on getting it to bootstrap SBCL.
Friendly REPL similar to Allegro's.
It features a neat, readable disassembler.
CL-USER(10): (disassemble (compile (defun inc (x) (1+ x)))) ; Compiling INC ; Disassembly of #<FUNCTION INC {F84820}> ; Constants: NIL ; Code: E1BF50: 55 push %rbp E1BF51: 48 89 E5 mov %rsp,%rbp E1BF54: 57 push %rdi E1BF55: 48 83 EC 08 sub $0x8,%rsp E1BF59: 48 89 F8 mov %rdi,%rax E1BF5C: 48 89 C7 mov %rax,%rdi E1BF5F: A8 03 test $0x3,%al E1BF61: 75 08 jne L0 E1BF63: 48 83 C0 04 add $0x4,%rax E1BF67: 70 02 jo L0 E1BF69: C9 leave E1BF6A: C3 retq L0: E1BF6B: BE 04 00 00 00 mov $0x4,%esi E1BF70: E8 AB 47 60 FF callq 0x420720 ; SYSTEM:TWO-ARG-+ E1BF75: C9 leave E1BF76: C3 retq ; 39 bytes NIL
Similarly to CLISP, its fasls are
read
able S-exps and pretty short too. They even start with-*- Mode: Lisp -*-
, heh. The actual assembly code looks something like this:(COMPILER::GENERATE-CODE-VECTOR '((:BYTE 1 85) (:BYTES 3 (72 137 229)) ... (:JMP-SHORT 2 (:NZ #$G7248)) ... (:EXIT 2 (201 195)) (:LABEL 0 (#$G7248)) (:BYTE 1 190) ...)
It managed to load ASDF—though not yet compile it—and use that to load and compile a simple system such as
split-sequence
. Given that(lisp-implementation-version)
returns"0.0.0"
, and comparing to some other lisps that crash so easily with ASDF, I find this very impressive.
Incidentally, this is my first post to Planet Lisp. Hello world! I'm sure I've screwed it up in some way or another. In case you're wondering, the rest of my blog is in Esperanto.
2 komentoj:
Saluton! Mi ĝojas tre, pro trovi kromajn lispistojn en Esperantujo. Mi estas nur eklernanto pri Scheme kaj Common Lisp kaj Elisp, sed mi jam estas "iluminita" :-)
2:341/14.79@fidonet, carleos@uica.info
Hehe, bonege. Iam ni kreos #lisp-eo ĉe freenode.net. :-D
Post a Comment