unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Noah Lavine <noah.b.lavine@gmail.com>
To: guile-devel@gnu.org
Subject: Troubles with Objcode and Storing JIT Pointers
Date: Mon, 21 Jun 2010 14:19:31 -0400	[thread overview]
Message-ID: <AANLkTilrcaEJHMP9nsZh-sTxc0fCe2CM_HVkImIL4GXx@mail.gmail.com> (raw)

Hello all,

I have hit a snag in my attempt to add a JIT backend to Guile: I don't
know where to store the JITed code.

There was a discussion of this a few weeks ago in which it was decided
to try to make a simple and quick JIT engine that would be invisible
to Scheme, hoping to eventually make a full AOT compilation engine
using GCC. I am working on this JIT engine. What I need in this is
some way to stash the JIT code I've made for a procedure in such a way
that I can get it back again if I need to run the same procedure
again.

My current attempt tries to put it in the struct scm_objcode structure
as an extra pointer, but the trouble is that scm_objcodes are made
directly from bytecode, by just casting the bytecode to a struct
scm_objcode. That by itself wouldn't be a terrible problem, because I
can rearrange things in memory behind-the-scenes to hide the extra
pointer, but objcodes can also be embedded in other objcodes. In order
to make this work correctly, I'd either have to scan every bytecode
that becomes an objcode, find any embedded objcodes, and add space for
the new pointer, or modify the bytecode compiler to leave extra room.
Of these two, I think the second option would be best because it would
be faster, but then the fact that the objcode structure has an extra
pointer is trickling up to Scheme code, and I'm not sure where the
abstraction leakage would stop. (Bytecode? Assembly code?)

I could fix this by not allowing objcode slices, and instead having
some sort of indirection, but that removes some efficiency that might
be important.

Another option is to store the JITed code with the procedure object,
but a procedure is already four machine words, and making it any
bigger could mess up the machine cache.

Can anyone suggest a solution?

Thanks
Noah



             reply	other threads:[~2010-06-21 18:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-21 18:19 Noah Lavine [this message]
2010-06-21 20:19 ` Troubles with Objcode and Storing JIT Pointers Andy Wingo
2010-06-21 22:23   ` Noah Lavine
2010-06-22 19:03     ` Andy Wingo
2010-07-03 18:28       ` Noah Lavine
2010-07-04 17:43         ` Noah Lavine
2010-07-17 11:36         ` Andy Wingo

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=AANLkTilrcaEJHMP9nsZh-sTxc0fCe2CM_HVkImIL4GXx@mail.gmail.com \
    --to=noah.b.lavine@gmail.com \
    --cc=guile-devel@gnu.org \
    /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).