/[cmucl]/src/lisp/gencgc.c
ViewVC logotype

Diff of /src/lisp/gencgc.c

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

revision 1.107.2.3 by rtoy, Mon Jul 19 17:54:42 2010 UTC revision 1.112 by rtoy, Sun Jan 9 00:12:36 2011 UTC
# Line 150  Line 150 
150    
151  /* Define for activating assertions.  */  /* Define for activating assertions.  */
152    
153  #if defined(DARWIN)  #if defined(x86) && defined(SOLARIS)
154  #define GC_ASSERTIONS 1  #define GC_ASSERTIONS 1
155  #endif  #endif
156    
# Line 244  unsigned gencgc_verbose = 0; Line 244  unsigned gencgc_verbose = 0;
244  unsigned counters_verbose = 0;  unsigned counters_verbose = 0;
245    
246  /*  /*
247     * If true, then some debugging information is printed when scavenging
248     * static (malloc'ed) arrays.
249     */
250    boolean debug_static_array_p = 0;
251    
252    /*
253   * To enable the use of page protection to help avoid the scavenging   * To enable the use of page protection to help avoid the scavenging
254   * of pages that don't have pointers to younger generations.   * of pages that don't have pointers to younger generations.
255   */   */
# Line 318  boolean gencgc_zero_check_during_free_he Line 324  boolean gencgc_zero_check_during_free_he
324  /*  /*
325   * The minimum size for a large object.   * The minimum size for a large object.
326   */   */
327  unsigned large_object_size = 4 * PAGE_SIZE;  unsigned large_object_size = 4 * GC_PAGE_SIZE;
328    
329  /*  /*
330   * Enable the filtering of stack/register pointers. This could reduce   * Enable the filtering of stack/register pointers. This could reduce
# Line 388  static char *heap_base = NULL; Line 394  static char *heap_base = NULL;
394  static char *  static char *
395  page_address(int page_num)  page_address(int page_num)
396  {  {
397      return heap_base + PAGE_SIZE * page_num;      return heap_base + GC_PAGE_SIZE * page_num;
398  }  }
399    
400  /*  /*
# Line 401  find_page_index(void *addr) Line 407  find_page_index(void *addr)
407      int index = (char *) addr - heap_base;      int index = (char *) addr - heap_base;
408    
409      if (index >= 0) {      if (index >= 0) {
410          index = (unsigned int) index / PAGE_SIZE;          index = (unsigned int) index / GC_PAGE_SIZE;
411          if (index < dynamic_space_pages)          if (index < dynamic_space_pages)
412              return index;              return index;
413      }      }
# Line 435  gc_write_barrier(void *addr) Line 441  gc_write_barrier(void *addr)
441                   "*** Page fault in page not marked as write protected\n");                   "*** Page fault in page not marked as write protected\n");
442    
443      /* Un-protect the page */      /* Un-protect the page */
444      os_protect((os_vm_address_t) page_address(page_index), PAGE_SIZE, OS_VM_PROT_ALL);      os_protect((os_vm_address_t) page_address(page_index), GC_PAGE_SIZE, OS_VM_PROT_ALL);
445      page_table[page_index].flags &= ~PAGE_WRITE_PROTECTED_MASK;      page_table[page_index].flags &= ~PAGE_WRITE_PROTECTED_MASK;
446      page_table[page_index].flags |= PAGE_WRITE_PROTECT_CLEARED_MASK;      page_table[page_index].flags |= PAGE_WRITE_PROTECT_CLEARED_MASK;
447    
# Line 706  print_generation_stats(int verbose) Line 712  print_generation_stats(int verbose)
712          gens = NUM_GENERATIONS;          gens = NUM_GENERATIONS;
713    
714      /* Print the heap stats */      /* Print the heap stats */
715      fprintf(stderr, "          Page count (%d KB)\n", PAGE_SIZE / 1024);      fprintf(stderr, "          Page count (%d KB)\n", GC_PAGE_SIZE / 1024);
716      fprintf(stderr,      fprintf(stderr,
717              "   Gen  Boxed Unboxed  LB   LUB    Alloc    Waste    Trigger   WP  GCs Mem-age\n");              "   Gen  Boxed Unboxed  LB   LUB    Alloc    Waste    Trigger   WP  GCs Mem-age\n");
718    
# Line 744  print_generation_stats(int verbose) Line 750  print_generation_stats(int verbose)
750          fprintf(stderr, " %5d: %5d %5d %5d %5d %10d %6d %10d %4d %3d %7.4f\n",          fprintf(stderr, " %5d: %5d %5d %5d %5d %10d %6d %10d %4d %3d %7.4f\n",
751                  i, boxed_cnt, unboxed_cnt, large_boxed_cnt, large_unboxed_cnt,                  i, boxed_cnt, unboxed_cnt, large_boxed_cnt, large_unboxed_cnt,
752                  generations[i].bytes_allocated,                  generations[i].bytes_allocated,
753                  PAGE_SIZE * count_generation_pages(i) -                  GC_PAGE_SIZE * count_generation_pages(i) -
754                  generations[i].bytes_allocated, generations[i].gc_trigger,                  generations[i].bytes_allocated, generations[i].gc_trigger,
755                  count_write_protect_generation_pages(i), generations[i].num_gc,                  count_write_protect_generation_pages(i), generations[i].num_gc,
756                  gen_av_mem_age(i));                  gen_av_mem_age(i));
# Line 987  gc_alloc_new_region(int nbytes, int unbo Line 993  gc_alloc_new_region(int nbytes, int unbo
993    
994              if (!(flags & PAGE_ALLOCATED_MASK)              if (!(flags & PAGE_ALLOCATED_MASK)
995                  || ((flags & mmask) == mflags &&                  || ((flags & mmask) == mflags &&
996                      page_table[first_page].bytes_used < PAGE_SIZE - 32))                      page_table[first_page].bytes_used < GC_PAGE_SIZE - 32))
997                  break;                  break;
998              first_page++;              first_page++;
999          }          }
# Line 1016  gc_alloc_new_region(int nbytes, int unbo Line 1022  gc_alloc_new_region(int nbytes, int unbo
1022           * number of pages in a region.           * number of pages in a region.
1023           */           */
1024          last_page = first_page;          last_page = first_page;
1025          bytes_found = PAGE_SIZE - page_table[first_page].bytes_used;          bytes_found = GC_PAGE_SIZE - page_table[first_page].bytes_used;
1026          num_pages = 1;          num_pages = 1;
1027          while ((bytes_found < nbytes || num_pages < 2)          while ((bytes_found < nbytes || num_pages < 2)
1028                 && last_page < dynamic_space_pages - 1                 && last_page < dynamic_space_pages - 1
1029                 && !PAGE_ALLOCATED(last_page + 1)) {                 && !PAGE_ALLOCATED(last_page + 1)) {
1030              last_page++;              last_page++;
1031              num_pages++;              num_pages++;
1032              bytes_found += PAGE_SIZE;              bytes_found += GC_PAGE_SIZE;
1033              gc_assert(!PAGE_WRITE_PROTECTED(last_page));              gc_assert(!PAGE_WRITE_PROTECTED(last_page));
1034          }          }
1035    
1036          region_size = (PAGE_SIZE - page_table[first_page].bytes_used)          region_size = (GC_PAGE_SIZE - page_table[first_page].bytes_used)
1037              + PAGE_SIZE * (last_page - first_page);              + GC_PAGE_SIZE * (last_page - first_page);
1038    
1039          gc_assert(bytes_found == region_size);          gc_assert(bytes_found == region_size);
1040    
# Line 1107  gc_alloc_new_region(int nbytes, int unbo Line 1113  gc_alloc_new_region(int nbytes, int unbo
1113      if (last_page + 1 > last_free_page) {      if (last_page + 1 > last_free_page) {
1114          last_free_page = last_page + 1;          last_free_page = last_page + 1;
1115          set_alloc_pointer((lispobj) ((char *) heap_base +          set_alloc_pointer((lispobj) ((char *) heap_base +
1116                                       PAGE_SIZE * last_free_page));                                       GC_PAGE_SIZE * last_free_page));
1117    
1118      }      }
1119  }  }
# Line 1168  add_new_area(int first_page, int offset, Line 1174  add_new_area(int first_page, int offset,
1174            gc_abort();            gc_abort();
1175      }      }
1176    
1177      new_area_start = PAGE_SIZE * first_page + offset;      new_area_start = GC_PAGE_SIZE * first_page + offset;
1178    
1179      /*      /*
1180       * Search backwards for a prior area that this follows from.  If       * Search backwards for a prior area that this follows from.  If
1181       * found this will save adding a new area.       * found this will save adding a new area.
1182       */       */
1183      for (i = new_areas_index - 1, c = 0; i >= 0 && c < 8; i--, c++) {      for (i = new_areas_index - 1, c = 0; i >= 0 && c < 8; i--, c++) {
1184          unsigned area_end = PAGE_SIZE * (*new_areas)[i].page          unsigned area_end = GC_PAGE_SIZE * (*new_areas)[i].page
1185              + (*new_areas)[i].offset + (*new_areas)[i].size;              + (*new_areas)[i].offset + (*new_areas)[i].size;
1186    
1187  #if 0  #if 0
# Line 1275  gc_alloc_update_page_tables(int unboxed, Line 1281  gc_alloc_update_page_tables(int unboxed,
1281           */           */
1282          more = 0;          more = 0;
1283          bytes_used = alloc_region->free_pointer - page_address(first_page);          bytes_used = alloc_region->free_pointer - page_address(first_page);
1284          if (bytes_used > PAGE_SIZE) {          if (bytes_used > GC_PAGE_SIZE) {
1285              bytes_used = PAGE_SIZE;              bytes_used = GC_PAGE_SIZE;
1286              more = 1;              more = 1;
1287          }          }
1288          page_table[first_page].bytes_used = bytes_used;          page_table[first_page].bytes_used = bytes_used;
# Line 1303  gc_alloc_update_page_tables(int unboxed, Line 1309  gc_alloc_update_page_tables(int unboxed,
1309              /* Calc. the number of bytes used in this page. */              /* Calc. the number of bytes used in this page. */
1310              more = 0;              more = 0;
1311              bytes_used = alloc_region->free_pointer - page_address(next_page);              bytes_used = alloc_region->free_pointer - page_address(next_page);
1312              if (bytes_used > PAGE_SIZE) {              if (bytes_used > GC_PAGE_SIZE) {
1313                  bytes_used = PAGE_SIZE;                  bytes_used = GC_PAGE_SIZE;
1314                  more = 1;                  more = 1;
1315              }              }
1316              page_table[next_page].bytes_used = bytes_used;              page_table[next_page].bytes_used = bytes_used;
# Line 1450  gc_alloc_large(int nbytes, int unboxed, Line 1456  gc_alloc_large(int nbytes, int unboxed,
1456    
1457                  if (!(flags & PAGE_ALLOCATED_MASK)                  if (!(flags & PAGE_ALLOCATED_MASK)
1458                      || ((flags & mmask) == mflags &&                      || ((flags & mmask) == mflags &&
1459                          page_table[first_page].bytes_used < PAGE_SIZE - 32))                          page_table[first_page].bytes_used < GC_PAGE_SIZE - 32))
1460                      break;                      break;
1461                  first_page++;                  first_page++;
1462              }              }
# Line 1472  gc_alloc_large(int nbytes, int unboxed, Line 1478  gc_alloc_large(int nbytes, int unboxed,
1478  #endif  #endif
1479    
1480          last_page = first_page;          last_page = first_page;
1481          bytes_found = PAGE_SIZE - page_table[first_page].bytes_used;          bytes_found = GC_PAGE_SIZE - page_table[first_page].bytes_used;
1482          num_pages = 1;          num_pages = 1;
1483          while (bytes_found < nbytes          while (bytes_found < nbytes
1484                 && last_page < dynamic_space_pages - 1                 && last_page < dynamic_space_pages - 1
1485                 && !PAGE_ALLOCATED(last_page + 1)) {                 && !PAGE_ALLOCATED(last_page + 1)) {
1486              last_page++;              last_page++;
1487              num_pages++;              num_pages++;
1488              bytes_found += PAGE_SIZE;              bytes_found += GC_PAGE_SIZE;
1489              gc_assert(!PAGE_WRITE_PROTECTED(last_page));              gc_assert(!PAGE_WRITE_PROTECTED(last_page));
1490          }          }
1491    
1492          region_size = (PAGE_SIZE - page_table[first_page].bytes_used)          region_size = (GC_PAGE_SIZE - page_table[first_page].bytes_used)
1493              + PAGE_SIZE * (last_page - first_page);              + GC_PAGE_SIZE * (last_page - first_page);
1494    
1495          gc_assert(bytes_found == region_size);          gc_assert(bytes_found == region_size);
1496    
# Line 1549  gc_alloc_large(int nbytes, int unboxed, Line 1555  gc_alloc_large(int nbytes, int unboxed,
1555       */       */
1556      more = 0;      more = 0;
1557      bytes_used = nbytes + orig_first_page_bytes_used;      bytes_used = nbytes + orig_first_page_bytes_used;
1558      if (bytes_used > PAGE_SIZE) {      if (bytes_used > GC_PAGE_SIZE) {
1559          bytes_used = PAGE_SIZE;          bytes_used = GC_PAGE_SIZE;
1560          more = 1;          more = 1;
1561      }      }
1562      page_table[first_page].bytes_used = bytes_used;      page_table[first_page].bytes_used = bytes_used;
# Line 1573  gc_alloc_large(int nbytes, int unboxed, Line 1579  gc_alloc_large(int nbytes, int unboxed,
1579          PAGE_FLAGS_UPDATE(next_page, mmask, mflags);          PAGE_FLAGS_UPDATE(next_page, mmask, mflags);
1580    
1581          page_table[next_page].first_object_offset =          page_table[next_page].first_object_offset =
1582              orig_first_page_bytes_used - PAGE_SIZE * (next_page - first_page);              orig_first_page_bytes_used - GC_PAGE_SIZE * (next_page - first_page);
1583    
1584          /* Calc. the number of bytes used in this page. */          /* Calc. the number of bytes used in this page. */
1585          more = 0;          more = 0;
1586          bytes_used = nbytes + orig_first_page_bytes_used - byte_cnt;          bytes_used = nbytes + orig_first_page_bytes_used - byte_cnt;
1587          if (bytes_used > PAGE_SIZE) {          if (bytes_used > GC_PAGE_SIZE) {
1588              bytes_used = PAGE_SIZE;              bytes_used = GC_PAGE_SIZE;
1589              more = 1;              more = 1;
1590          }          }
1591          page_table[next_page].bytes_used = bytes_used;          page_table[next_page].bytes_used = bytes_used;
# Line 1601  gc_alloc_large(int nbytes, int unboxed, Line 1607  gc_alloc_large(int nbytes, int unboxed,
1607      if (last_page + 1 > last_free_page) {      if (last_page + 1 > last_free_page) {
1608          last_free_page = last_page + 1;          last_free_page = last_page + 1;
1609          set_alloc_pointer((lispobj) ((char *) heap_base +          set_alloc_pointer((lispobj) ((char *) heap_base +
1610                                       PAGE_SIZE * last_free_page));                                       GC_PAGE_SIZE * last_free_page));
1611      }      }
1612    
1613      return (void *) (page_address(first_page) + orig_first_page_bytes_used);      return (void *) (page_address(first_page) + orig_first_page_bytes_used);
# Line 1955  from_space_p(lispobj obj) Line 1961  from_space_p(lispobj obj)
1961    
1962      return page_index >= 0      return page_index >= 0
1963          && (page_index =          && (page_index =
1964              (unsigned int) page_index / PAGE_SIZE) < dynamic_space_pages              (unsigned int) page_index / GC_PAGE_SIZE) < dynamic_space_pages
1965          && PAGE_GENERATION(page_index) == from_space;          && PAGE_GENERATION(page_index) == from_space;
1966  }  }
1967    
# Line 1966  new_space_p(lispobj obj) Line 1972  new_space_p(lispobj obj)
1972    
1973      return page_index >= 0      return page_index >= 0
1974          && (page_index =          && (page_index =
1975              (unsigned int) page_index / PAGE_SIZE) < dynamic_space_pages              (unsigned int) page_index / GC_PAGE_SIZE) < dynamic_space_pages
1976          && PAGE_GENERATION(page_index) == new_space;          && PAGE_GENERATION(page_index) == new_space;
1977  }  }
1978    
# Line 2164  copy_large_object(lispobj object, int nw Line 2170  copy_large_object(lispobj object, int nw
2170    
2171          next_page = first_page;          next_page = first_page;
2172          remaining_bytes = nwords * sizeof(lispobj);          remaining_bytes = nwords * sizeof(lispobj);
2173          while (remaining_bytes > PAGE_SIZE) {          while (remaining_bytes > GC_PAGE_SIZE) {
2174              gc_assert(PAGE_GENERATION(next_page) == from_space);              gc_assert(PAGE_GENERATION(next_page) == from_space);
2175              gc_assert(PAGE_ALLOCATED(next_page));              gc_assert(PAGE_ALLOCATED(next_page));
2176              gc_assert(!PAGE_UNBOXED(next_page));              gc_assert(!PAGE_UNBOXED(next_page));
2177              gc_assert(PAGE_LARGE_OBJECT(next_page));              gc_assert(PAGE_LARGE_OBJECT(next_page));
2178              gc_assert(page_table[next_page].first_object_offset ==              gc_assert(page_table[next_page].first_object_offset ==
2179                        PAGE_SIZE * (first_page - next_page));                        GC_PAGE_SIZE * (first_page - next_page));
2180              gc_assert(page_table[next_page].bytes_used == PAGE_SIZE);              gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
2181    
2182              PAGE_FLAGS_UPDATE(next_page, PAGE_GENERATION_MASK, new_space);              PAGE_FLAGS_UPDATE(next_page, PAGE_GENERATION_MASK, new_space);
2183    
# Line 2180  copy_large_object(lispobj object, int nw Line 2186  copy_large_object(lispobj object, int nw
2186               * WP flag to avoid redundant calls.               * WP flag to avoid redundant calls.
2187               */               */
2188              if (PAGE_WRITE_PROTECTED(next_page)) {              if (PAGE_WRITE_PROTECTED(next_page)) {
2189                  os_protect((os_vm_address_t) page_address(next_page), PAGE_SIZE,                  os_protect((os_vm_address_t) page_address(next_page), GC_PAGE_SIZE,
2190                             OS_VM_PROT_ALL);                             OS_VM_PROT_ALL);
2191                  page_table[next_page].flags &= ~PAGE_WRITE_PROTECTED_MASK;                  page_table[next_page].flags &= ~PAGE_WRITE_PROTECTED_MASK;
2192              }              }
2193              remaining_bytes -= PAGE_SIZE;              remaining_bytes -= GC_PAGE_SIZE;
2194              next_page++;              next_page++;
2195          }          }
2196    
# Line 2212  copy_large_object(lispobj object, int nw Line 2218  copy_large_object(lispobj object, int nw
2218    
2219          /* Free any remaining pages; needs care. */          /* Free any remaining pages; needs care. */
2220          next_page++;          next_page++;
2221          while (old_bytes_used == PAGE_SIZE &&          while (old_bytes_used == GC_PAGE_SIZE &&
2222                 PAGE_FLAGS(next_page, mmask) == mflags &&                 PAGE_FLAGS(next_page, mmask) == mflags &&
2223                 page_table[next_page].first_object_offset ==                 page_table[next_page].first_object_offset ==
2224                 PAGE_SIZE * (first_page - next_page)) {                 GC_PAGE_SIZE * (first_page - next_page)) {
2225              /*              /*
2226               * Checks out OK, free the page. Don't need to both zeroing               * Checks out OK, free the page. Don't need to both zeroing
2227               * pages as this should have been done before shrinking the               * pages as this should have been done before shrinking the
# Line 2346  copy_large_unboxed_object(lispobj object Line 2352  copy_large_unboxed_object(lispobj object
2352    
2353          next_page = first_page;          next_page = first_page;
2354          remaining_bytes = nwords * sizeof(lispobj);          remaining_bytes = nwords * sizeof(lispobj);
2355          while (remaining_bytes > PAGE_SIZE) {          while (remaining_bytes > GC_PAGE_SIZE) {
2356              gc_assert(PAGE_GENERATION(next_page) == from_space);              gc_assert(PAGE_GENERATION(next_page) == from_space);
2357              gc_assert(PAGE_ALLOCATED(next_page));              gc_assert(PAGE_ALLOCATED(next_page));
2358              gc_assert(PAGE_LARGE_OBJECT(next_page));              gc_assert(PAGE_LARGE_OBJECT(next_page));
2359              gc_assert(page_table[next_page].first_object_offset ==              gc_assert(page_table[next_page].first_object_offset ==
2360                        PAGE_SIZE * (first_page - next_page));                        GC_PAGE_SIZE * (first_page - next_page));
2361              gc_assert(page_table[next_page].bytes_used == PAGE_SIZE);              gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
2362    
2363              PAGE_FLAGS_UPDATE(next_page,              PAGE_FLAGS_UPDATE(next_page,
2364                                PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK,                                PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK,
2365                                PAGE_UNBOXED_MASK | new_space);                                PAGE_UNBOXED_MASK | new_space);
2366              remaining_bytes -= PAGE_SIZE;              remaining_bytes -= GC_PAGE_SIZE;
2367              next_page++;              next_page++;
2368          }          }
2369    
# Line 2385  copy_large_unboxed_object(lispobj object Line 2391  copy_large_unboxed_object(lispobj object
2391    
2392          /* Free any remaining pages; needs care. */          /* Free any remaining pages; needs care. */
2393          next_page++;          next_page++;
2394          while (old_bytes_used == PAGE_SIZE &&          while (old_bytes_used == GC_PAGE_SIZE &&
2395                 PAGE_FLAGS(next_page, mmask) == mflags &&                 PAGE_FLAGS(next_page, mmask) == mflags &&
2396                 page_table[next_page].first_object_offset ==                 page_table[next_page].first_object_offset ==
2397                 PAGE_SIZE * (first_page - next_page)) {                 GC_PAGE_SIZE * (first_page - next_page)) {
2398              /*              /*
2399               * Checks out OK, free the page. Don't need to both zeroing               * Checks out OK, free the page. Don't need to both zeroing
2400               * pages as this should have been done before shrinking the               * pages as this should have been done before shrinking the
# Line 2476  maybe_static_array_p(lispobj header) Line 2482  maybe_static_array_p(lispobj header)
2482        case type_SimpleArrayComplexLongFloat:        case type_SimpleArrayComplexLongFloat:
2483  #endif  #endif
2484            result = TRUE;            result = TRUE;
2485              break;
2486        default:        default:
2487            result = FALSE;            result = FALSE;
2488      }      }
# Line 2540  scavenge(void *start_obj, long nwords) Line 2547  scavenge(void *start_obj, long nwords)
2547              } else {              } else {
2548                  lispobj *ptr = (lispobj *) PTR(object);                  lispobj *ptr = (lispobj *) PTR(object);
2549                  words_scavenged = 1;                  words_scavenged = 1;
2550                  fprintf(stderr, "Not in Lisp spaces:  object = %p, ptr = %p\n", (void*)object, ptr);                  if (debug_static_array_p) {
2551                        fprintf(stderr, "Not in Lisp spaces:  object = %p, ptr = %p\n",
2552                                (void*)object, ptr);
2553                    }
2554    
2555                  if (1) {                  if (1) {
2556                      lispobj header = *ptr;                      lispobj header = *ptr;
2557                      fprintf(stderr, "  Header value = 0x%lx\n", (unsigned long) header);                      if (debug_static_array_p) {
2558                            fprintf(stderr, "  Header value = 0x%lx\n", (unsigned long) header);
2559                        }
2560    
2561                      if (maybe_static_array_p(header)) {                      if (maybe_static_array_p(header)) {
2562                          int static_p;                          int static_p;
2563    
2564                          fprintf(stderr, "Possible static vector at %p.  header = 0x%lx\n",                          if (debug_static_array_p) {
2565                                  ptr, (unsigned long) header);                              fprintf(stderr, "Possible static vector at %p.  header = 0x%lx\n",
2566                                        ptr, (unsigned long) header);
2567                            }
2568    
2569                          static_p = (HeaderValue(header) & 1) == 1;                          static_p = (HeaderValue(header) & 1) == 1;
2570                          if (static_p) {                          if (static_p) {
# Line 2557  scavenge(void *start_obj, long nwords) Line 2573  scavenge(void *start_obj, long nwords)
2573                               * reachable by setting the MSB of the header.                               * reachable by setting the MSB of the header.
2574                               */                               */
2575                              *ptr = header | 0x80000000;                              *ptr = header | 0x80000000;
2576                              fprintf(stderr, "Scavenged static vector @%p, header = 0x%lx\n",                              if (debug_static_array_p) {
2577                                      ptr, (unsigned long) header);                                  fprintf(stderr, "Scavenged static vector @%p, header = 0x%lx\n",
2578                                            ptr, (unsigned long) header);
2579                                }
2580                          }                          }
2581                      }                      }
2582                  }                  }
# Line 2613  static int boxed_registers[] = BOXED_REG Line 2630  static int boxed_registers[] = BOXED_REG
2630      do {                                                                \      do {                                                                \
2631          if (name##_register_pair >= 0) {                                \          if (name##_register_pair >= 0) {                                \
2632              accessor =                                                  \              accessor =                                                  \
2633                  SC_REG(context, name##_register_pair)                   \                  PTR(SC_REG(context, name##_register_pair))              \
2634                  + name##_offset;                                        \                  + name##_offset;                                        \
2635          }                                                               \          }                                                               \
2636      } while (0)      } while (0)
# Line 2653  pair_interior_pointer(os_context_t *cont Line 2670  pair_interior_pointer(os_context_t *cont
2670           * 2010-Jul-14 */           * 2010-Jul-14 */
2671    
2672          if (Pointerp(reg) && (PTR(reg) <= pointer)) {          if (Pointerp(reg) && (PTR(reg) <= pointer)) {
2673              offset = pointer - reg;              offset = pointer - PTR(reg);
2674              if (offset < *saved_offset) {              if (offset < *saved_offset) {
2675                  *saved_offset = offset;                  *saved_offset = offset;
2676                  *register_pair = index;                  *register_pair = index;
# Line 2889  void Line 2906  void
2906  sniff_code_object(struct code *code, unsigned displacement)  sniff_code_object(struct code *code, unsigned displacement)
2907  {  {
2908      int nheader_words, ncode_words, nwords;      int nheader_words, ncode_words, nwords;
2909      void *p;      char *p;
2910      void *constants_start_addr, *constants_end_addr;      char *constants_start_addr, *constants_end_addr;
2911      void *code_start_addr, *code_end_addr;      char *code_start_addr, *code_end_addr;
2912      int fixup_found = 0;      int fixup_found = 0;
2913    
2914      if (!check_code_fixups)      if (!check_code_fixups)
# Line 2915  sniff_code_object(struct code *code, uns Line 2932  sniff_code_object(struct code *code, uns
2932      nheader_words = HeaderValue(*(lispobj *) code);      nheader_words = HeaderValue(*(lispobj *) code);
2933      nwords = ncode_words + nheader_words;      nwords = ncode_words + nheader_words;
2934    
2935      constants_start_addr = (void *) code + 5 * sizeof(lispobj);      constants_start_addr = (char *) code + 5 * sizeof(lispobj);
2936      constants_end_addr = (void *) code + nheader_words * sizeof(lispobj);      constants_end_addr = (char *) code + nheader_words * sizeof(lispobj);
2937      code_start_addr = (void *) code + nheader_words * sizeof(lispobj);      code_start_addr = (char *) code + nheader_words * sizeof(lispobj);
2938      code_end_addr = (void *) code + nwords * sizeof(lispobj);      code_end_addr = (char *) code + nwords * sizeof(lispobj);
2939    
2940      /* Work through the unboxed code. */      /* Work through the unboxed code. */
2941      for (p = code_start_addr; p < code_end_addr; p++) {      for (p = code_start_addr; p < code_end_addr; p++) {
2942          void *data = *(void **) p;          char *data = *(char **) p;
2943          unsigned d1 = *((unsigned char *) p - 1);          unsigned d1 = *((unsigned char *) p - 1);
2944          unsigned d2 = *((unsigned char *) p - 2);          unsigned d2 = *((unsigned char *) p - 2);
2945          unsigned d3 = *((unsigned char *) p - 3);          unsigned d3 = *((unsigned char *) p - 3);
# Line 3096  static void Line 3113  static void
3113  apply_code_fixups(struct code *old_code, struct code *new_code)  apply_code_fixups(struct code *old_code, struct code *new_code)
3114  {  {
3115      int nheader_words, ncode_words, nwords;      int nheader_words, ncode_words, nwords;
3116      void *constants_start_addr, *constants_end_addr;      char *constants_start_addr, *constants_end_addr;
3117      void *code_start_addr, *code_end_addr;      char *code_start_addr, *code_end_addr;
3118      lispobj fixups = NIL;      lispobj fixups = NIL;
3119      unsigned long displacement =      unsigned long displacement =
3120    
# Line 3124  apply_code_fixups(struct code *old_code, Line 3141  apply_code_fixups(struct code *old_code,
3141              "*** Compiled code object at %x: header_words=%d code_words=%d .\n",              "*** Compiled code object at %x: header_words=%d code_words=%d .\n",
3142              new_code, nheader_words, ncode_words);              new_code, nheader_words, ncode_words);
3143  #endif  #endif
3144      constants_start_addr = (void *) new_code + 5 * sizeof(lispobj);      constants_start_addr = (char *) new_code + 5 * sizeof(lispobj);
3145      constants_end_addr = (void *) new_code + nheader_words * sizeof(lispobj);      constants_end_addr = (char *) new_code + nheader_words * sizeof(lispobj);
3146      code_start_addr = (void *) new_code + nheader_words * sizeof(lispobj);      code_start_addr = (char *) new_code + nheader_words * sizeof(lispobj);
3147      code_end_addr = (void *) new_code + nwords * sizeof(lispobj);      code_end_addr = (char *) new_code + nwords * sizeof(lispobj);
3148  #if 0  #if 0
3149      fprintf(stderr,      fprintf(stderr,
3150              "*** Const. start = %x; end= %x; Code start = %x; end = %x\n",              "*** Const. start = %x; end= %x; Code start = %x; end = %x\n",
# Line 3427  scav_closure_header(lispobj * where, lis Line 3444  scav_closure_header(lispobj * where, lis
3444    
3445      closure = (struct closure *) where;      closure = (struct closure *) where;
3446      fun = closure->function - RAW_ADDR_OFFSET;      fun = closure->function - RAW_ADDR_OFFSET;
3447    #if !(defined(i386) && defined(SOLARIS))
3448      scavenge(&fun, 1);      scavenge(&fun, 1);
3449      /* The function may have moved so update the raw address. But don't      /* The function may have moved so update the raw address. But don't
3450         write unnecessarily. */         write unnecessarily. */
3451      if (closure->function != fun + RAW_ADDR_OFFSET)      if (closure->function != fun + RAW_ADDR_OFFSET)
3452          closure->function = fun + RAW_ADDR_OFFSET;          closure->function = fun + RAW_ADDR_OFFSET;
3453    #else
3454        /*
3455         * For some reason, on solaris/x86, we get closures (actually, it
3456         * appears to be funcallable instances where the closure function
3457         * is zero.  I don't know why, but they are.  They don't seem to
3458         * be created anywhere and it doesn't seem to be caused by GC
3459         * transport.
3460         *
3461         * Anyway, we check for zero and skip scavenging if so.
3462         * (Previously, we'd get a segfault scavenging the object at
3463         * address -RAW_ADDR_OFFSET.
3464         */
3465        if (closure->function) {
3466            scavenge(&fun, 1);
3467            /*
3468             * The function may have moved so update the raw address. But don't
3469             * write unnecessarily.
3470             */
3471            if (closure->function != fun + RAW_ADDR_OFFSET) {
3472    #if 0
3473                fprintf(stderr, "closure header 0x%04x moved from %p to %p\n",
3474                        closure->header, (void*) closure->function, (void*) (fun + RAW_ADDR_OFFSET));
3475    #endif
3476                closure->function = fun + RAW_ADDR_OFFSET;
3477            }
3478        }
3479    #if 0
3480         else {
3481            fprintf(stderr, "Weird closure!\n");
3482            fprintf(stderr, " where = %p, object = 0x%04x\n", where, object);
3483            fprintf(stderr, " closure->function = %p, fun = %p\n", closure->function, fun);
3484        }
3485    #endif
3486    #endif
3487      return 2;      return 2;
3488  }  }
3489    
# Line 5829  maybe_adjust_large_object(lispobj * wher Line 5880  maybe_adjust_large_object(lispobj * wher
5880    
5881      next_page = first_page;      next_page = first_page;
5882      remaining_bytes = nwords * sizeof(lispobj);      remaining_bytes = nwords * sizeof(lispobj);
5883      while (remaining_bytes > PAGE_SIZE) {      while (remaining_bytes > GC_PAGE_SIZE) {
5884          gc_assert(PAGE_GENERATION(next_page) == from_space);          gc_assert(PAGE_GENERATION(next_page) == from_space);
5885          gc_assert(PAGE_ALLOCATED(next_page));          gc_assert(PAGE_ALLOCATED(next_page));
5886          gc_assert(PAGE_LARGE_OBJECT(next_page));          gc_assert(PAGE_LARGE_OBJECT(next_page));
5887          gc_assert(page_table[next_page].first_object_offset ==          gc_assert(page_table[next_page].first_object_offset ==
5888                    PAGE_SIZE * (first_page - next_page));                    GC_PAGE_SIZE * (first_page - next_page));
5889          gc_assert(page_table[next_page].bytes_used == PAGE_SIZE);          gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
5890    
5891          PAGE_FLAGS_UPDATE(next_page, PAGE_UNBOXED_MASK,          PAGE_FLAGS_UPDATE(next_page, PAGE_UNBOXED_MASK,
5892                            unboxed << PAGE_UNBOXED_SHIFT);                            unboxed << PAGE_UNBOXED_SHIFT);
# Line 5845  maybe_adjust_large_object(lispobj * wher Line 5896  maybe_adjust_large_object(lispobj * wher
5896           * pages aren't.           * pages aren't.
5897           */           */
5898          gc_assert(!PAGE_WRITE_PROTECTED(next_page));          gc_assert(!PAGE_WRITE_PROTECTED(next_page));
5899          remaining_bytes -= PAGE_SIZE;          remaining_bytes -= GC_PAGE_SIZE;
5900          next_page++;          next_page++;
5901      }      }
5902    
# Line 5873  maybe_adjust_large_object(lispobj * wher Line 5924  maybe_adjust_large_object(lispobj * wher
5924    
5925      /* Free any remaining pages; needs care. */      /* Free any remaining pages; needs care. */
5926      next_page++;      next_page++;
5927      while (old_bytes_used == PAGE_SIZE &&      while (old_bytes_used == GC_PAGE_SIZE &&
5928             PAGE_FLAGS(next_page, mmask) == mflags &&             PAGE_FLAGS(next_page, mmask) == mflags &&
5929             page_table[next_page].first_object_offset == PAGE_SIZE * (first_page             page_table[next_page].first_object_offset == GC_PAGE_SIZE * (first_page
5930                                                                       -                                                                       -
5931                                                                       next_page))                                                                       next_page))
5932      {      {
# Line 5959  preserve_pointer(void *addr) Line 6010  preserve_pointer(void *addr)
6010      while (page_table[first_page].first_object_offset != 0) {      while (page_table[first_page].first_object_offset != 0) {
6011          first_page--;          first_page--;
6012          /* Do some checks */          /* Do some checks */
6013          gc_assert(page_table[first_page].bytes_used == PAGE_SIZE);          gc_assert(page_table[first_page].bytes_used == GC_PAGE_SIZE);
6014          gc_assert(PAGE_GENERATION(first_page) == from_space);          gc_assert(PAGE_GENERATION(first_page) == from_space);
6015          gc_assert(PAGE_ALLOCATED(first_page));          gc_assert(PAGE_ALLOCATED(first_page));
6016          gc_assert(PAGE_UNBOXED(first_page) == region_unboxed);          gc_assert(PAGE_UNBOXED(first_page) == region_unboxed);
# Line 6021  preserve_pointer(void *addr) Line 6072  preserve_pointer(void *addr)
6072          gc_assert(!PAGE_WRITE_PROTECTED(i));          gc_assert(!PAGE_WRITE_PROTECTED(i));
6073    
6074          /* Check if this is the last page in this contiguous block */          /* Check if this is the last page in this contiguous block */
6075          if (page_table[i].bytes_used < PAGE_SIZE          if (page_table[i].bytes_used < GC_PAGE_SIZE
6076              /* Or it is PAGE_SIZE and is the last in the block */              /* Or it is GC_PAGE_SIZE and is the last in the block */
6077              || !PAGE_ALLOCATED(i + 1)              || !PAGE_ALLOCATED(i + 1)
6078              || page_table[i + 1].bytes_used == 0        /* Next page free */              || page_table[i + 1].bytes_used == 0        /* Next page free */
6079              || PAGE_GENERATION(i + 1) != from_space     /* Diff. gen */              || PAGE_GENERATION(i + 1) != from_space     /* Diff. gen */
# Line 6163  update_page_write_prot(unsigned page) Line 6214  update_page_write_prot(unsigned page)
6214          fprintf(stderr, "* WP page %d of gen %d\n", page, gen);          fprintf(stderr, "* WP page %d of gen %d\n", page, gen);
6215  #endif  #endif
6216    
6217          os_protect((os_vm_address_t) page_addr, PAGE_SIZE,          os_protect((os_vm_address_t) page_addr, GC_PAGE_SIZE,
6218                     OS_VM_PROT_READ | OS_VM_PROT_EXECUTE);                     OS_VM_PROT_READ | OS_VM_PROT_EXECUTE);
6219    
6220          /* Note the page as protected in the page tables */          /* Note the page as protected in the page tables */
# Line 6241  scavenge_generation(int generation) Line 6292  scavenge_generation(int generation)
6292               */               */
6293              for (last_page = i;; last_page++)              for (last_page = i;; last_page++)
6294                  /* Check if this is the last page in this contiguous block */                  /* Check if this is the last page in this contiguous block */
6295                  if (page_table[last_page].bytes_used < PAGE_SIZE                  if (page_table[last_page].bytes_used < GC_PAGE_SIZE
6296                      /* Or it is PAGE_SIZE and is the last in the block */                      /* Or it is GC_PAGE_SIZE and is the last in the block */
6297                      || !PAGE_ALLOCATED(last_page + 1)                      || !PAGE_ALLOCATED(last_page + 1)
6298                      || PAGE_UNBOXED(last_page + 1)                      || PAGE_UNBOXED(last_page + 1)
6299                      || page_table[last_page + 1].bytes_used == 0                      || page_table[last_page + 1].bytes_used == 0
# Line 6267  scavenge_generation(int generation) Line 6318  scavenge_generation(int generation)
6318  #endif  #endif
6319                  {                  {
6320                      scavenge(page_address(i), (page_table[last_page].bytes_used                      scavenge(page_address(i), (page_table[last_page].bytes_used
6321                                                 + PAGE_SIZE * (last_page -                                                 + GC_PAGE_SIZE * (last_page -
6322                                                                i)) /                                                                i)) /
6323                               sizeof(lispobj));                               sizeof(lispobj));
6324    
# Line 6374  scavenge_newspace_generation_one_scan(in Line 6425  scavenge_newspace_generation_one_scan(in
6425               */               */
6426              for (last_page = i;; last_page++)              for (last_page = i;; last_page++)
6427                  /* Check if this is the last page in this contiguous block */                  /* Check if this is the last page in this contiguous block */
6428                  if (page_table[last_page].bytes_used < PAGE_SIZE                  if (page_table[last_page].bytes_used < GC_PAGE_SIZE
6429                      /* Or it is PAGE_SIZE and is the last in the block */                      /* Or it is GC_PAGE_SIZE and is the last in the block */
6430                      || !PAGE_ALLOCATED(last_page + 1)                      || !PAGE_ALLOCATED(last_page + 1)
6431                      || PAGE_UNBOXED(last_page + 1)                      || PAGE_UNBOXED(last_page + 1)
6432                      || page_table[last_page + 1].bytes_used == 0                      || page_table[last_page + 1].bytes_used == 0
# Line 6411  scavenge_newspace_generation_one_scan(in Line 6462  scavenge_newspace_generation_one_scan(in
6462                      else                      else
6463                          size =                          size =
6464                              (page_table[last_page].bytes_used +                              (page_table[last_page].bytes_used +
6465                               PAGE_SIZE * (last_page - i) -                               GC_PAGE_SIZE * (last_page - i) -
6466                               page_table[i].first_object_offset) /                               page_table[i].first_object_offset) /
6467                              sizeof(lispobj);                              sizeof(lispobj);
6468    
# Line 6699  unprotect_oldspace(void) Line 6750  unprotect_oldspace(void)
6750               * WP flag to avoid redundant calls.               * WP flag to avoid redundant calls.
6751               */               */
6752              if (PAGE_WRITE_PROTECTED(i)) {              if (PAGE_WRITE_PROTECTED(i)) {
6753                  os_protect((os_vm_address_t) page_start, PAGE_SIZE,                  os_protect((os_vm_address_t) page_start, GC_PAGE_SIZE,
6754                             OS_VM_PROT_ALL);                             OS_VM_PROT_ALL);
6755                  page_table[i].flags &= ~PAGE_WRITE_PROTECTED_MASK;                  page_table[i].flags &= ~PAGE_WRITE_PROTECTED_MASK;
6756              }              }
# Line 6751  free_oldspace(void) Line 6802  free_oldspace(void)
6802                  void *page_start = (void *) page_address(last_page);                  void *page_start = (void *) page_address(last_page);
6803    
6804                  if (PAGE_WRITE_PROTECTED(last_page)) {                  if (PAGE_WRITE_PROTECTED(last_page)) {
6805                      os_protect((os_vm_address_t) page_start, PAGE_SIZE,                      os_protect((os_vm_address_t) page_start, GC_PAGE_SIZE,
6806                                 OS_VM_PROT_ALL);                                 OS_VM_PROT_ALL);
6807                      page_table[last_page].flags &= ~PAGE_WRITE_PROTECTED_MASK;                      page_table[last_page].flags &= ~PAGE_WRITE_PROTECTED_MASK;
6808                  }                  }
# Line 6769  free_oldspace(void) Line 6820  free_oldspace(void)
6820              page_start = page_address(first_page);              page_start = page_address(first_page);
6821    
6822              os_invalidate((os_vm_address_t) page_start,              os_invalidate((os_vm_address_t) page_start,
6823                            PAGE_SIZE * (last_page - first_page));                            GC_PAGE_SIZE * (last_page - first_page));
6824              addr =              addr =
6825                  (char *) os_validate((os_vm_address_t) page_start,                  (char *) os_validate((os_vm_address_t) page_start,
6826                                       PAGE_SIZE * (last_page - first_page));                                       GC_PAGE_SIZE * (last_page - first_page));
6827              if (addr == NULL || addr != page_start)              if (addr == NULL || addr != page_start)
6828                  fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",                  fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",
6829                          (unsigned long) page_start, (unsigned long) addr);                          (unsigned long) page_start, (unsigned long) addr);
# Line 6780  free_oldspace(void) Line 6831  free_oldspace(void)
6831              int *page_start;              int *page_start;
6832    
6833              page_start = (int *) page_address(first_page);              page_start = (int *) page_address(first_page);
6834              memset(page_start, 0, PAGE_SIZE * (last_page - first_page));              memset(page_start, 0, GC_PAGE_SIZE * (last_page - first_page));
6835          }          }
6836    
6837          first_page = last_page;          first_page = last_page;
# Line 7099  verify_generation(int generation) Line 7150  verify_generation(int generation)
7150               */               */
7151              for (last_page = i;; last_page++)              for (last_page = i;; last_page++)
7152                  /* Check if this is the last page in this contiguous block */                  /* Check if this is the last page in this contiguous block */
7153                  if (page_table[last_page].bytes_used < PAGE_SIZE                  if (page_table[last_page].bytes_used < GC_PAGE_SIZE
7154                      /* Or it is PAGE_SIZE and is the last in the block */                      /* Or it is GC_PAGE_SIZE and is the last in the block */
7155                      || !PAGE_ALLOCATED(last_page + 1)                      || !PAGE_ALLOCATED(last_page + 1)
7156                      || PAGE_UNBOXED(last_page + 1) != region_unboxed                      || PAGE_UNBOXED(last_page + 1) != region_unboxed
7157                      || page_table[last_page + 1].bytes_used == 0                      || page_table[last_page + 1].bytes_used == 0
# Line 7110  verify_generation(int generation) Line 7161  verify_generation(int generation)
7161    
7162              verify_space((lispobj *) page_address(i),              verify_space((lispobj *) page_address(i),
7163                           (page_table[last_page].bytes_used +                           (page_table[last_page].bytes_used +
7164                            PAGE_SIZE * (last_page - i)) / sizeof(lispobj));                            GC_PAGE_SIZE * (last_page - i)) / sizeof(lispobj));
7165              i = last_page;              i = last_page;
7166          }          }
7167      }      }
# Line 7134  verify_zero_fill(void) Line 7185  verify_zero_fill(void)
7185                      fprintf(stderr, "** free page not zero @ %lx\n",                      fprintf(stderr, "** free page not zero @ %lx\n",
7186                              (unsigned long) (start_addr + i));                              (unsigned long) (start_addr + i));
7187          } else {          } else {
7188              int free_bytes = PAGE_SIZE - page_table[page].bytes_used;              int free_bytes = GC_PAGE_SIZE - page_table[page].bytes_used;
7189    
7190              if (free_bytes > 0) {              if (free_bytes > 0) {
7191                  unsigned long *start_addr =                  unsigned long *start_addr =
# Line 7200  write_protect_generation_pages(int gener Line 7251  write_protect_generation_pages(int gener
7251    
7252              page_start = (void *) page_address(i);              page_start = (void *) page_address(i);
7253    
7254              os_protect((os_vm_address_t) page_start, PAGE_SIZE,              os_protect((os_vm_address_t) page_start, GC_PAGE_SIZE,
7255                         OS_VM_PROT_READ | OS_VM_PROT_EXECUTE);                         OS_VM_PROT_READ | OS_VM_PROT_EXECUTE);
7256    
7257              /* Note the page as protected in the page tables */              /* Note the page as protected in the page tables */
# Line 7345  garbage_collect_generation(int generatio Line 7396  garbage_collect_generation(int generatio
7396    
7397          fprintf(stderr,          fprintf(stderr,
7398                  "Non-movable pages due to conservative pointers = %d, %d bytes\n",                  "Non-movable pages due to conservative pointers = %d, %d bytes\n",
7399                  num_dont_move_pages, PAGE_SIZE * num_dont_move_pages);                  num_dont_move_pages, GC_PAGE_SIZE * num_dont_move_pages);
7400  #if !(defined(i386) || defined(__x86_64))  #if !(defined(i386) || defined(__x86_64))
7401          /*          /*
7402           * There shouldn't be any non-movable pages because we don't have           * There shouldn't be any non-movable pages because we don't have
# Line 7525  update_dynamic_space_free_pointer(void) Line 7576  update_dynamic_space_free_pointer(void)
7576      last_free_page = last_page + 1;      last_free_page = last_page + 1;
7577    
7578      set_alloc_pointer((lispobj)      set_alloc_pointer((lispobj)
7579                        ((char *) heap_base + PAGE_SIZE * last_free_page));                        ((char *) heap_base + GC_PAGE_SIZE * last_free_page));
7580  }  }
7581    
7582    
# Line 7719  gc_free_heap(void) Line 7770  gc_free_heap(void)
7770              page_start = (void *) page_address(page);              page_start = (void *) page_address(page);
7771    
7772              /* First remove any write protection */              /* First remove any write protection */
7773              os_protect((os_vm_address_t) page_start, PAGE_SIZE, OS_VM_PROT_ALL);              os_protect((os_vm_address_t) page_start, GC_PAGE_SIZE, OS_VM_PROT_ALL);
7774              page_table[page].flags &= ~PAGE_WRITE_PROTECTED_MASK;              page_table[page].flags &= ~PAGE_WRITE_PROTECTED_MASK;
7775    
7776              os_invalidate((os_vm_address_t) page_start, PAGE_SIZE);              os_invalidate((os_vm_address_t) page_start, GC_PAGE_SIZE);
7777              addr =              addr =
7778                  (char *) os_validate((os_vm_address_t) page_start, PAGE_SIZE);                  (char *) os_validate((os_vm_address_t) page_start, GC_PAGE_SIZE);
7779              if (addr == NULL || addr != page_start)              if (addr == NULL || addr != page_start)
7780                  fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",                  fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",
7781                          (unsigned long) page_start, (unsigned long) addr);                          (unsigned long) page_start, (unsigned long) addr);
# Line 7802  gc_init(void) Line 7853  gc_init(void)
7853      heap_base = (void *) DYNAMIC_0_SPACE_START;      heap_base = (void *) DYNAMIC_0_SPACE_START;
7854    
7855      /* The number of pages needed for the dynamic space - rounding up. */      /* The number of pages needed for the dynamic space - rounding up. */
7856      dynamic_space_pages = (dynamic_space_size + (PAGE_SIZE - 1)) / PAGE_SIZE;      dynamic_space_pages = (dynamic_space_size + (GC_PAGE_SIZE - 1)) / GC_PAGE_SIZE;
7857    
7858      page_table =      page_table =
7859          (struct page *) malloc(dynamic_space_pages * sizeof(struct page));          (struct page *) malloc(dynamic_space_pages * sizeof(struct page));
# Line 7881  gencgc_pickup_dynamic(void) Line 7932  gencgc_pickup_dynamic(void)
7932          page_table[page].flags |= PAGE_ALLOCATED_MASK;          page_table[page].flags |= PAGE_ALLOCATED_MASK;
7933          page_table[page].flags &= ~(PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK          page_table[page].flags &= ~(PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK
7934                                      | PAGE_LARGE_OBJECT_MASK);                                      | PAGE_LARGE_OBJECT_MASK);
7935          page_table[page].bytes_used = PAGE_SIZE;          page_table[page].bytes_used = GC_PAGE_SIZE;
7936          page_table[page].first_object_offset =          page_table[page].first_object_offset =
7937              (char *) DYNAMIC_0_SPACE_START - page_address(page);              (char *) DYNAMIC_0_SPACE_START - page_address(page);
7938          addr += PAGE_SIZE;          addr += GC_PAGE_SIZE;
7939          page++;          page++;
7940      }      }
7941      while (addr < alloc_ptr);      while (addr < alloc_ptr);
7942    
7943      generations[0].bytes_allocated = PAGE_SIZE * page;      generations[0].bytes_allocated = GC_PAGE_SIZE * page;
7944      bytes_allocated = PAGE_SIZE * page;      bytes_allocated = GC_PAGE_SIZE * page;
7945    
7946      set_current_region_free((lispobj) boxed_region.free_pointer);      set_current_region_free((lispobj) boxed_region.free_pointer);
7947      set_current_region_end((lispobj) boxed_region.end_addr);      set_current_region_end((lispobj) boxed_region.end_addr);

Legend:
Removed from v.1.107.2.3  
changed lines
  Added in v.1.112

  ViewVC Help
Powered by ViewVC 1.1.5