From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (=?iso-8859-1?q?Ludovic_Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Custom allocation of cells Date: Tue, 03 May 2005 17:09:42 +0200 Organization: LAAS-CNRS Message-ID: <878y2wcpmx.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115228693 3471 80.91.229.2 (4 May 2005 17:44:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 May 2005 17:44:53 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed May 04 19:44:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DTNu4-000121-M7 for guile-devel@m.gmane.org; Wed, 04 May 2005 19:43:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DTO1P-0001Jr-Uy for guile-devel@m.gmane.org; Wed, 04 May 2005 13:50:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DSzIQ-00024F-HJ for guile-devel@gnu.org; Tue, 03 May 2005 11:26:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DSzIO-00023a-I4 for guile-devel@gnu.org; Tue, 03 May 2005 11:26:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSzDs-0000RD-EF for guile-devel@gnu.org; Tue, 03 May 2005 11:22:08 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DSz5I-00038m-Er for guile-devel@gnu.org; Tue, 03 May 2005 11:13:17 -0400 Original-Received: by laas.laas.fr (8.13.1/8.13.1) with SMTP id j43F89Vw016462; Tue, 3 May 2005 17:08:10 +0200 (CEST) Original-To: guile-devel@gnu.org X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 14 =?iso-8859-1?q?Flor=E9al_an_213_de_la_R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:4941 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4941 Hi, I'd like to know whether one can reliably allocate a cell on its own, without using `scm_cell ()'. Basically, I read appendix A of the manual and I'm now naively trying to do my own cell allocation. Here is a (stupid and ugly) example: SCM_DEFINE (scm_do_pair, "do-pair", 2, 0, 0, (SCM car, SCM cdr), "") { static SCM room[512]; static SCM *where = &room[0]; SCM the_pair; size_t incr; if ((scm_t_bits)where & 6) { /* Align the cell pointer so that Guile considers it as a non-immediate object (see tags.h). */ incr = (scm_t_bits)where & 6; incr = (~incr) & 7; where += incr; } where[0] = car; where[1] = cdr; the_pair = PTR2SCM (where); return (the_pair); } This does return a pair, but the next time the GC runs, Guile segfaults. This is because `SCM_SET_GC_MARK ()' assumes that WHERE is located within a cell segment, which is not the case here. So my question is: Is there a way to allocate cells, cheaper than `scm_cell ()', that could be used? This would be particularly useful for Guile-VM. When calling a procedure (i.e. with the interpreter, via `scm_apply ()'), the VM as to build a list out of the arguments which are already available on the stack, and this turns out to be pretty costly. Thanks, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel