guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scm_remember


From: Dirk Herrmann
Subject: scm_remember
Date: Wed, 1 Nov 2000 10:26:52 +0100 (MET)

Hello!

The function scm_remember has the purpose, to protect its argument from
gc:

  chars = SCM_STRING_CHARS (str);
  some_syscall (chars);
  scm_remember (&str);

The call to scm_remember forces the compiler to keep the value str
alive until after the call to some_syscall.  Currently, scm_remember
expects a scm* as its parameter.  However, for the sake of keeping the
value alive it would suffice to pass the SCM value:

  chars = SCM_STRING_CHARS (str);
  some_syscall (chars);
  scm_remember (str);

The protection is the same, but this solution does not require the
compiler to actually store the SCM value in memory - it is also legal to
keep it in a register.  Thus, I suggest to either change the signature of
scm_remember to only take a SCM parameter, or to add a new function for
that purpose and deprecate scm_remember at the same time.

Best regards
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]