Blob Blame History Raw
Description: <short summary of the patch>
 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-4) unstable; urgency=medium
 .
   * Version_2_6_13pre3a
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.12.orig/h/elf64_ppcle_reloc_special.h
+++ gcl-2.6.12/h/elf64_ppcle_reloc_special.h
@@ -15,8 +15,6 @@ find_special_params(void *v,Shdr *sec1,S
   Shdr *sec;
   Rela *r;
   void *ve;
-  ul j,*u;
-
 
   massert((sec=get_section(".rela.plt",sec1,sece,sn)));
 
--- gcl-2.6.12.orig/h/page.h
+++ gcl-2.6.12/h/page.h
@@ -88,7 +88,8 @@ extern int reserve_pages_for_signal_hand
 /* #define CONT_MARK_PAGE (((page(heap_end)-first_data_page)*(PAGESIZE/(CPTR_SIZE*CHAR_SIZE))+PAGESIZE-1)/PAGESIZE) */
 /* #define	available_pages	((fixnum)(real_maxpage-page(heap_end)-2*nrbpage-CONT_MARK_PAGE-resv_pages)) */
 
-extern struct pageinfo *cell_list_head,*cell_list_tail,*contblock_list_head,*contblock_list_tail;
+extern struct pageinfo *cell_list_head,*cell_list_tail/* ,*contblock_list_head,*contblock_list_tail */;
+extern object contblock_array;
 
 #define PAGE_MAGIC 0x2e
 
@@ -114,7 +115,7 @@ EXTER void *data_start,*initial_sbrk;
 #define CB_BITS     CPTR_SIZE*CHAR_SIZE
 #define ceil(a_,b_) (((a_)+(b_)-1)/(b_))
 #define npage(m_)   ceil(m_,PAGESIZE)
-#define cpage(m_)   ({ufixnum _m=(m_);ceil(sizeof(struct pageinfo)+_m+2*ceil(_m,(CB_BITS-2)),PAGESIZE);})
+#define cpage(m_)   CEI(({ufixnum _m=(m_);ceil(sizeof(struct pageinfo)+_m+2*ceil(_m,(CB_BITS-2)),PAGESIZE);}),256)
 #define mbytes(p_)  ceil((p_)*PAGESIZE-sizeof(struct pageinfo),CB_BITS)
 #define tpage(tm_,m_) (tm_->tm_type==t_relocatable ? npage(m_-(rb_limit-rb_pointer)+1) : (tm_->tm_type==t_contiguous ? cpage(m_) : npage(m_)))
 
--- gcl-2.6.12.orig/h/protoize.h
+++ gcl-2.6.12/h/protoize.h
@@ -1941,3 +1941,12 @@ mbrk(void *);
 
 void
 maybe_set_hole_from_maxpages(void);
+
+void *
+alloc_code_space(size_t);
+
+object 
+fSmake_vector1_2(fixnum,fixnum,object,object);
+
+inline struct pageinfo *
+get_pageinfo(void *);
--- gcl-2.6.12.orig/o/alloc.c
+++ gcl-2.6.12/o/alloc.c
@@ -78,6 +78,72 @@ struct rlimit data_rlimit;
 #endif
 #endif
 
+static inline void *
+bsearchleq(void *i,void *v1,size_t n,size_t s,int (*c)(const void *,const void *)) {
+
+  ufixnum nn=n>>1;
+  void *v=v1+nn*s;
+  int j=c(i,v);
+
+  if (nn)
+    return !j ? v : (j>0 ? bsearchleq(i,v,n-nn,s,c) : bsearchleq(i,v1,nn,s,c));
+  else
+    return j<=0 ? v : v+s;
+
+}
+		     
+
+object contblock_array=Cnil;
+
+static inline void
+expand_contblock_array(void) {
+
+  if (contblock_array==Cnil) {
+    contblock_array=fSmake_vector1_2(16,aet_fix,Cnil,make_fixnum(0));
+    contblock_array->v.v_self[0]=(object)&cb_pointer;
+    enter_mark_origin(&contblock_array);
+  }
+
+  if (contblock_array->v.v_fillp==contblock_array->v.v_dim) {
+
+    void *v=alloc_relblock(2*contblock_array->v.v_dim*sizeof(fixnum));
+
+    memcpy(v,contblock_array->v.v_self,contblock_array->v.v_dim*sizeof(fixnum));
+    contblock_array->v.v_self=v;
+    contblock_array->v.v_dim*=2;
+
+  }
+
+}
+
+static void
+contblock_array_push(void *p) {
+
+  expand_contblock_array();
+  contblock_array->v.v_self[contblock_array->v.v_fillp]=p;
+  contblock_array->v.v_fillp++;
+
+}
+  
+static inline int
+acomp(const void *v1,const void *v2) {
+
+  void *p1=*(void * const *)v1,*p2=*(void * const *)v2;
+
+  return p1<p2 ? -1 : (p1==p2 ? 0 : 1);
+
+}
+
+inline struct pageinfo *
+get_pageinfo(void *x) {
+
+  struct pageinfo **pp=bsearchleq(&x,contblock_array->v.v_self,contblock_array->v.v_fillp,sizeof(*contblock_array->v.v_self),acomp);
+  struct pageinfo *p=(void *)pp>(void *)contblock_array->v.v_self ? pp[-1] : NULL;
+  
+  return p && (void *)p+p->in_use*PAGESIZE>x ? p : NULL;
+
+}
+
 inline void
 add_page_to_contblock_list(void *p,fixnum m) {
  
@@ -89,13 +155,8 @@ add_page_to_contblock_list(void *p,fixnu
   massert(pp->in_use==m);
   pp->magic=PAGE_MAGIC;
   
-  if (contblock_list_head==NULL)
-    contblock_list_tail=contblock_list_head=p;
-  else if (pp > contblock_list_tail) {
-    contblock_list_tail->next=p;
-    contblock_list_tail=p;
-  }
-  
+  contblock_array_push(p);
+
   bzero(pagetochar(page(pp)),CB_DATA_START(pp)-(void *)pagetochar(page(pp)));
 #ifdef SGC
   if (sgc_enabled && tm_table[t_contiguous].tm_sgc) {
@@ -458,7 +519,7 @@ rebalance_maxpages(struct typemanager *m
     for (i=t_start;i<t_other;i++)
       if (tm_table[i].tm_npage) {
 	if (tm_table+i==my_tm) {
-	  massert(set_tm_maxpage(tm_table+i,z));
+	  massert(set_tm_maxpage(tm_table+i,z) || !fprintf(stderr,"%lu %lu %lu %lu %lu\n",i,z,tm_table[i].tm_npage,tm_table[i].tm_maxpage,available_pages));
 	} else {
 	  massert(set_tm_maxpage(tm_table+i,tm_table[i].tm_npage+(1.0-(double)(j+d-phys_pages)/k)*(tm_table[i].tm_maxpage-tm_table[i].tm_npage)));
 	}
@@ -562,7 +623,7 @@ static inline void
 expand_contblock_index_space(void) {
 
   if (cbv==Cnil) {
-    cbv=(VFUN_NARGS=4,fSmake_vector1(make_fixnum(16),make_fixnum(aet_fix),Cnil,make_fixnum(0)));
+    cbv=fSmake_vector1_2(16,aet_fix,Cnil,make_fixnum(0));
     cbv->v.v_self[0]=(object)&cb_pointer;
     enter_mark_origin(&cbv);
   }
@@ -612,21 +673,6 @@ cbcomp(const void *v1,const void *v2) {
 
 }
 
-static inline void *
-bsearchleq(void *i,void *v1,size_t n,size_t s,int (*c)(const void *,const void *)) {
-
-  ufixnum nn=n>>1;
-  void *v=v1+nn*s;
-  int j=c(i,v);
-
-  if (nn)
-    return !j ? v : (j>0 ? bsearchleq(i,v,n-nn,s,c) : bsearchleq(i,v1,nn,s,c));
-  else
-    return j<=0 ? v : v+s;
-
-}
-		     
-
 static inline struct contblock ***
 find_cbppp(struct contblock *cbp) {
 
@@ -777,7 +823,7 @@ grow_linear1(struct typemanager *tm) {
 static inline int
 too_full_p(struct typemanager *tm) {
 
-  fixnum j,k,pf=tm->tm_percent_free ? tm->tm_percent_free : 30;
+  fixnum i,j,k,pf=tm->tm_percent_free ? tm->tm_percent_free : 30;
   struct contblock *cbp;
   struct pageinfo *pi;
 
@@ -787,11 +833,13 @@ too_full_p(struct typemanager *tm) {
     break;
   case t_contiguous:
     for (cbp=cb_pointer,k=0;cbp;cbp=cbp->cb_link) k+=cbp->cb_size;
-    for (pi=contblock_list_head,j=0;pi;pi=pi->next)
+    for (i=j=0;i<contblock_array->v.v_fillp;i++) {
+      pi=(void *)contblock_array->v.v_self[i];
 #ifdef SGC
       if (!sgc_enabled || pi->sgc_flags&SGC_PAGE_FLAG)
 #endif
 	j+=pi->in_use;
+    }
     return 100*k<pf*j*PAGESIZE;
     break;
   default:
@@ -833,8 +881,6 @@ alloc_after_gc(struct typemanager *tm,fi
 
 }
 
-struct pageinfo *contblock_list_head=NULL,*contblock_list_tail=NULL;
-
 inline void
 add_pages(struct typemanager *tm,fixnum m) {
 
@@ -890,7 +936,6 @@ alloc_after_adding_pages(struct typemana
 
   }
 
-  /* m=tm->tm_maxpage-tm->tm_npage; */
   add_pages(tm,m);
 
   return alloc_from_freelist(tm,n);
@@ -997,6 +1042,34 @@ alloc_contblock_no_gc(size_t n) {
 
 }
 
+#ifndef MAX_CODE_ADDRESS
+#define MAX_CODE_ADDRESS -1UL
+#endif
+
+void *
+alloc_code_space(size_t sz) {
+
+  void *v;
+
+  sz=CEI(sz,CPTR_SIZE);
+
+  if (sSAcode_block_reserveA &&
+      sSAcode_block_reserveA->s.s_dbind!=Cnil && sSAcode_block_reserveA->s.s_dbind->st.st_dim>=sz) {
+    
+    v=sSAcode_block_reserveA->s.s_dbind->st.st_self;
+    sSAcode_block_reserveA->s.s_dbind->st.st_self+=sz;
+    sSAcode_block_reserveA->s.s_dbind->st.st_dim-=sz;
+    sSAcode_block_reserveA->s.s_dbind->st.st_fillp=sSAcode_block_reserveA->s.s_dbind->st.st_dim;
+    
+  } else
+    v=alloc_contblock(sz);
+
+  massert(v && (unsigned long)(v+sz)<MAX_CODE_ADDRESS);
+
+  return v;
+
+}
+
 inline void *
 alloc_relblock(size_t n) {
 
@@ -1316,6 +1389,7 @@ gcl_init_alloc(void *cs_start) {
   
   
   ncbpage = 0;
+  tm_table[t_contiguous].tm_min_grow=256;
   set_tm_maxpage(tm_table+t_contiguous,1);
 #ifdef GCL_GPROF
   if (maxcbpage<textpage)
--- gcl-2.6.12.orig/o/array.c
+++ gcl-2.6.12/o/array.c
@@ -445,6 +445,11 @@ fSmake_vector1_1(fixnum n,fixnum elt_typ
   VFUN_NARGS=3;
   return FFN(fSmake_vector1)(make_fixnum(n),make_fixnum(elt_type),staticp);
 }
+object 
+fSmake_vector1_2(fixnum n,fixnum elt_type,object staticp,object fillp) {
+  VFUN_NARGS=4;
+  return FFN(fSmake_vector1)(make_fixnum(n),make_fixnum(elt_type),staticp,fillp);
+}
 
 
 static object DFLT_aet_object = Cnil;	
--- gcl-2.6.12.orig/o/gbc.c
+++ gcl-2.6.12/o/gbc.c
@@ -36,9 +36,6 @@
 
 #ifdef SGC
 static void
-sgc_contblock_sweep_phase(void);
-
-static void
 sgc_sweep_phase(void);
 
 static void
@@ -142,8 +139,6 @@ off_check(void *v,void *ve,fixnum i,stru
 }
 #endif
 
-void **contblock_stack_list=NULL;
-
 static inline bool
 pageinfo_p(void *v) {
 
@@ -163,28 +158,6 @@ in_contblock_stack_list(void *p,void ***
   return a && a[0]==p;
 }
 
-inline struct pageinfo *
-get_pageinfo(void *x) {
-
-  void *p=pageinfo(x),**a=contblock_stack_list;
-  struct pageinfo *v;
-
-  for (;!pageinfo_p(p) || in_contblock_stack_list(p,&a);p-=PAGESIZE);
-
-  v=p;
-  massert(v->type==t_contiguous && p+v->in_use*PAGESIZE>x);
-
-  return p;
-
-}
-  
-/* inline struct pageinfo * */
-/* get_pageinfo(void *x) { */
-/*   struct pageinfo *v=contblock_list_head;void *vv; */
-/*   for (;(vv=v) && (vv>=x || vv+v->in_use*PAGESIZE<=x);v=v->next); */
-/*   return v; */
-/* } */
-
 inline char
 get_bit(char *v,struct pageinfo *pi,void *x) {
   void *ve=CB_DATA_START(pi);
@@ -811,7 +784,7 @@ mark_stack_carefully(void *topv, void *b
   
   for (j=top ; j >= bottom ; j--) {
     
-    void *v=(void *)(*j),**a;
+    void *v=(void *)(*j);
     struct pageinfo *pi;
     
     if (!VALID_DATA_ADDRESS_P(v)) continue;
@@ -822,7 +795,7 @@ mark_stack_carefully(void *topv, void *b
     pi=pagetoinfo(p);
     if (!pageinfo_p(pi)) continue;
     
-    if ((a=contblock_stack_list) && in_contblock_stack_list(pi,&a)) continue;
+    if (get_pageinfo(pi)) continue;
 
     tm=tm_of(pi->type);
     if (tm->tm_type>=t_end) continue;
@@ -1067,14 +1040,24 @@ sweep_phase(void) {
 static void
 contblock_sweep_phase(void) {
 
+  struct pageinfo *v;
   STATIC char *s, *e, *p, *q;
-  STATIC struct pageinfo *v;
+  object o;
+  ufixnum i;
     
   reset_contblock_freelist();
-  
-  for (v=contblock_list_head;v;v=v->next) {
+
+  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;
 
+#ifdef SGC
+    if (sgc_enabled && !(v->sgc_flags&SGC_PAGE_FLAG)) continue;
+#endif
+    
     s=CB_DATA_START(v);
     e=(void *)v+v->in_use*PAGESIZE;
 
@@ -1090,14 +1073,9 @@ contblock_sweep_phase(void) {
     bzero(CB_MARK_START(v),CB_SGCF_START(v)-CB_MARK_START(v));
 
   }
-#ifdef DEBUG
-  if (debug) {
-    for (cbp = cb_pointer; cbp != NULL; cbp = cbp->cb_link)
-      printf("%lud-byte contblock\n", cbp->cb_size);
-    fflush(stdout);
-  }
-#endif
-  
+
+  sSAleaf_collection_thresholdA->s.s_dbind=o;
+
   sweep_link_array();
 
 }
@@ -1143,24 +1121,6 @@ GBC(enum type t) {
 
   ngc_thresh=fix(sSAleaf_collection_thresholdA->s.s_dbind);
 
-  { /*FIXME try to get this below the setjmp in mark_c_stack*/
-    struct pageinfo *v,*tv;
-    ufixnum i;
-    void *a;
-    
-    for (v=contblock_list_head,contblock_stack_list=NULL;v;v=v->next)
-      for (i=1;i<v->in_use;i++) {
-	tv=pagetoinfo(page(v)+i);
-	if (pageinfo_p(tv)) {
-	  a=contblock_stack_list;
-	  /* fprintf(stderr,"pushing %p\n",tv); */
-	  contblock_stack_list=alloca(2*sizeof(a));
-	  contblock_stack_list[0]=tv;
-	  contblock_stack_list[1]=a;
-	}
-      }
-  }
-  
   if (in_signal_handler && t == t_relocatable)
     error("cant gc relocatable in signal handler");
   
@@ -1312,12 +1272,7 @@ GBC(enum type t) {
     }
 #endif
     
-#ifdef SGC
-    if (sgc_enabled)
-      sgc_contblock_sweep_phase();
-    else
-#endif
-      contblock_sweep_phase();
+    contblock_sweep_phase();
 #ifdef DEBUG
     if (debug)
       printf("contblock sweep ended (%d)\n",
@@ -1574,7 +1529,7 @@ mark_contblock(void *p, int s) {
      sizeof(struct contblock).  CM 20030827 */
   x = (char *)PFLR(p,CPTR_SIZE);
   y = (char *)PCEI(q,CPTR_SIZE);
-  v=get_pageinfo(x);
+  massert(v=get_pageinfo(x));
 #ifdef SGC
   if (!sgc_enabled || (v->sgc_flags&SGC_PAGE_FLAG))
 #endif
@@ -1595,7 +1550,7 @@ DEFUN_NEW("CONTIGUOUS-REPORT",object,fSc
   }
   fprintf(stderr,"\nTotal free %lu in %lu pieces\n\n",i,j);
   
-  for (i=j=0,v=contblock_list_head;v;i+=v->in_use,j++,v=v->next) 
+  for (i=j=k=0;k<contblock_array->v.v_fillp && (v=(void *)contblock_array->v.v_self[k]);k++,i+=v->in_use,j++) 
     fprintf(stderr,"%lu pages at %p\n",(unsigned long)v->in_use,v);
   fprintf(stderr,"\nTotal pages %lu in %lu pieces\n\n",i,j);
   
--- gcl-2.6.12.orig/o/sfaslelf.c
+++ gcl-2.6.12/o/sfaslelf.c
@@ -242,32 +242,6 @@ relocate_symbols(Sym *sym,Sym *syme,Shdr
   
 }
 
-#ifndef MAX_CODE_ADDRESS
-#define MAX_CODE_ADDRESS -1UL
-#endif
-
-static void *
-alloc_memory(ul sz) {
-
-  void *v;
-
-  if (sSAcode_block_reserveA &&
-      sSAcode_block_reserveA->s.s_dbind!=Cnil && sSAcode_block_reserveA->s.s_dbind->st.st_dim>=sz) {
-    
-    v=sSAcode_block_reserveA->s.s_dbind->st.st_self;
-    sSAcode_block_reserveA->s.s_dbind->st.st_self+=sz;
-    sSAcode_block_reserveA->s.s_dbind->st.st_dim-=sz;
-    sSAcode_block_reserveA->s.s_dbind->st.st_fillp=sSAcode_block_reserveA->s.s_dbind->st.st_dim;
-    
-  } else
-    v=alloc_contblock(sz);
-
-  massert(v && (ul)(v+sz)<MAX_CODE_ADDRESS);
-
-  return v;
-
-}
-
 static object
 load_memory(Shdr *sec1,Shdr *sece,void *v1,ul **got,ul **gote) {
 
@@ -301,7 +275,7 @@ load_memory(Shdr *sec1,Shdr *sece,void *
   memory->cfd.cfd_size=sz;
   memory->cfd.cfd_self=0;
   memory->cfd.cfd_start=0;
-  memory->cfd.cfd_start=alloc_memory(sz);
+  memory->cfd.cfd_start=alloc_code_space(sz);
 
   a=(ul)memory->cfd.cfd_start;
   a=(a+ma)&~ma;
--- gcl-2.6.12.orig/o/sgbc.c
+++ gcl-2.6.12/o/sgbc.c
@@ -99,7 +99,7 @@ sgc_mark_phase(void) {
   
   /* mark all non recent data on writable contiguous pages */
   if (what_to_collect == t_contiguous)
-    for (v=contblock_list_head;v;v=v->next)
+    for (i=0;i<contblock_array->v.v_fillp && (v=(void *)contblock_array->v.v_self[i]);i++)
       if (v->sgc_flags&SGC_PAGE_FLAG) {
 	void *s=CB_DATA_START(v),*e=CB_DATA_END(v),*p,*q;
 	bool z=get_sgc_bit(v,s);
@@ -213,40 +213,6 @@ sgc_sweep_phase(void) {
   }
 }
 
-
-static void
-sgc_contblock_sweep_phase(void) {
-
-  STATIC char *s, *e, *p, *q;
-  STATIC struct pageinfo *v;
-    
-  reset_contblock_freelist();
-  
-  for (v=contblock_list_head;v;v=v->next) {
-    bool z;
-
-    if (!(v->sgc_flags&SGC_PAGE_FLAG)) continue;
-
-    s=CB_DATA_START(v);
-    e=CB_DATA_END(v);
-
-    z=get_mark_bit(v,s);
-    for (p=s;p<e;) {
-      q=get_mark_bits(v,p);
-      if (!z)
-	insert_contblock(p,q-p);
-      z=1-z;
-      p=q;
-    }
-
-    bzero(CB_MARK_START(v),CB_SGCF_START(v)-CB_MARK_START(v));
-
-  }
-
-  sweep_link_array();
-
-}
-
 #undef tm
 
 #ifdef SDEBUG
@@ -664,7 +630,7 @@ sgc_start(void) {
     
     tm=tm_of(t_contiguous);
 
-    for (pi=contblock_list_head;pi && count<WSGC(tm);pi=pi->next) {
+    for (i=0;i<contblock_array->v.v_fillp && (pi=(void *)contblock_array->v.v_self[i]) && count<WSGC(tm);i++) {
 
       p=CB_DATA_START(pi);
       pe=CB_DATA_END(pi);
@@ -685,7 +651,7 @@ sgc_start(void) {
       /* SGC cont pages: allocate more if necessary, dumping possible
 	 GBC freed pages onto the old contblock list.  CM 20030827*/
       unsigned long z=(i-count)+1;
-      void *old_contblock_list_tail=contblock_list_tail;
+      ufixnum fp=contblock_array->v.v_fillp;
 
       if (maxcbpage<ncbpage+z)
 	if (!set_tm_maxpage(tm_table+t_contiguous,ncbpage+z))
@@ -693,9 +659,9 @@ sgc_start(void) {
 
       add_pages(tm_table+t_contiguous,z);
 
-      massert(old_contblock_list_tail!=contblock_list_tail);
+      massert(fp!=contblock_array->v.v_fillp);
 
-      contblock_list_tail->sgc_flags=SGC_PAGE_FLAG;
+      ((struct pageinfo *)contblock_array->v.v_self[fp])->sgc_flags=SGC_PAGE_FLAG;
 
     }
 
@@ -743,17 +709,19 @@ sgc_start(void) {
   {
 
     struct pageinfo *pi;
-
+    ufixnum j;
+    
     {
 
       struct contblock **cbpp;
       void *p=NULL,*pe;
       struct pageinfo *pi;
+      ufixnum i;
       
       old_cb_pointer=cb_pointer;
       reset_contblock_freelist();
 
-      for (pi=contblock_list_head;pi;pi=pi->next) {
+      for (i=0;i<contblock_array->v.v_fillp && (pi=(void *)contblock_array->v.v_self[i]);i++) {
 	
 	if (pi->sgc_flags!=SGC_PAGE_FLAG) continue;
 	
@@ -786,7 +754,7 @@ sgc_start(void) {
       else
 	tm_of(pi->type)->tm_alt_npage++;
     }
-    for (pi=contblock_list_head;pi;pi=pi->next)/*FIXME*/
+    for (j=0;j<contblock_array->v.v_fillp && (pi=(void *)contblock_array->v.v_self[j]);j++)
       if (pi->sgc_flags&SGC_WRITABLE)
 	for (i=0;i<pi->in_use;i++)
 	  SET_WRITABLE(page(pi)+i);
@@ -932,7 +900,7 @@ sgc_quit(void) {
   	((object) p)->d.s=SGC_NORMAL;
 #endif
   
-  for (v=contblock_list_head;v;v=v->next) 
+  for (i=0;i<contblock_array->v.v_fillp &&(v=(void *)contblock_array->v.v_self[i]);i++)
     if (v->sgc_flags&SGC_PAGE_FLAG) 
       bzero(CB_SGCF_START(v),CB_DATA_START(v)-CB_SGCF_START(v));
   
@@ -940,7 +908,7 @@ sgc_quit(void) {
     struct pageinfo *pi;
     for (pi=cell_list_head;pi;pi=pi->next)
       pi->sgc_flags&=SGC_PERM_WRITABLE;
-    for (pi=contblock_list_head;pi;pi=pi->next)
+    for (i=0;i<contblock_array->v.v_fillp &&(pi=(void *)contblock_array->v.v_self[i]);i++)
       pi->sgc_flags&=SGC_PERM_WRITABLE;
   }