changeset 28497:334ebb7a551c

(Fbyte_code): Add a bunch of BEFORE_POTENTIAL_GC/ AFTER_POTENTIAL_GC calls around calls to functions that can signal an error and thus invoke the debugger.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 04 Apr 2000 14:54:29 +0000
parents 92a9591b21a2
children 809168962c9b
files src/bytecode.c
diffstat 1 files changed, 120 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/bytecode.c	Mon Apr 03 21:21:42 2000 +0000
+++ b/src/bytecode.c	Tue Apr 04 14:54:29 2000 +0000
@@ -475,10 +475,18 @@
 	      {
 		v2 = XSYMBOL (v1)->value;
 		if (MISCP (v2) || EQ (v2, Qunbound))
-		  v2 = Fsymbol_value (v1);
+		  {
+		    BEFORE_POTENTIAL_GC ();
+		    v2 = Fsymbol_value (v1);
+		    AFTER_POTENTIAL_GC ();
+		  }
 	      }
 	    else
-	      v2 = Fsymbol_value (v1);
+	      {
+		BEFORE_POTENTIAL_GC ();
+		v2 = Fsymbol_value (v1);
+		AFTER_POTENTIAL_GC ();
+	      }
 	    PUSH (v2);
 	    break;
 	  }
@@ -522,8 +530,10 @@
 	case Bmemq:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fmemq (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -564,7 +574,7 @@
 	    Lisp_Object sym, val;
 	      
 	    sym = vectorp[op];
-	    val = POP;
+	    val = TOP;
 
 	    /* Inline the most common case.  */
 	    if (SYMBOLP (sym)
@@ -581,8 +591,13 @@
 		     && !EQ (val, sym)))
 	      XSYMBOL (sym)->value = val;
 	    else
-	      set_internal (sym, val, current_buffer, 0);
+	      {
+		BEFORE_POTENTIAL_GC ();
+		set_internal (sym, val, current_buffer, 0);
+		AFTER_POTENTIAL_GC ();
+	      }
 	  }
+	  POP;
 	  break;
 
 	case Bdup:
