From: Andy Wingo <wingo@pobox.com>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: Native Code Again
Date: Fri, 28 Jan 2011 12:01:52 +0100 [thread overview]
Message-ID: <m3fwsdfg0v.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTik-9XS+oA0e5jP4D_5FUXbi=95LZBTm53bJstMo@mail.gmail.com> (Noah Lavine's message of "Sat, 8 Jan 2011 12:27:25 -0500")
Heya Noah,
Replying out-of-order here.
On Sat 08 Jan 2011 18:27, Noah Lavine <noah.b.lavine@gmail.com> writes:
> Therefore, I think the path to a native-code VM is to leave the VM as
> it is (except maybe reserve an opcode for native-code calls). Then I
> write first a C parser for Guile and then a converter program that
> would take Guile's current VM and output a JIT VM like I've described.
Hah, it seems we concluded on the same thing after all...
> Specifically, you could construct the VM using the JITcode generator,
> either on Guile startup or whenever the user decided to enable native
> code generation.
This is a very interesting possibility. It scares me, in its
complexity, but it does seem to handle all of the objections that I had.
> The ideal method of calling natively-generated code would be for the
> VM to tail call the JITed code, which would then tail call the VM when
> it was done. The only two ways of doing this are asking GCC to add a
> tail call intrinsic (unportable) or building a library of tail-call
> ASM for different platforms (more generally useful, but also basically
> unportable).
I actually don't think that either of these are bad ideas.
And also... why not rely on gcc's tail-call optimization, in the case
where it works? You can check for it at configure-time. I just ran
some small tests for tail-calls between functions in separate
compilation units and it shows that indeed, gcc does the right thing.
I guess that given this circumstance, things are a lot easier. The JIT
library still needs to know how to tail-call a C function, but that is
more tractable. If you don't have tail-calls, perhaps the JIT compiler
uses trampolines as you and Ludovic proposed; and that becomes a case
that only gets exercised with -O0, and possibly not even then if we add
-foptimize-sibling-calls when available.
My apologies again for going back and forth on this issue! It's
important, and there are a few options, so I guess more discussion is
better here.
Let us know your thoughts :)
Regards,
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2011-01-28 11:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-08 17:27 Native Code Again Noah Lavine
2011-01-28 11:01 ` Andy Wingo [this message]
2011-01-28 14:33 ` Noah Lavine
2011-01-28 14:55 ` Andy Wingo
2011-01-28 16:19 ` Ken Raeburn
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3fwsdfg0v.fsf@unquote.localdomain \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=noah.b.lavine@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 read-only IMAP folder(s) and NNTP newsgroup(s).