all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dan.colascione@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: /srv/bzr/emacs/trunk r103781: * src/bytecode.c (Fbyte_code): CAR and CDR can GC.
Date: Wed, 30 Mar 2011 12:41:56 -0700	[thread overview]
Message-ID: <4D938784.2000701@gmail.com> (raw)
In-Reply-To: <E1Q4zyk-0006Tl-UI@colonialone.fsf.org>

On 3/30/2011 11:04 AM, Stefan Monnier wrote:
> ------------------------------------------------------------
> revno: 103781
> committer: Stefan Monnier<monnier@iro.umontreal.ca>
> branch nick: trunk
> timestamp: Wed 2011-03-30 14:04:11 -0400
> message:
>    * src/bytecode.c (Fbyte_code): CAR and CDR can GC.


Wait, what?  How?  wrong_type_argument never returns.  If we run into a 
problem, we'll throw up to some higher context and never hit the 
AFTER_POTENTIAL_GC case. BEFORE_POTENTIAL_GC (if it's not a noop) sets 
the stack top field to point to the top of the stack, but because we 
never return from wrong_type_argument, we don't care whether the stack 
is lost.  v1 might be on the stack, so the only thing keeping it alive 
might be stack.top.

Now, Fsignal *does* run signal-hook-function, which of course might GC. 
  But that's done using call2, which will keep error_symbol and data 
alive even if we do GC, so a GC in this case shouldn't actually cause 
any problems.  Likewise for the debugging hooks.  So GC shouldn't 
actually cause a problem, IIUC.

What am I missing?

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog	2011-03-30 13:35:37 +0000
+++ b/src/ChangeLog	2011-03-30 18:04:11 +0000
@@ -1,3 +1,7 @@
+2011-03-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* bytecode.c (Fbyte_code): CAR and CDR can GC.
+
  2011-03-30  Zachary Kanfer  <zkanfer@gmail.com>  (tiny change)

  	* keyboard.c (Fexecute_extended_command): Do log the "suggest key

=== modified file 'src/bytecode.c'
--- a/src/bytecode.c	2011-03-17 02:18:00 +0000
+++ b/src/bytecode.c	2011-03-30 18:04:11 +0000
@@ -554,7 +554,16 @@
  	  {
  	    Lisp_Object v1;
  	    v1 = TOP;
-	    TOP = CAR (v1);
+	    if (CONSP (v1))
+	      TOP = XCAR (v1);
+	    else if (NILP (v1))
+	      TOP = Qnil;
+	    else
+	      {
+		BEFORE_POTENTIAL_GC ();
+		wrong_type_argument (Qlistp, v1);
+		AFTER_POTENTIAL_GC ();
+	      }
  	    break;
  	  }

@@ -580,7 +589,17 @@
  	  {
  	    Lisp_Object v1;
  	    v1 = TOP;
-	    TOP = CDR (v1);
+	    if (CONSP (v1))
+	      TOP = XCDR (v1);
+	    else if (NILP (v1))
+	      TOP = Qnil;
+	    else
+	      {
+		BEFORE_POTENTIAL_GC ();
+		wrong_type_argument (Qlistp, v1);
+		AFTER_POTENTIAL_GC ();
+	      }
+	    break;
  	    break;
  	  }

@@ -911,13 +930,13 @@
  	    v1 = POP;
  	    v2 = TOP;
  	    CHECK_NUMBER (v2);
-	    AFTER_POTENTIAL_GC ();
  	    op = XINT (v2);
  	    immediate_quit = 1;
  	    while (--op >= 0 && CONSP (v1))
  	      v1 = XCDR (v1);
  	    immediate_quit = 0;
  	    TOP = CAR (v1);
+	    AFTER_POTENTIAL_GC ();
  	    break;
  	  }




       reply	other threads:[~2011-03-30 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Q4zyk-0006Tl-UI@colonialone.fsf.org>
2011-03-30 19:41 ` Daniel Colascione [this message]
2011-03-30 21:49   ` /srv/bzr/emacs/trunk r103781: * src/bytecode.c (Fbyte_code): CAR and CDR can GC Stefan Monnier

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D938784.2000701@gmail.com \
    --to=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.