@@ -809,8 +824,8 @@
 	case Bcatch:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = internal_catch (TOP, Feval, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -842,8 +857,8 @@
 	case Btemp_output_buffer_show:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    temp_output_buffer_show (TOP);
 	    TOP = v1;
 	    /* pop binding of standard-output */
@@ -855,9 +870,9 @@
 	case Bnth:
 	  {
 	    Lisp_Object v1, v2;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    v2 = TOP;
-	    BEFORE_POTENTIAL_GC ();
 	    CHECK_NUMBER (v2, 0);
 	    AFTER_POTENTIAL_GC ();
 	    op = XINT (v2);
@@ -947,86 +962,110 @@
 	  break;
 
 	case Blength:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Flength (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Baref:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Faref (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Baset:
 	  {
 	    Lisp_Object v1, v2;
+	    BEFORE_POTENTIAL_GC ();
 	    v2 = POP; v1 = POP;
 	    TOP = Faset (TOP, v1, v2);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bsymbol_value:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fsymbol_value (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bsymbol_function:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fsymbol_function (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bset:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fset (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bfset:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Ffset (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bget:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fget (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bsubstring:
 	  {
 	    Lisp_Object v1, v2;
+	    BEFORE_POTENTIAL_GC ();
 	    v2 = POP; v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fsubstring (TOP, v1, v2);
 	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bconcat2:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fconcat (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bconcat3:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (2);
 	  TOP = Fconcat (3, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bconcat4:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (3);
 	  TOP = Fconcat (4, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case BconcatN:
 	  op = FETCH;
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (op - 1);
 	  TOP = Fconcat (op, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bsub1:
@@ -1053,15 +1092,19 @@
 		TOP = v1;
 	      }
 	    else
-	      TOP = Fadd1 (v1);
+	      {
+		BEFORE_POTENTIAL_GC ();
+		TOP = Fadd1 (v1);
+		AFTER_POTENTIAL_GC ();
+	      }
 	    break;
 	  }
 
 	case Beqlsign:
 	  {
 	    Lisp_Object v1, v2;
+	    BEFORE_POTENTIAL_GC ();
 	    v2 = POP; v1 = TOP;
-	    BEFORE_POTENTIAL_GC ();
 	    CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1, 0);
 	    CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2, 0);
 	    AFTER_POTENTIAL_GC ();
@@ -1081,24 +1124,30 @@
 	case Bgtr:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fgtr (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Blss:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Flss (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bleq:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fleq (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -1111,8 +1160,10 @@
 	  }
 
 	case Bdiff:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fminus (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bnegate:
@@ -1125,40 +1176,56 @@
 		TOP = v1;
 	      }
 	    else
-	      TOP = Fminus (1, &TOP);
+	      {
+		BEFORE_POTENTIAL_GC ();
+		TOP = Fminus (1, &TOP);
+		AFTER_POTENTIAL_GC ();
+	      }
 	    break;
 	  }
 
 	case Bplus:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fplus (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bmax:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fmax (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bmin:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fmin (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bmult:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Ftimes (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bquo:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fquo (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Brem:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Frem (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -1207,13 +1274,17 @@
 	  }
 
 	case Bchar_after:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fchar_after (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bfollowing_char:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = Ffollowing_char ();
+	    AFTER_POTENTIAL_GC ();
 	    PUSH (v1);
 	    break;
 	  }
@@ -1221,7 +1292,9 @@
 	case Bpreceding_char:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = Fprevious_char ();
+	    AFTER_POTENTIAL_GC ();
 	    PUSH (v1);
 	    break;
 	  }
@@ -1285,8 +1358,8 @@
 	case Bskip_chars_forward:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fskip_chars_forward (TOP, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -1295,8 +1368,8 @@
 	case Bskip_chars_backward:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fskip_chars_backward (TOP, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -1318,8 +1391,8 @@
 	case Bbuffer_substring:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fbuffer_substring (TOP, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -1328,8 +1401,8 @@
 	case Bdelete_region:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fdelete_region (TOP, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -1338,8 +1411,8 @@
 	case Bnarrow_to_region:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
-	    BEFORE_POTENTIAL_GC ();
 	    TOP = Fnarrow_to_region (TOP, v1);
 	    AFTER_POTENTIAL_GC ();
 	    break;
@@ -1360,41 +1433,55 @@
 	case Bset_marker:
 	  {
 	    Lisp_Object v1, v2;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    v2 = POP;
 	    TOP = Fset_marker (TOP, v2, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bmatch_beginning:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fmatch_beginning (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bmatch_end:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fmatch_end (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bupcase:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fupcase (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bdowncase:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fdowncase (TOP);
+	  AFTER_POTENTIAL_GC ();
 	break;
 
 	case Bstringeqlsign:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fstring_equal (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bstringlss:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fstring_lessp (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -1409,8 +1496,10 @@
 	case Bnthcdr:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fnthcdr (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -1420,9 +1509,9 @@
 	    if (CONSP (TOP))
 	      {
 		/* Exchange args and then do nth.  */
+		BEFORE_POTENTIAL_GC ();
 		v2 = POP;
 		v1 = TOP;
-		BEFORE_POTENTIAL_GC ();
 		CHECK_NUMBER (v2, 0);
 		AFTER_POTENTIAL_GC ();
 		op = XINT (v2);
@@ -1455,8 +1544,10 @@
 	      }
 	    else
 	      {
+		BEFORE_POTENTIAL_GC ();
 		v1 = POP;
 		TOP = Felt (TOP, v1);
+		AFTER_POTENTIAL_GC ();
 	      }
 	    break;
 	  }
@@ -1464,36 +1555,46 @@
 	case Bmember:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fmember (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bassq:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fassq (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bnreverse:
+	  BEFORE_POTENTIAL_GC ();
 	  TOP = Fnreverse (TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bsetcar:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fsetcar (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
 	case Bsetcdr:
 	  {
 	    Lisp_Object v1;
+	    BEFORE_POTENTIAL_GC ();
 	    v1 = POP;
 	    TOP = Fsetcdr (TOP, v1);
+	    AFTER_POTENTIAL_GC ();
 	    break;
 	  }
 
@@ -1520,8 +1621,10 @@
 	  }
 
 	case Bnconc:
+	  BEFORE_POTENTIAL_GC ();
 	  DISCARD (1);
 	  TOP = Fnconc (2, &TOP);
+	  AFTER_POTENTIAL_GC ();
 	  break;
 
 	case Bnumberp: