Description: 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-2) unstable; urgency=medium . * Version_2_6_13pre1 Author: Camm Maguire --- 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: , Bug: Bug-Debian: https://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: --- gcl-2.6.12.orig/h/bsd.h +++ gcl-2.6.12/h/bsd.h @@ -33,39 +33,7 @@ filecpy(save, original, stsize - sizeof( extern char etext; - - - -/* #define SET_REAL_MAXPAGE do { struct rlimit data_rlimit; \ */ -/* extern char etext; \ */ -/* real_maxpage = MAXPAGE ; \ */ -/* getrlimit(RLIMIT_DATA, &data_rlimit); \ */ -/* real_maxpage = ((unsigned int)&etext/PAGESIZE + data_rlimit.rlim_cur/PAGESIZE); \ */ -/* if (real_maxpage > MAXPAGE) \ */ -/* real_maxpage = MAXPAGE ; } while(0) */ - -#define ROUND_UP_SBRK(x) \ - do {long i; \ - if ((i = ((long)x & (PAGESIZE - 1)))) \ - x=sbrk(PAGESIZE - i); } while(0); - -#define FIX_RANDOM_SBRK \ -do {char *x=sbrk(0); \ - if (core_end != x) \ - { ROUND_UP_SBRK(x); x=sbrk(0);\ - while (core_end < x) \ - { \ - core_end = core_end + PAGESIZE;} \ - if (core_end !=x) error("Someone allocated my memory");}} while (0) - - -#define INIT_ALLOC \ - heap_end = sbrk(0); ROUND_UP_SBRK(heap_end);\ - heap_end = core_end = sbrk(0); - -#define IF_ALLOCATE_ERR \ - FIX_RANDOM_SBRK; \ - if (core_end != sbrk(PAGESIZE*(n - m))) +#define INIT_ALLOC heap_end = core_end = sbrk(0); #define SYM_EXTERNAL_P(sym) ((sym)->n_type & N_EXT) --- gcl-2.6.12.orig/h/protoize.h +++ gcl-2.6.12/h/protoize.h @@ -1935,3 +1935,6 @@ empty_relblock(void); fixnum check_avail_pages(void); + +inline int +mbrk(void *); --- gcl-2.6.12.orig/o/alloc.c +++ gcl-2.6.12/o/alloc.c @@ -223,61 +223,53 @@ resize_hole(ufixnum hp,enum type tp) { inline void * alloc_page(long n) { - fixnum d,m; - - if (n>=0) { + bool s=n<0; + ufixnum nn=s ? -n : n; + void *v,*e; + + if (!s) { - if (n>(holepage - (in_signal_handler? 0 : + if (nn>(holepage - (in_signal_handler? 0 : available_pages-n<=reserve_pages_for_signal_handler ? 0 : reserve_pages_for_signal_handler))) { - if (in_signal_handler) { - fprintf(stderr,"Cant do relocatable gc in signal handler. \ -Try to allocate more space to save for allocation during signals: \ -eg to add 20 more do (si::set-hole-size %ld %d)\n...start over ", - new_holepage, 20+ reserve_pages_for_signal_handler); fflush(stderr); exit(1); - } - + fixnum d=available_pages-nn; - d=available_pages-n; d*=0.2; d=d<0.01*real_maxpage ? available_pages-n : d; d=d<0 ? 0 : d; d=new_holepagecb_size==(**cbppp)->cb_size;cbpp=&cbp->cb_link,cbp=cbp->cb_link,k++); if (print) - fprintf(stderr,"%lu %p %p %lu %lu\n",cbppp-cbsrch1,*cbppp,**cbppp,(**cbppp)->cb_size,k); + fprintf(stderr,"%lu %p %p %lu %lu\n",(unsigned long)(cbppp-cbsrch1),*cbppp,**cbppp,(**cbppp)->cb_size,k); } massert(cbppp==cbsrche); massert(*cbppp==cbpp); --- gcl-2.6.12.orig/o/main.c +++ gcl-2.6.12/o/main.c @@ -120,6 +120,7 @@ fixnum log_maxpage_bound=sizeof(fixnum)* inline int mbrk(void *v) { + ufixnum uv=(ufixnum)v,uc=(ufixnum)sbrk(0),ux,um; fixnum m=((1UL<<(sizeof(fixnum)*8-1))-1); @@ -134,9 +135,12 @@ mbrk(void *v) { um=uc; ux=uv; } + if (((fixnum)(ux-um))<0) return mbrk((void *)uc+(uvs.s_dbind=alloc_simple_string(n); - sSAcode_block_reserveA->s.s_dbind->st.st_self=alloc_memory(n); - -} - static object load_memory(Shdr *sec1,Shdr *sece,void *v1,ul **got,ul **gote) {