/[gcl]/gcl/o/alloc.c
ViewVC logotype

Diff of /gcl/o/alloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by camm, Fri Aug 29 20:51:03 2003 UTC revision 1.22 by camm, Fri Sep 5 21:48:17 2003 UTC
# Line 106  alloc_page(int n) Line 106  alloc_page(int n)
106                      {                      {
107                          holepage = new_holepage + n;                          holepage = new_holepage + n;
108    
109                          {int in_sgc=sgc_enabled;                          {
110    #ifdef SGC
111                              int in_sgc=sgc_enabled;
112                           if (in_sgc) sgc_quit();                           if (in_sgc) sgc_quit();
113    #endif
114                          if(in_signal_handler)                          if(in_signal_handler)
115                            {fprintf(stderr,                            {fprintf(stderr,
116                                     "Cant do relocatable gc in signal handler. \                                     "Cant do relocatable gc in signal handler. \
# Line 115  Try to allocate more space to save for a Line 118  Try to allocate more space to save for a
118  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);}  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);}
119    
120                          GBC(t_relocatable);                          GBC(t_relocatable);
121    #ifdef SGC
122                          if (in_sgc)                          if (in_sgc)
123                            {sgc_start();                            {sgc_start();
124                             /* starting sgc can use up some pages                             /* starting sgc can use up some pages
125                                and may move heap end, so start over                                and may move heap end, so start over
126                              */                              */
127                             return alloc_page(n);}                             return alloc_page(n);}
128    #endif
129                         }                         }
130                  }                  }
131                  holepage -= n;                  holepage -= n;
# Line 145  eg to add 20 more do (si::set-hole-size Line 150  eg to add 20 more do (si::set-hole-size
150  #ifdef SGC  #ifdef SGC
151          if (sgc_enabled)          if (sgc_enabled)
152            make_writable(page(core_end),page(core_end)+n-m);            make_writable(page(core_end),page(core_end)+n-m);
   
153  #endif    #endif  
154          core_end += PAGESIZE*(n - m);          core_end += PAGESIZE*(n - m);
155          return(e);}          return(e);}
# Line 249  ONCE_MORE: Line 253  ONCE_MORE:
253          obj->d.t = (short)t;          obj->d.t = (short)t;
254          obj->d.m = FALSE;          obj->d.m = FALSE;
255          return(obj);          return(obj);
256    #ifdef SGC
257  #define TOTAL_THIS_TYPE(tm) \  #define TOTAL_THIS_TYPE(tm) \
258          (tm->tm_nppage * (sgc_enabled ? sgc_count_type(tm->tm_type) : tm->tm_npage))          (tm->tm_nppage * (sgc_enabled ? sgc_count_type(tm->tm_type) : tm->tm_npage))
259    #else
260    #define TOTAL_THIS_TYPE(tm) \
261            (tm->tm_nppage * tm->tm_npage)
262    #endif
263  CALL_GBC:  CALL_GBC:
264          GBC(tm->tm_type);          GBC(tm->tm_type);
265          if (tm->tm_nfree == 0 ||          if (tm->tm_nfree == 0 ||
# Line 489  Use ALLOCATE-CONTIGUOUS-PAGES to expand Line 498  Use ALLOCATE-CONTIGUOUS-PAGES to expand
498                     pages for SGC, causing no contiguous pages to be                     pages for SGC, causing no contiguous pages to be
499                     swept when SGC was on.  Here we follow the behavior                     swept when SGC was on.  Here we follow the behavior
500                     for other pages in add_to_freelist. CM 20030827  */                     for other pages in add_to_freelist. CM 20030827  */
501    #ifdef SGC
502                  if (SGC_CONT_ENABLED)                  if (SGC_CONT_ENABLED)
503                    sgc_type_map[page(p)+i]|= SGC_PAGE_FLAG;                    sgc_type_map[page(p)+i]|= SGC_PAGE_FLAG;
504    #endif
505          }          }
506          ncbpage += m;          ncbpage += m;
507          insert_contblock(p+n, PAGESIZE*m - n);          insert_contblock(p+n, PAGESIZE*m - n);
# Line 500  Use ALLOCATE-CONTIGUOUS-PAGES to expand Line 511  Use ALLOCATE-CONTIGUOUS-PAGES to expand
511  /* SGC cont pages: explicit free calls can come at any time, and we  /* SGC cont pages: explicit free calls can come at any time, and we
512     must make sure to add the newly deallocated block to the right     must make sure to add the newly deallocated block to the right
513     list.  CM 20030827*/     list.  CM 20030827*/
514    #ifdef SGC
515  void  void
516  insert_maybe_sgc_contblock(char *p,int s) {  insert_maybe_sgc_contblock(char *p,int s) {
517    
# Line 517  insert_maybe_sgc_contblock(char *p,int s Line 529  insert_maybe_sgc_contblock(char *p,int s
529      insert_contblock(p,s);      insert_contblock(p,s);
530    
531  }  }
532    #endif
533    
534  #ifdef SGC_CONT_DEBUG  #ifdef SGC_CONT_DEBUG
535  extern void overlap_check(struct contblock *,struct contblock *);  extern void overlap_check(struct contblock *,struct contblock *);
# Line 547  insert_contblock(char *p, int s) { Line 560  insert_contblock(char *p, int s) {
560        }        }
561        if (sgc_enabled)        if (sgc_enabled)
562          overlap_check(old_cb_pointer,cb_pointer);          overlap_check(old_cb_pointer,cb_pointer);
         
