caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Raoul Duke <raould@gmail.com>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Native compiler for oCaml on System Z
Date: Sat, 11 Jul 2015 07:15:24 +0900	[thread overview]
Message-ID: <CAPFanBEAN6BA2PhMJ00ybUZVHisu4aLHOwfqmrcH26oBsYW28g@mail.gmail.com> (raw)
In-Reply-To: <CAJ7XQb5fFrAo1J7Notdxi0J-4nsCYVPhbSajPjP6rLMek2M7ZQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

There were in fact at least two serious attempts at a LLVM port:
- one by Colin Benner,
  https://github.com/colinbenner/ocamlllvm
  http://oud.ocaml.org/2012/abstracts/oud2012-paper7.pdf
  (the paper above briefly discusses GC issues)
- one by Raphaël Amiard,
  https://github.com/raph-amiard/CamllVM
  https://www.irill.org/blog/camllvm-a-llvm-based-runtime-for-ocaml
  (in the spirit of University Pierre et Marie Curie, this compiler goes
from
   OCaml bytecode to LLVM programs, instead of being a harder-to-deploy
   native-code compiler backend)

Both cited the GC interface and the slowness of exceptions (relative to the
exceptionnally fast OCaml runtime exception handling on which many programs
rely). These difficulties had been correctly foreplanned by Xavier Leroy in
his 2009 caml-list message

http://caml.inria.fr/pub/ml-archives/caml-list/2009/03/3a77bfcca0f90b763d127d1581d6a2f1.en.html

There has been recent developments on the GC support front in the LLVM
community, notably the work of Philip Reames on "statepoints" as an
alternative approach to GC support (that should support eg. passing roots
in registers):
http://www.philipreames.com/Blog/2014/10/21/statepoints-vs-gcroot-for-representing-call-safepoints/

Regarding exceptions, I would guess a necessary evil would be to do more
static analyses inside the OCaml backend to detect when exception usage can
be refined to less generic constructs (eg. the experiments of Alain Frisch
on "static raise": https://www.lexifi.com/blog/static-exceptions ).
Degraded exceptions are also a source of performance issues on other
backends such as js_of_ocaml.


On Sat, Jul 11, 2015 at 2:47 AM, Raoul Duke <raould@gmail.com> wrote:

> > Targeting LLVM or GCCJIT is an interesting but separate project.
> > At least one attempt were made in the past to target LLVM, running into
> > problems with the (exact) GC interface of OCaml.  Maybe LLVM improved
> > recently in this department, and maybe GCCJIT can handle it too.  If
> > not, I think it's a dead end.
>
>
> For posterity, and for the sake of curiosity, might someone in the
> know succinctly explain what the (exact) GC interface road blocks
> were? Thank you!
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 3874 bytes --]

  reply	other threads:[~2015-07-10 22:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 20:35 Bull Durham
2015-07-09 21:58 ` Basile Starynkevitch
     [not found]   ` <CAGyVGgNf543Jp4thTQbN5O7xvGDJphrUWY2w_G0YtAm0LTExYQ@mail.gmail.com>
2015-07-09 23:03     ` Basile Starynkevitch
2015-07-10 17:39   ` Xavier Leroy
2015-07-10 17:47     ` Raoul Duke
2015-07-10 22:15       ` Gabriel Scherer [this message]
2015-07-10 15:30 ` Mark Shinwell
2015-07-14 13:39 ` Richard W.M. Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPFanBEAN6BA2PhMJ00ybUZVHisu4aLHOwfqmrcH26oBsYW28g@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=raould@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).