<short summary of the patch>
authorCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
committerCamm Maguire <camm@debian.org>
Thu, 11 Aug 2022 17:16:42 +0000 (18:16 +0100)
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.

gcl (2.6.12-6) unstable; urgency=medium

  * Version_2_6_13pre5

Gbp-Pq: Name Version_2_6_13pre6

o/alloc.c
o/gbc.c

index 38b97ba04759a963ff444fa827cb220d2bec1586..d738ab7ecffa9c9ea0fe3c629a46fafa9b40950a 100644 (file)
--- a/o/alloc.c
+++ b/o/alloc.c
@@ -254,8 +254,10 @@ empty_relblock(void) {
   object o=sSAleaf_collection_thresholdA->s.s_dbind;
   
   sSAleaf_collection_thresholdA->s.s_dbind=make_fixnum(0);
-  for (;rb_pointer!=rb_start&&rb_pointer!=rb_end;)
+  for (;rb_pointer!=rb_start&&rb_pointer!=rb_end;) {
+    tm_table[t_relocatable].tm_adjgbccnt--;
     GBC(t_relocatable);
+  }
   sSAleaf_collection_thresholdA->s.s_dbind=o;
 
 }
@@ -498,10 +500,10 @@ static int
 rebalance_maxpages(struct typemanager *my_tm,fixnum z) {
 
   fixnum d;
-  ufixnum i,j;
+  ufixnum i,j,r=(my_tm->tm_type==t_relocatable ? 2 : 1);
   
   
-  d=(z-my_tm->tm_maxpage)*(my_tm->tm_type==t_relocatable ? 2 : 1);
+  d=(z-my_tm->tm_maxpage)*r;
   j=sum_maxpages();
 
   if (j+d>phys_pages) {
@@ -517,14 +519,14 @@ rebalance_maxpages(struct typemanager *my_tm,fixnum z) {
     if (e+phys_pages-j<=0)
       return 0;
 
-    f=1.0-(double)e/k;
+    f=k ? 1.0-(double)e/k : 1.0;
 
     for (i=t_start;i<t_other;i++)
       if (tm_table[i].tm_npage && tm_table+i!=my_tm) {
          massert(set_tm_maxpage(tm_table+i,tm_table[i].tm_npage+f*(tm_table[i].tm_maxpage-tm_table[i].tm_npage)));
        }
     
-    massert(set_tm_maxpage(my_tm,(my_tm->tm_maxpage+(phys_pages-sum_maxpages()))/(my_tm->tm_type==t_relocatable ? 2 : 1)));
+    massert(set_tm_maxpage(my_tm,(my_tm->tm_maxpage*r+(phys_pages-sum_maxpages()))/r));
 
     return 1;
     
@@ -624,7 +626,12 @@ expand_contblock_index_space(void) {
 
   if (cbv->v.v_fillp+1==cbv->v.v_dim) {
 
-    void *v=alloc_relblock(2*cbv->v.v_dim*sizeof(fixnum));
+    void *v;
+    object o=sSAleaf_collection_thresholdA->s.s_dbind;
+
+    sSAleaf_collection_thresholdA->s.s_dbind=make_fixnum(-1);
+    v=alloc_relblock(2*cbv->v.v_dim*sizeof(fixnum));
+    sSAleaf_collection_thresholdA->s.s_dbind=o;
 
     memcpy(v,cbv->v.v_self,cbv->v.v_dim*sizeof(fixnum));
     cbv->v.v_self=v;
@@ -731,13 +738,14 @@ insert_contblock(void *p,ufixnum s) {
 
   cbp->cb_size=s;
   cbp->cb_link=*cbpp;
-  *cbpp=cbp;
   
   if ((!cbp->cb_link || cbp->cb_link->cb_size!=s)) {
     cbppp=expand_contblock_index(cbppp);
     cbppp[1]=&cbp->cb_link;
   }
 
+  *cbpp=cbp;
+
 }
 
 static inline void
@@ -890,6 +898,7 @@ add_pages(struct typemanager *tm,fixnum m) {
     if (rb_pointer>rb_end) {
       fprintf(stderr,"Moving relblock low before expanding relblock pages\n");
       fflush(stderr);
+      tm_table[t_relocatable].tm_adjgbccnt--;
       GBC(t_relocatable);
     }
     nrbpage+=m;
diff --git a/o/gbc.c b/o/gbc.c
index bca86cdf0901930bbef059700077f56b952f633b..3e7d6ae3fb25da6975c352bc1eddeb0b192c8bf1 100755 (executable)
--- a/o/gbc.c
+++ b/o/gbc.c
@@ -1042,14 +1042,10 @@ contblock_sweep_phase(void) {
 
   struct pageinfo *v;
   STATIC char *s, *e, *p, *q;
-  object o;
   ufixnum i;
     
   reset_contblock_freelist();
 
-  o=sSAleaf_collection_thresholdA->s.s_dbind;
-  sSAleaf_collection_thresholdA->s.s_dbind=make_fixnum(-1);
-
   for (i=0;i<contblock_array->v.v_fillp && (v=(void *)contblock_array->v.v_self[i]);i++) {
 
     bool z;
@@ -1074,8 +1070,6 @@ contblock_sweep_phase(void) {
 
   }
 
-  sSAleaf_collection_thresholdA->s.s_dbind=o;
-
   sweep_link_array();
 
 }
@@ -1646,14 +1640,18 @@ DEFUN_NEW("GBC",object,fSgbc,SI,1,1,NONE,OO,OO,OO,OO,(object x0),"") {
 
    /* 1 args */
   
-  if (x0 == Ct)
+  if (x0 == Ct) {
+    tm_table[t_contiguous].tm_adjgbccnt--;
     GBC(t_other);
-  else if (x0 == Cnil)
+  } else if (x0 == Cnil) {
+    tm_table[t_cons].tm_adjgbccnt--;
     GBC(t_cons);
-  else if (eql(small_fixnum(0),x0))
+  } else if (eql(small_fixnum(0),x0)) {
+    tm_table[t_contiguous].tm_adjgbccnt--;
     GBC(t_contiguous);
-  else {
+  else {
     x0 = small_fixnum(1);
+    tm_table[t_relocatable].tm_adjgbccnt--;
     GBC(t_relocatable);
   }
   RETURN1(x0);