unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* A Representation for Native Code
@ 2010-12-11  0:20 Noah Lavine
  2011-01-05 21:38 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Lavine @ 2010-12-11  0:20 UTC (permalink / raw)
  To: guile-devel

Hello,

I was thinking about how to represent native code. I think I have a
solution, but I'd like to check if it's a good idea before I implement
it.

Current an objcode object has four words:
- The type tag and some flags
- a struct scm_objcode C object
- the parent of this objcode, if it is a slice, or #f if there is none
- the file descriptor of the file this was mmaped from, or 0 if it was
not mmaped

If I understand what slices are correctly, the objcode for a native
code trampoline will never be a slice, so it should be okay to take
over the third word of the objcode object for that case. I'd make a
new flag to keep track of what was happening.

Also, am I correct in assuming that we'd want to keep the old objcode
around even after we jitted something, just in case something tried to
introspect on it? I think putting it in a procedure property would
work.

Noah



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

* Re: A Representation for Native Code
  2010-12-11  0:20 A Representation for Native Code Noah Lavine
@ 2011-01-05 21:38 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2011-01-05 21:38 UTC (permalink / raw)
  To: guile-devel

Hi Noah,

Noah Lavine <noah.b.lavine@gmail.com> writes:

> Also, am I correct in assuming that we'd want to keep the old objcode
> around even after we jitted something, just in case something tried to
> introspect on it? I think putting it in a procedure property would
> work.

I think so, because there’s ‘objcode-meta’, used by ‘program-meta’,
which returns a thunk that itself returns procedure meta-data:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (use-modules (system vm program))
scheme@(guile-user)> ((program-meta 1+))
$3 = (() () ((3 7 1 0 #f)) (name . 1+))
--8<---------------cut here---------------end--------------->8---

Thanks,
Ludo’.




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

end of thread, other threads:[~2011-01-05 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-11  0:20 A Representation for Native Code Noah Lavine
2011-01-05 21:38 ` Ludovic Courtès

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