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