unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Troubles with Objcode and Storing JIT Pointers
@ 2010-06-21 18:19 Noah Lavine
  2010-06-21 20:19 ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Noah Lavine @ 2010-06-21 18:19 UTC (permalink / raw)
  To: guile-devel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-17 11:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21 18:19 Troubles with Objcode and Storing JIT Pointers Noah Lavine
2010-06-21 20:19 ` 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

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).