unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Oleg Parashchenko <olpa@xmlhack.ru>
Subject: Re: scm_init_guile when null threads
Date: Sun, 2 Apr 2006 19:29:23 +0400	[thread overview]
Message-ID: <20060402192923.081189b9.olpa@xmlhack.ru> (raw)
In-Reply-To: 85D0035F-4B28-472D-A275-7BF0950B5256@raeburn.org

Hello Ken,

On Sun, 2 Apr 2006 00:50:20 -0500
Ken Raeburn <raeburn@raeburn.org> wrote:

...
> 
> You call scm_with_guile, and give it a function to call that  
> manipulates Guile objects or calls Guile functions; it causes the  
> thread to enter "guile mode", calls the function, leaves "guile mode"  
> and returns to the caller.  (You can also pass a pointer to whatever  
> associated data you want, so you don't have to make your function  
> rely on global variables.)

Thank you for explaining the interface.

> 
> Since it controls entry and exit to your function, its ability to  
> figure out where the "guile part" of the stack of that thread (needed  
> for garbage collection) starts is much greater than with  
> scm_init_guile.  If you use scm_init_guile, it needs to figure out  
> where the thread's stack's base is (yes, this may be easier on some  
> platforms when configured for null threads), because under that  
> interface, you could pop back up a few stack frames before invoking  
> some Guile routines and storing objects into stack slots.  Using  
> scm_with_guile, your automatic variables with SCM objects won't get  
> stored on the "wrong" side of the stack pointer that scm_with_guile  
> has recorded.

I have two questions about scm_with_guile related to initialization and
nesting.

I have impression that before using Guile, one has to initialize Guile
using scm_init_gsubr(), scm_init_procprop() etc, but scm_with_guile
doesn't do it. Am I wrong?

Now about nesting. Let's suppose my program switches to Guile using
scm_with_guile (stack base "A"). Guile runs, at some moments executes
an extension function, and switches back to the program. The code needs
some Guile and calls scm_with_guile again (stack base "B"). The question:
does garbage collector work correctly, not missing the Scheme values
between "A" and "B"?

> 
> Ken

-- 
Oleg Parashchenko  olpa@ http://xmlhack.ru/  XML news in Russian
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


      reply	other threads:[~2006-04-02 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-01  5:24 scm_init_guile when null threads Oleg Parashchenko
2006-04-01  9:01 ` Neil Jerram
2006-04-02  2:48   ` Oleg Parashchenko
2006-04-02  5:50     ` Ken Raeburn
2006-04-02 15:29       ` Oleg Parashchenko [this message]

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=20060402192923.081189b9.olpa@xmlhack.ru \
    --to=olpa@xmlhack.ru \
    /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).