From a66fa42d7384f9a64a97165da9908c6ee422adda Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Sun, 22 Apr 1990 02:47:07 +0000
Subject: [PATCH] In select-location, give up immediatly if there isn't enough
 space for a single element of element size.  Why bother wrapping, when it's
 never going to fit?

---
 compiler/pack.lisp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/pack.lisp b/compiler/pack.lisp
index 2c69765dd..da60062a5 100644
--- a/compiler/pack.lisp
+++ b/compiler/pack.lisp
@@ -555,6 +555,10 @@
 ;;; we fail, but is simpler than trying to figure out the soonest failure
 ;;; point.
 ;;;
+;;; We also give up without bothering to wrap if the current size isn't large
+;;; enough to hold a single element of element-size without bothering to wrap.
+;;; If it doesn't fit this iteration, it won't fit next.
+;;; 
 ;;; ### Note that we actually try to pack as many consecutive TNs as possible
 ;;; in the same location, since we start scanning at the same offset that the
 ;;; last TN was successfully packed in.  This is a weakening of the scattering
@@ -572,7 +576,8 @@
 	  (wrap-p nil))
       (loop
 	(when (> (+ current-start element-size) size)
-	  (cond (wrap-p (return nil))
+	  (cond ((or wrap-p (> element-size size))
+		 (return nil))
 		(t
 		 (setq current-start 0)
 		 (setq wrap-p t))))
-- 
GitLab