From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Aaron Bohannon <bohannon@seas.upenn.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] native code and ZINC machine
Date: Sat, 6 Nov 2004 10:37:48 +0100 [thread overview]
Message-ID: <20041106093748.GA26835@yquem.inria.fr> (raw)
In-Reply-To: <418B8D56.5010109@seas.upenn.edu>
> I was quite surprised, recently, when I found out that the native code
> compiler implements left-to-right evaulation, as opposed to the
> right-to-left evaulation of the bytecode.
This isn't quite right. The native-code compiler is essentially
neutral w.r.t. evaluation order, meaning that it can implement any
given evaluation order without singificant changes or performance
impact. However, following the principle of least surprise, it tries
to enforce the same evaluation order as the bytecode compiler, that
is, right-to-left.
There is one mistake in 3.08 (corrected in the main branch) that causes
left-to-right evaluation for arguments to certain inlined functions
(see PR#2910). If you observe left-to-right evaluation with ocamlopt,
please report it. It's not really a bug according to the OCaml manual
(which leaves evaluation order undefined), but it's certainly a
"quality of implementation" issue that we'd like to be aware of.
> You see, I am quite familiar with the ZINC machine and the benefits of
> its design, and I thought that the design could be adapted in some way
> or another to the native code setting. I am interested in finding out
> what factors prevented this, or what made the ZINC machine execution
> model impractical in the native runtime. My knowledge of systems is
> perhaps somewhat weak, so maybe I am overlooking some obvious point.
The ZINC / OCaml VM handling of curried function application (an
instance of the push-enter model) pretty much requires that parameters
are passed on a stack. For native code generation, it is much more
efficient to pass the first N parameters in processor registers. This
doesn't fit the ZINC model at all.
- Xavier Leroy
next prev parent reply other threads:[~2004-11-06 9:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-05 14:25 Aaron Bohannon
2004-11-06 9:37 ` Xavier Leroy [this message]
2004-11-06 16:53 ` [Caml-list] " David Brown
2004-11-08 8:52 ` Diego Olivier Fernandez Pons
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=20041106093748.GA26835@yquem.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=bohannon@seas.upenn.edu \
--cc=caml-list@inria.fr \
/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