Blob Blame 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-12) unstable; urgency=medium
 .
   * Version_2_6_13pre13
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/protoize.h
+++ gcl-2.6.12/h/protoize.h
@@ -1918,7 +1918,7 @@ void
 allocate_code_block_reserve(void);
 
 void *
-alloc_contblock_no_gc(size_t);
+alloc_contblock_no_gc(size_t,char *);
 
 void
 reset_contblock_freelist(void);
--- gcl-2.6.12.orig/o/alloc.c
+++ gcl-2.6.12/o/alloc.c
@@ -1047,7 +1047,7 @@ alloc_contblock(size_t n) {
 }
 
 void *
-alloc_contblock_no_gc(size_t n) {
+alloc_contblock_no_gc(size_t n,char *limit) {
 
   struct typemanager *tm=tm_of(t_contiguous);
   void *p;
@@ -1057,7 +1057,7 @@ alloc_contblock_no_gc(size_t n) {
   if ((p=alloc_from_freelist(tm,n)))
     return p;
 
-  if (tpage(tm,n)<(rb_start-heap_end)>>PAGEWIDTH && (p=alloc_after_adding_pages(tm,n)))
+  if (tpage(tm,n)<(limit-heap_end)>>PAGEWIDTH && (p=alloc_after_adding_pages(tm,n)))
     return p;
 
   return NULL;
--- gcl-2.6.12.orig/o/gbc.c
+++ gcl-2.6.12/o/gbc.c
@@ -431,29 +431,21 @@ collecting(void *p) {
 
 static ufixnum ngc_thresh;
 static union {struct dummy d;ufixnum f;} rst={.f=-1};
-/* static object lcv=Cnil; */
+static void *static_promotion_limit;
 
 static inline void
 mark_leaf_data(object x,void **pp,ufixnum s,ufixnum r) {
 
-  void *p=*pp,*dp/* ,*dpe */;
+  void *p=*pp,*dp;
   
   if (!marking(p)||!collecting(p))
     return;
 
-  /* if (lcv!=Cnil && !collecting(lcv->st.st_self) && */
-  /*     (dp=PCEI(lcv->st.st_self,r)) && dp+s<=(dpe=lcv->st.st_self+lcv->st.st_dim) */
-  /*     && x && x->d.st>=ngc_thresh) { */
-
   if (what_to_collect!=t_contiguous && 
       x && x->d.st>=ngc_thresh &&
-      (dp=alloc_contblock_no_gc(s))) {
+      (dp=alloc_contblock_no_gc(s,static_promotion_limit))) {
     
-    /* fprintf(stderr,"Promoting %p,%lu to %p\n",p,s,dp); */
-    /* fflush(stderr); */
-
     *pp=memcpy(dp,p,s);
-    /* lcv->st.st_fillp=lcv->st.st_dim=(dpe-(void *)(lcv->st.st_self=dp+s)); */
     x->d.st=0;
 
     return;
@@ -1204,8 +1196,10 @@ GBC(enum type t) {
 
   if (gc_time >=0 && !gc_recursive++) {gc_start=runtime();}
   
-  if (COLLECT_RELBLOCK_P)
+  if (COLLECT_RELBLOCK_P) {
+    static_promotion_limit=rb_start<new_rb_start ? rb_start : new_rb_start;/*do not allow static promotion to go past this point*/
     setup_rb();
+  }
   
 #ifdef DEBUG
   if (debug) {