changeset 1758:90502933fb98

[xemacs-hg @ 2003-10-21 08:21:00 by stephent] revert "fix space leak" patch <87oewb0zqn.fsf_-_@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 21 Oct 2003 08:21:08 +0000
parents d7a328610d7d
children a14f3af8e6fb
files src/ChangeLog src/bytecode.c tests/ChangeLog tests/automated/test-harness.el tests/automated/weak-tests.el
diffstat 5 files changed, 39 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Oct 19 03:18:15 2003 +0000
+++ b/src/ChangeLog	Tue Oct 21 08:21:08 2003 +0000
@@ -1,3 +1,8 @@
+2003-10-21  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* bytecode.c (execute_optimized_program):
+	Revert Mike's patch temporarily.
+
 2003-10-11  Olivier Galibert  <galibert@pobox.com>
 
 	* window.c (Fdelete_window): Dirty the mirror structure _before_
--- a/src/bytecode.c	Sun Oct 19 03:18:15 2003 +0000
+++ b/src/bytecode.c	Tue Oct 21 08:21:08 2003 +0000
@@ -447,8 +447,6 @@
    but don't pop it. */
 #define TOP (*stack_ptr)
 
-#define GCPRO_STACK  (gcpro1.nvars = stack_ptr - stack_beg)
-
 /* The actual interpreter for byte code.
    This function has been seriously optimized for performance.
    Don't change the constructs unless you are willing to do
@@ -462,8 +460,8 @@
 {
   /* This function can GC */
   REGISTER const Opbyte *program_ptr = (Opbyte *) program;
-  Lisp_Object *stack_beg = alloca_array (Lisp_Object, stack_depth + 1);
-  REGISTER Lisp_Object *stack_ptr = stack_beg;
+  REGISTER Lisp_Object *stack_ptr
+    = alloca_array (Lisp_Object, stack_depth + 1);
   int speccount = specpdl_depth ();
   struct gcpro gcpro1;
 
@@ -473,11 +471,23 @@
 #endif
 
 #ifdef ERROR_CHECK_BYTE_CODE
+  Lisp_Object *stack_beg = stack_ptr;
   Lisp_Object *stack_end = stack_beg + stack_depth;
 #endif
 
+  /* Initialize all the objects on the stack to Qnil,
+     so we can GCPRO the whole stack.
+     The first element of the stack is actually a dummy. */
+  {
+    int i;
+    Lisp_Object *p;
+    for (i = stack_depth, p = stack_ptr; i--;)
+      *++p = Qnil;
+  }
+
   GCPRO1 (stack_ptr[1]);
-  
+  gcpro1.nvars = stack_depth;
+
   while (1)
     {
       REGISTER Opcode opcode = (Opcode) READ_UINT_1;
@@ -502,10 +512,7 @@
 	  if (opcode >= Bconstant)
 	    PUSH (constants_data[opcode - Bconstant]);
 	  else
-	    {
-	      GCPRO_STACK;
-	      stack_ptr = execute_rare_opcode (stack_ptr, program_ptr, opcode);
-	    }
+	    stack_ptr = execute_rare_opcode (stack_ptr, program_ptr, opcode);
 	  break;
 
 	case Bvarref:
@@ -590,7 +597,6 @@
 	case Bcall+7:
 	  n = (opcode <  Bcall+6 ? opcode - Bcall :
 	       opcode == Bcall+6 ? READ_UINT_1 : READ_UINT_2);
-	  GCPRO_STACK;
 	  DISCARD (n);
 #ifdef BYTE_CODE_METER
 	  if (byte_metering_on && SYMBOLP (TOP))
--- a/tests/ChangeLog	Sun Oct 19 03:18:15 2003 +0000
+++ b/tests/ChangeLog	Tue Oct 21 08:21:08 2003 +0000
@@ -1,3 +1,11 @@
+2003-10-21  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* automated/test-harness.el (test-harness-test-compiled): 
+	New variable to notify tests whether they are compiled or interpreted.
+	
+	* automated/weak-tests.el (test-harness-test-compiled):
+	Temporary hack to remind me of the reverted byte-interpreter patch.
+
 2003-10-15  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* automated/test-harness.el: Whitespace/readability tweaks.
--- a/tests/automated/test-harness.el	Sun Oct 19 03:18:15 2003 +0000
+++ b/tests/automated/test-harness.el	Tue Oct 21 08:21:08 2003 +0000
@@ -44,6 +44,9 @@
 
 (require 'bytecomp)
 
+(defvar test-harness-test-compiled nil
+  "Non-nil means the test code was compiled before execution.")
+
 (defvar test-harness-verbose
   (and (not noninteractive) (> (device-baud-rate) search-slow-speed))
   "*Non-nil means print messages describing progress of emacs-tester.")
@@ -316,7 +319,8 @@
 	 (message "Test suite execution aborted." error-info)
 	 ))
       (princ "\nTesting Compiled Lisp\n\n")
-      (let (code)
+      (let (code
+	    (test-harness-test-compiled t))
 	(condition-case error-info
 	    (setq code
 		  ;; our lisp code is often intentionally dubious,
--- a/tests/automated/weak-tests.el	Sun Oct 19 03:18:15 2003 +0000
+++ b/tests/automated/weak-tests.el	Tue Oct 21 08:21:08 2003 +0000
@@ -36,6 +36,11 @@
      (push (file-name-directory load-file-name) load-path)
      (require 'test-harness))))
 
+(when test-harness-test-compiled
+  ;; this ha-a-ack depends on the compiled test coming last
+  (setq test-harness-failure-tag
+	"KNOWN BUG - fix reverted; after 2003-10-31 bitch at stephen\n"))
+
 (garbage-collect)
 
 ;; tests for weak-boxes