From: Camm Maguire Date: Sun, 13 Nov 2022 12:55:14 +0000 (+0000) Subject: X-Git-Tag: archive/raspbian/2.7.1-4+rpi1~2^2^2~139 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0f2146958f8eea2e5f6aed1646924137f6a96bc1;p=gcl27.git 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 Gbp-Pq: Name Version_2_6_13pre2 --- diff --git a/h/bsd.h b/h/bsd.h index e645b23..42026de 100755 --- a/h/bsd.h +++ b/h/bsd.h @@ -33,39 +33,7 @@ filecpy(save, original, stsize - sizeof(stsize)) 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) diff --git a/h/protoize.h b/h/protoize.h index 7f0eeab..44bf57f 100644 --- a/h/protoize.h +++ b/h/protoize.h @@ -1935,3 +1935,6 @@ empty_relblock(void); fixnum check_avail_pages(void); + +inline int +mbrk(void *); diff --git a/o/alloc.c b/o/alloc.c index b5a6d9f..d41cbbb 100644 --- a/o/alloc.c +++ b/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); diff --git a/o/main.c b/o/main.c index 9819147..4a2254d 100755 --- a/o/main.c +++ b/o/main.c @@ -120,6 +120,7 @@ fixnum log_maxpage_bound=sizeof(fixnum)*8-1; 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) {