<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: rgb(255, 255, 255)">
<span style="margin: 0px">Hello,</span><br>
</div>
<div style="margin: 0px; font-size: 15px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif; color: rgb(32, 31, 30); background-color: rgb(255, 255, 255)">
<div style="margin: 0px">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
I want to introduce the STG backend I am currently working on:</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
<a href="https://github.com/jfaure/lfvm-stg" target="_blank" rel="noopener noreferrer" style="margin: 0px">https://github.com/jfaure/lfvm-stg</a></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
I'd love to see how much interest there is for this, to receive any comments, and find out if I've missed anything !</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
The goal is to massively speed up compilation times and generate faster and clearer code, and in that respect I am already quite successful. Llvm is very well suited for encoding a (lazy) functional language, however t<span style="margin: 0px; background-color: white">he
evaluation mechanism is</span><span> </span>very different to ghc's stg, there is notably no continuation passing nor result registers. In LFVM, all non constant let bindings are given an llvm function. I believe this approach is more natural, the llvm more
accurately reflects the source code and we get proper stack traces in a debugger.</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
Status:</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
The project is barely a month old, and I'm working to support everything ghc's code generation supports.</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
The STG is heavily based on the one found in ghc and, at this time and as far as I can tell, supports<span style="margin: 0px"> everything except multithreading, a gc and lazy evaluation. The current idea I think is very promising is to use an inferred pi calculus
to elegantly implement all 3 missing parts at once.</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
Pi calculus [1] (process calculus) In the STG</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black">
<ul>
<li>Multithreading occurs for arguments of functions with >1 arity</li><li>Perfect garbage collection is quite probably possible<span style="margin: 0px; background-color: white"><span style="margin: 0px"> </span>[2]</span>, where allocation creates a new pi name, and its uses are modeled by pi calculus communication</li><li>Perfect Lazy evaluation (in the sense that the wrapper and associated wrapped type overhead is coerced away after the first evaluation) is possible in the pi calculus and closely linked the gc model. I intend to make strict evaluation the default, If you
want lazy (for MonadFix or infinite lists or whatever), you must request it.</li></ul>
<div style="margin: 0px">[1]: <a href="https://en.wikipedia.org/wiki/%CE%A0-calculus" target="_blank" rel="noopener noreferrer" style="margin: 0px">https://en.wikipedia.org/wiki/%CE%A0-calculus</a></div>
</div>
<div style="margin: 0px">[2]: <a href="https://www.researchgate.net/publication/228514964_Resources_garbage-collection_and_the_pi-calculus" target="_blank" rel="noopener noreferrer" style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: left; background-color: white">https://www.researchgate.net/publication/228514964_Resources_garbage-collection_and_the_pi-calculus</a><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">James Faure (Discord: J4#0303)</span></div>
</div>
</div>
<br>
</div>
</body>
</html>