563  #endif  #endif
564        cbp->cb_link = *cbpp;        cbp->cb_link = *cbpp;
565        *cbpp = cbp;        *cbpp = cbp;
# Line 985  DEFUN_NEW("ALLOCATE-CONTIGUOUS-PAGES",ob Line 997  DEFUN_NEW("ALLOCATE-CONTIGUOUS-PAGES",ob
997         pages for SGC, causing no contiguous pages to be         pages for SGC, causing no contiguous pages to be
998         swept when SGC was on.  Here we follow the behavior         swept when SGC was on.  Here we follow the behavior
999         for other pages in add_to_freelist. CM 20030827  */         for other pages in add_to_freelist. CM 20030827  */
1000    #ifdef SGC
1001      if (SGC_CONT_ENABLED)      if (SGC_CONT_ENABLED)
1002        sgc_type_map[page(p)+i]|= SGC_PAGE_FLAG;        sgc_type_map[page(p)+i]|= SGC_PAGE_FLAG;
1003    #endif
1004    }    }
1005    
1006    ncbpage += m;    ncbpage += m;
# Line 1232  free(void *ptr) Line 1246  free(void *ptr)
1246          for (p = &malloc_list; *p && !endp(*p);  p = &((*p)->c.c_cdr))          for (p = &malloc_list; *p && !endp(*p);  p = &((*p)->c.c_cdr))
1247                  if ((*p)->c.c_car->st.st_self == ptr) {                  if ((*p)->c.c_car->st.st_self == ptr) {
1248  /* SGC contblock pages: Its possible this is on an old page CM 20030827 */  /* SGC contblock pages: Its possible this is on an old page CM 20030827 */
1249    #ifdef SGC
1250                          insert_maybe_sgc_contblock((*p)->c.c_car->st.st_self,                          insert_maybe_sgc_contblock((*p)->c.c_car->st.st_self,
1251                                                     (*p)->c.c_car->st.st_dim);                                                     (*p)->c.c_car->st.st_dim);
1252    #else
1253                            insert_contblock((*p)->c.c_car->st.st_self,
1254                                             (*p)->c.c_car->st.st_dim);
1255    #endif
1256                          (*p)->c.c_car->st.st_self = NULL;                          (*p)->c.c_car->st.st_self = NULL;
1257                          *p = (*p)->c.c_cdr;                          *p = (*p)->c.c_cdr;
1258                          return ;                          return ;
# Line 1282  realloc(void *ptr, size_t size) { Line 1301  realloc(void *ptr, size_t size) {
1301          for (i = 0;  i < size;  i++)          for (i = 0;  i < size;  i++)
1302            x->st.st_self[i] = ((char *)ptr)[i];            x->st.st_self[i] = ((char *)ptr)[i];
1303  /* SGC contblock pages: Its possible this is on an old page CM 20030827 */  /* SGC contblock pages: Its possible this is on an old page CM 20030827 */
1304    #ifdef SGC
1305          insert_maybe_sgc_contblock(ptr, j);          insert_maybe_sgc_contblock(ptr, j);
1306    #else
1307            insert_contblock(ptr, j);
1308    #endif
1309          return(x->st.st_self);          return(x->st.st_self);
1310        }        }
1311      }      }

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26