Diff of /src/code/gc.lisp [0ace89] .. [5d4902] Maximize Restore

  Switch to side-by-side view

--- a/src/code/gc.lisp
+++ b/src/code/gc.lisp
@@ -49,17 +49,6 @@
   (- (* sb!vm::*read-only-space-free-pointer* sb!vm:n-word-bytes)
      sb!vm:read-only-space-start))
 
-(defun control-stack-usage ()
-  #!-stack-grows-downward-not-upward
-  (- (sb!sys:sap-int (sb!c::control-stack-pointer-sap))
-     sb!vm:control-stack-start)
-  #!+stack-grows-downward-not-upward
-  (- sb!vm:control-stack-end
-     (sb!sys:sap-int (sb!c::control-stack-pointer-sap))))
-
-(defun binding-stack-usage ()
-  (- (sb!sys:sap-int (sb!c::binding-stack-pointer-sap))
-     sb!vm:binding-stack-start))
 
 ;;;; ROOM
 
@@ -67,8 +56,8 @@
   (format t "Dynamic space usage is:   ~10:D bytes.~%" (dynamic-usage))
   (format t "Read-only space usage is: ~10:D bytes.~%" (read-only-space-usage))
   (format t "Static space usage is:    ~10:D bytes.~%" (static-space-usage))
-  (format t "Control stack usage is:   ~10:D bytes.~%" (control-stack-usage))
-  (format t "Binding stack usage is:   ~10:D bytes.~%" (binding-stack-usage))
+  (format t "Dunno Control stack usage~%")
+  (format t "Dunno Binding stack usage~%")
   (format t "Garbage collection is currently ~:[enabled~;DISABLED~].~%"
 	  *gc-inhibit*))
 
@@ -280,10 +269,17 @@
 
 (sb!alien:define-alien-routine clear-auto-gc-trigger sb!alien:void)
 
+(def-c-var-frob gc-thread-pid "gc_thread_pid")
+
+(defun other-thread-collect-garbage (gen)
+  (setf (sb!alien:extern-alien "maybe_gc_pending" (sb!alien:unsigned 32))
+	(1+ gen))
+  (sb!unix:unix-kill (gc-thread-pid) :SIGALRM))
+
 ;;; This variable contains the function that does the real GC. This is
 ;;; for low-level GC experimentation. Do not touch it if you do not
 ;;; know what you are doing.
-(defvar *internal-gc* #'collect-garbage)
+(defvar *internal-gc* #'other-thread-collect-garbage)
 
 ;;;; SUB-GC
 
@@ -300,6 +296,13 @@
 ;;; is not greater than *GC-TRIGGER*.
 ;;;
 ;;; For GENCGC all generations < GEN will be GC'ed.
+
+;;; XXX need (1) some kind of locking to ensure that only one thread
+;;; at a time is trying to GC, (2) to look at all these specials and
+;;; work out how much of this "do we really need to GC now?" crap is
+;;; actually necessary: I think we actually end up GCing every time we
+;;; hit this code
+
 (defun sub-gc (&key force-p (gen 0))
   (/show0 "entering SUB-GC")
   (unless *already-maybe-gcing*