Lisp compilation principles and SBCL internals

Semion Prihodko <[email protected]> Wed, 18 Aug 2010 15:50:42 +0300
Newsgroups gmane.lisp.movitz.devel
Message-ID <[email protected]>
--===============1228891652==
Content-Type: multipart/alternative; boundary=0016e6d9780171d947048e188323

--0016e6d9780171d947048e188323
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi guys,

I'm a developer who likes to learn more about SBCL runtime internals.
Being on very early stages of new OS development I need to understand is
it worthy to build OS on top of lispy runtime. I see lisp-like language
as a main system language (like C language in Unix-like systems), so I
need to know if replacing ordinal stack / register virtual machine (I
prefer a managed environment) by a lisp runtime virtual machine will
make programs run more efficient?


I will describe my view. Let's imagine lisp runtime operating with
machine size numbers (arbitrary size numbers are on a layer above),
explicitly supporting arrays, different VOPs, etc. On the layer above
there is a main lispy language compiler. The question is the following:
will the lisp runtime playing the part of a virtual machine be worth to
base on (supposing that main language compiler will be able to pass
intermediate code to it more preserving original semantics for
optimization purposes compared to ordinal stack / register virtual
machine)?


My substantial lack of knowledge about modern lisp compilation forces me
to ask another, maybe stupid question. Is the lisp compilers at general
embed a minimal interpreter to compiled code? I mean, when I define a
function with some work flow (conditions, recursion, etc) is it
interpreted on the low level (of course, with some VOP blocks of machine
code inlined and some optimization transformations applied)? Under
interpretation I understand the process that flow in lisp processors
(chips), well described in the following white paper: =93Design of
LISP-Based Processors or, SCHEME: A Dielectric LISP or, Finit Memories
Considered Harmful or, LAMBDA: Ultimate Opcode=94 by Guy Lewis Steele Jr.
and Gerald Jay Sussman.

Thanks in advance.

--0016e6d9780171d947048e188323
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi guys,<div><br></div><div><span class=3D"Apple-style-span" style=3D"font-=
family: &#39;Times New Roman&#39;; font-size: 14px; "><span class=3D"Apple-=
style-span" style=3D"border-collapse: collapse; font-family: arial, sans-se=
rif; font-size: 13px; ">I&#39;m a developer who likes to learn more about S=
BCL runtime internals.</span><span class=3D"Apple-style-span" style=3D"bord=
er-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><=
br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">Being on very early sta=
ges of new OS development I need to understand is</span><span class=3D"Appl=
e-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-=
serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">it worthy to build OS o=
n top of lispy runtime. I see lisp-like language</span><span class=3D"Apple=
-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-s=
erif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">as a main system langua=
ge (like C language in Unix-like systems), so I</span><span class=3D"Apple-=
style-span" style=3D"border-collapse: collapse; font-family: arial, sans-se=
rif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">need to know if replaci=
ng ordinal stack / register virtual machine (I</span><span class=3D"Apple-s=
tyle-span" style=3D"border-collapse: collapse; font-family: arial, sans-ser=
if; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">prefer a managed enviro=
nment) by a lisp runtime virtual machine will</span><span class=3D"Apple-st=
yle-span" style=3D"border-collapse: collapse; font-family: arial, sans-seri=
f; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">make programs run more =
efficient?</span><span class=3D"Apple-style-span" style=3D"border-collapse:=
 collapse; font-family: arial, sans-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; "><br></span><span class=
=3D"Apple-style-span" style=3D"border-collapse: collapse; font-family: aria=
l, sans-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">I will describe my view=
. Let&#39;s imagine lisp runtime operating with</span><span class=3D"Apple-=
style-span" style=3D"border-collapse: collapse; font-family: arial, sans-se=
rif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">machine size numbers (a=
rbitrary size numbers are on a layer above),</span><span class=3D"Apple-sty=
le-span" style=3D"border-collapse: collapse; font-family: arial, sans-serif=
; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">explicitly supporting a=
rrays, different VOPs, etc. On the layer above</span><span class=3D"Apple-s=
tyle-span" style=3D"border-collapse: collapse; font-family: arial, sans-ser=
if; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">there is a main lispy l=
anguage compiler. The question is the following:</span><span class=3D"Apple=
-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-s=
erif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">will the lisp runtime p=
laying the part of a virtual machine be worth to</span><span class=3D"Apple=
-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-s=
erif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">base on (supposing that=
 main language compiler will be able to pass</span><span class=3D"Apple-sty=
le-span" style=3D"border-collapse: collapse; font-family: arial, sans-serif=
; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">intermediate code to it=
 more preserving original semantics for</span><span class=3D"Apple-style-sp=
an" style=3D"border-collapse: collapse; font-family: arial, sans-serif; fon=
t-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">optimization purposes c=
ompared to ordinal stack / register virtual</span><span class=3D"Apple-styl=
e-span" style=3D"border-collapse: collapse; font-family: arial, sans-serif;=
 font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">machine)?</span><span c=
lass=3D"Apple-style-span" style=3D"border-collapse: collapse; font-family: =
arial, sans-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; "><br></span><span class=
=3D"Apple-style-span" style=3D"border-collapse: collapse; font-family: aria=
l, sans-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">My substantial lack of =
knowledge about modern lisp compilation forces me</span><span class=3D"Appl=
e-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-=
serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">to ask another, maybe s=
tupid question. Is the lisp compilers at general</span><span class=3D"Apple=
-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-s=
erif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">embed a minimal interpr=
eter to compiled code? I mean, when I define a</span><span class=3D"Apple-s=
tyle-span" style=3D"border-collapse: collapse; font-family: arial, sans-ser=
if; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">function with some work=
 flow (conditions, recursion, etc) is it</span><span class=3D"Apple-style-s=
pan" style=3D"border-collapse: collapse; font-family: arial, sans-serif; fo=
nt-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">interpreted on the low =
level (of course, with some VOP blocks of machine</span><span class=3D"Appl=
e-style-span" style=3D"border-collapse: collapse; font-family: arial, sans-=
serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">code inlined and some o=
ptimization transformations applied)? Under</span><span class=3D"Apple-styl=
e-span" style=3D"border-collapse: collapse; font-family: arial, sans-serif;=
 font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">interpretation I unders=
tand the process that flow in lisp processors</span><span class=3D"Apple-st=
yle-span" style=3D"border-collapse: collapse; font-family: arial, sans-seri=
f; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">(chips), well described=
 in the following white paper: =93Design of</span><span class=3D"Apple-styl=
e-span" style=3D"border-collapse: collapse; font-family: arial, sans-serif;=
 font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">LISP-Based Processors o=
r, SCHEME: A Dielectric LISP or, Finit Memories</span><span class=3D"Apple-=
style-span" style=3D"border-collapse: collapse; font-family: arial, sans-se=
rif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">Considered Harmful or, =
LAMBDA: Ultimate Opcode=94 by Guy Lewis Steele Jr.</span><span class=3D"App=
le-style-span" style=3D"border-collapse: collapse; font-family: arial, sans=
-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">and Gerald Jay Sussman.=
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; "></span><span class=3D"A=
pple-style-span" style=3D"border-collapse: collapse; font-family: arial, sa=
ns-serif; font-size: 13px; "><br>
</span><span class=3D"Apple-style-span" style=3D"border-collapse: collapse;=
 font-family: arial, sans-serif; font-size: 13px; ">Thanks in advance.</spa=
n></span></div>

--0016e6d9780171d947048e188323--


--===============1228891652==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline