/[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.34 by toy, Wed Aug 27 16:00:35 2003 UTC revision 1.34.2.1 by gerd, Wed Sep 3 11:32:06 2003 UTC
# Line 398  static int count_dont_move_pages(void) Line 398  static int count_dont_move_pages(void)
398    return cnt;    return cnt;
399  }  }
400    
401    
402    #if defined(sparc)
403  /*  /*
404   * Work through the pages and add up the number of bytes used for the   * Work through the pages and add up the number of bytes used for the
405   * given generation.   * given generation.
# Line 417  static int generation_bytes_allocated (i Line 419  static int generation_bytes_allocated (i
419    }    }
420    return bytes_allocated;    return bytes_allocated;
421  }  }
422    #endif
423    
424    
425  /*  /*
426   * Return the average age of the memory in a generation.   * Return the average age of the memory in a generation.
# Line 496  void print_generation_stats(int  verbose Line 500  void print_generation_stats(int  verbose
500      }      }
501    
502      gc_assert(generations[i].bytes_allocated == generation_bytes_allocated(i));      gc_assert(generations[i].bytes_allocated == generation_bytes_allocated(i));
503      fprintf(stderr, "   %8d: %5d %5d %5d %5d %8d %5d %8d %4d %3d %7.4f\n",      fprintf(stderr, "   %8d: %5d %5d %5d %5d %8d %5ld %8d %4d %3d %7.4f\n",
504              i, boxed_cnt, unboxed_cnt, large_boxed_cnt, large_unboxed_cnt,              i, boxed_cnt, unboxed_cnt, large_boxed_cnt, large_unboxed_cnt,
505              generations[i].bytes_allocated,              generations[i].bytes_allocated,
506              PAGE_SIZE * count_generation_pages(i) -              (long)PAGE_SIZE * count_generation_pages(i) -
507              generations[i].bytes_allocated,              generations[i].bytes_allocated,
508              generations[i].gc_trigger,              generations[i].gc_trigger,
509              count_write_protect_generation_pages(i),              count_write_protect_generation_pages(i),
# Line 771  static void gc_alloc_new_region(int nbyt Line 775  static void gc_alloc_new_region(int nbyt
775      for(p = (int *)alloc_region->start_addr;      for(p = (int *)alloc_region->start_addr;
776          p < (int *)alloc_region->end_addr; p++)          p < (int *)alloc_region->end_addr; p++)
777        if (*p != 0)        if (*p != 0)
778          fprintf(stderr, "** new region not zero @ %lx\n", (unsigned long) p);          fprintf(stderr, "** new region not zero @ %p\n", p);
779    }    }
780    
781    /* Setup the pages. */    /* Setup the pages. */
# Line 2283  void sniff_code_object(struct code *code Line 2287  void sniff_code_object(struct code *code
2287        /* Push imm32 */        /* Push imm32 */
2288        if (d1 == 0x68) {        if (d1 == 0x68) {
2289          fixup_found = 1;          fixup_found = 1;
2290          fprintf(stderr, "Code ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Code ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2291                  (unsigned long) p, d6,d5,d4,d3,d2,d1,                  p, d6,d5,d4,d3,d2,d1,
2292                  (unsigned long) data);                  (unsigned long) data);
2293          fprintf(stderr, "***  Push $0x%.8lx\n", (unsigned long) data);          fprintf(stderr, "***  Push $0x%.8lx\n", (unsigned long) data);
2294        }        }
# Line 2294  void sniff_code_object(struct code *code Line 2298  void sniff_code_object(struct code *code
2298                || d2 == 0x45 || d2 == 0x46 || d2 == 0x47)                || d2 == 0x45 || d2 == 0x46 || d2 == 0x47)
2299            && d1 == 0xf8) {            && d1 == 0xf8) {
2300          fixup_found = 1;          fixup_found = 1;
2301          fprintf(stderr, "Code ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Code ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2302                  (unsigned long) p, d6,d5,d4,d3,d2,d1, (unsigned long) data);                  p, d6,d5,d4,d3,d2,d1, (unsigned long) data);
2303          fprintf(stderr, "***  Mov [reg-8],$0x%.8lx\n", (unsigned long) data);          fprintf(stderr, "***  Mov [reg-8],$0x%.8lx\n", (unsigned long) data);
2304        }        }
2305        /* Lea reg, [disp32] */        /* Lea reg, [disp32] */
2306        if (d2 == 0x8d && (d1 & 0xc7) == 5) {        if (d2 == 0x8d && (d1 & 0xc7) == 5) {
2307          fixup_found = 1;          fixup_found = 1;
2308          fprintf(stderr, "Code ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Code ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2309                  (unsigned long) p, d6,d5,d4,d3,d2,d1, (unsigned long) data);                  p, d6,d5,d4,d3,d2,d1, (unsigned long) data);
2310          fprintf(stderr, "***  Lea reg,[$0x%.8lx]\n", (unsigned long) data);          fprintf(stderr, "***  Lea reg,[$0x%.8lx]\n", (unsigned long) data);
2311        }        }
2312      }      }
# Line 2320  void sniff_code_object(struct code *code Line 2324  void sniff_code_object(struct code *code
2324        /*  Mov eax,m32 */        /*  Mov eax,m32 */
2325        if (d1 == 0xa1) {        if (d1 == 0xa1) {
2326          fixup_found = 1;          fixup_found = 1;
2327          fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2328                  (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                  p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2329          fprintf(stderr, "***  Mov eax,0x%.8lx\n", (unsigned long) data);          fprintf(stderr, "***  Mov eax,0x%.8lx\n", (unsigned long) data);
2330        }        }
2331    
2332        /*  Mov m32,eax */        /*  Mov m32,eax */
2333        if (d1 == 0xa3) {        if (d1 == 0xa3) {
2334          fixup_found = 1;          fixup_found = 1;
2335          fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2336                  (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                  p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2337          fprintf(stderr, "***  Mov 0x%.8lx,eax\n", (unsigned long) data);          fprintf(stderr, "***  Mov 0x%.8lx,eax\n", (unsigned long) data);
2338        }        }
2339    
2340        /* Cmp m32,imm32 */        /* Cmp m32,imm32 */
2341        if (d1 == 0x3d && d2 == 0x81) {        if (d1 == 0x3d && d2 == 0x81) {
2342          fixup_found = 1;          fixup_found = 1;
2343          fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",          fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2344                  (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                  p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2345          /* XX Check this */          /* XX Check this */
2346          fprintf(stderr, "***  Cmp 0x%.8lx,immed32\n", (unsigned long) data);          fprintf(stderr, "***  Cmp 0x%.8lx,immed32\n", (unsigned long) data);
2347        }        }
# Line 2347  void sniff_code_object(struct code *code Line 2351  void sniff_code_object(struct code *code
2351          /* Cmp m32,reg */          /* Cmp m32,reg */
2352          if (d2 == 0x39) {          if (d2 == 0x39) {
2353            fixup_found = 1;            fixup_found = 1;
2354            fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",            fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2355                    (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                    p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2356            fprintf(stderr, "***  Cmp 0x%.8lx,reg\n", (unsigned long) data);            fprintf(stderr, "***  Cmp 0x%.8lx,reg\n", (unsigned long) data);
2357          }          }
2358          /* Cmp reg32,m32 */          /* Cmp reg32,m32 */
2359          if (d2 == 0x3b) {          if (d2 == 0x3b) {
2360            fixup_found = 1;            fixup_found = 1;
2361            fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",            fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2362                    (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                    p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2363            fprintf(stderr, "***  Cmp reg32,0x%.8lx\n", (unsigned long) data);            fprintf(stderr, "***  Cmp reg32,0x%.8lx\n", (unsigned long) data);
2364          }          }
2365          /* Mov m32,reg32 */          /* Mov m32,reg32 */
2366          if (d2 == 0x89) {          if (d2 == 0x89) {
2367            fixup_found = 1;            fixup_found = 1;
2368            fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",            fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2369                    (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                    p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2370            fprintf(stderr, "***  Mov 0x%.8lx,reg32\n", (unsigned long) data);            fprintf(stderr, "***  Mov 0x%.8lx,reg32\n", (unsigned long) data);
2371          }          }
2372          /* Mov reg32,m32 */          /* Mov reg32,m32 */
2373          if (d2 == 0x8b) {          if (d2 == 0x8b) {
2374            fixup_found = 1;            fixup_found = 1;
2375            fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",            fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2376                    (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                    p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2377            fprintf(stderr, "***  Mov reg32,0x%.8lx\n", (unsigned long) data);            fprintf(stderr, "***  Mov reg32,0x%.8lx\n", (unsigned long) data);
2378          }          }
2379          /* Lea reg32,m32 */          /* Lea reg32,m32 */
2380          if (d2 == 0x8d) {          if (d2 == 0x8d) {
2381            fixup_found = 1;            fixup_found = 1;
2382            fprintf(stderr, "Abs. const. ref. @ %lx: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",            fprintf(stderr, "Abs. const. ref. @ %p: %.2x %.2x %.2x %.2x %.2x %.2x (%.8lx)\n",
2383                    (unsigned long) p, d6, d5, d4, d3, d2, d1, (unsigned long) data);                    p, d6, d5, d4, d3, d2, d1, (unsigned long) data);
2384            fprintf(stderr, "***  Lea reg32,0x%.8lx\n", (unsigned long) data);            fprintf(stderr, "***  Lea reg32,0x%.8lx\n", (unsigned long) data);
2385          }          }
2386        }        }
# Line 2385  void sniff_code_object(struct code *code Line 2389  void sniff_code_object(struct code *code
2389    
2390    /* If anything was found print out some info. on the code object. */    /* If anything was found print out some info. on the code object. */
2391    if (fixup_found) {    if (fixup_found) {
2392      fprintf(stderr, "*** Compiled code object at %lx: header_words=%d code_words=%d .\n",      fprintf(stderr, "*** Compiled code object at %p: header_words=%d code_words=%d .\n",
2393              (unsigned long) code, nheader_words, ncode_words);              code, nheader_words, ncode_words);
2394      fprintf(stderr, "*** Const. start = %lx; end= %lx; Code start = %lx; end = %lx\n",      fprintf(stderr, "*** Const. start = %p; end= %p; Code start = %p; end = %p\n",
2395              (unsigned long) constants_start_addr, (unsigned long) constants_end_addr,              constants_start_addr, constants_end_addr, code_start_addr, code_end_addr);
             (unsigned long) code_start_addr, (unsigned long) code_end_addr);  
2396    }    }
2397  }  }
2398    
# Line 2669  static int size_code_header(lispobj *whe Line 2672  static int size_code_header(lispobj *whe
2672  }  }
2673    
2674    
2675    #ifndef i386
2676  static int scav_return_pc_header(lispobj *where, lispobj object)  static int scav_return_pc_header(lispobj *where, lispobj object)
2677  {  {
2678      fprintf(stderr, "GC lossage.  Should not be scavenging a ");      fprintf(stderr, "GC lossage.  Should not be scavenging a ");
2679      fprintf(stderr, "Return PC Header.\n");      fprintf(stderr, "Return PC Header.\n");
2680      fprintf(stderr, "where = 0x%08lx, object = 0x%08lx",      fprintf(stderr, "where = %p, object = %p", where, object);
             (unsigned long) where, (unsigned long) object);  
2681      lose(NULL);      lose(NULL);
2682      return 0;      return 0;
2683  }  }
2684    #endif
2685    
2686    
2687  static lispobj trans_return_pc_header(lispobj object)  static lispobj trans_return_pc_header(lispobj object)
2688  {  {
# Line 2718  static int scav_closure_header(lispobj * Line 2723  static int scav_closure_header(lispobj *
2723  }  }
2724  #endif  #endif
2725    
2726    
2727    #ifndef i386
2728  static int scav_function_header(lispobj *where, lispobj object)  static int scav_function_header(lispobj *where, lispobj object)
2729  {  {
2730      fprintf(stderr, "GC lossage.  Should not be scavenging a ");      fprintf(stderr, "GC lossage.  Should not be scavenging a ");
2731      fprintf(stderr, "Function Header.\n");      fprintf(stderr, "Function Header.\n");
2732      fprintf(stderr, "where = 0x%08lx, object = 0x%08lx",      fprintf(stderr, "where = %p, object = %p", where, object);
             (unsigned long) where, (unsigned long) object);  
2733      lose(NULL);      lose(NULL);
2734      return 0;      return 0;
2735  }  }
2736    #endif
2737    
2738  static lispobj trans_function_header(lispobj object)  static lispobj trans_function_header(lispobj object)
2739  {  {
# Line 4200  static lispobj trans_lose(lispobj object Line 4207  static lispobj trans_lose(lispobj object
4207    
4208  static int size_lose(lispobj *where)  static int size_lose(lispobj *where)
4209  {  {
4210          fprintf(stderr, "Size lossage.  No size function for object at 0x%08lx\n",          fprintf(stderr, "Size lossage.  No size function for object at %p\n", where);
4211                  (unsigned long) where);          fprintf(stderr, "First word of object: 0x%08lx\n", (unsigned long) *where);
         fprintf(stderr, "First word of object: 0x%08lx\n",  
                 (unsigned long) *where);  
4212          return 1;          return 1;
4213  }  }
4214    
# Line 4969  static void preserve_pointer(void *addr) Line 4974  static void preserve_pointer(void *addr)
4974          || page_table[addr_page_index].bytes_used == 0          || page_table[addr_page_index].bytes_used == 0
4975          /* Check the offset within the page */          /* Check the offset within the page */
4976          || ((int) addr & 0xfff) > page_table[addr_page_index].bytes_used) {          || ((int) addr & 0xfff) > page_table[addr_page_index].bytes_used) {
4977        fprintf(stderr, "*W ignore pointer 0x%lx to freed area of large object\n",        fprintf(stderr, "*W ignore pointer %p to freed area of large object\n",
4978                (unsigned long) addr);                addr);
4979        return;        return;
4980      }      }
4981      /* May have moved to unboxed pages. */      /* May have moved to unboxed pages. */
# Line 5663  static int free_oldspace(void) Line 5668  static int free_oldspace(void)
5668        os_invalidate(page_start, PAGE_SIZE * (last_page - first_page));        os_invalidate(page_start, PAGE_SIZE * (last_page - first_page));
5669        addr = os_validate(page_start, PAGE_SIZE * (last_page - first_page));        addr = os_validate(page_start, PAGE_SIZE * (last_page - first_page));
5670        if(addr == NULL || addr != page_start)        if(addr == NULL || addr != page_start)
5671          fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",          fprintf(stderr, "gc_zero: page moved, %p ==> %p!\n",
5672                  (unsigned long) page_start, (unsigned long) addr);                  page_start, addr);
5673      } else {      } else {
5674        int *page_start;        int *page_start;
5675    
# Line 5689  static void print_ptr(lispobj *addr) Line 5694  static void print_ptr(lispobj *addr)
5694    int pi1 = find_page_index((void*) addr);    int pi1 = find_page_index((void*) addr);
5695    
5696    if(pi1 != -1)    if(pi1 != -1)
5697      fprintf(stderr, "  %lx: page %d  alloc %d unboxed %d gen %d  bytes_used %d  offset %d  dont_move %d\n",      fprintf(stderr, "  %p: page %d  alloc %d unboxed %d gen %d  bytes_used %d  offset %d  dont_move %d\n",
5698              (unsigned long) addr, pi1,              addr, pi1,
5699              PAGE_ALLOCATED(pi1),              PAGE_ALLOCATED(pi1),
5700              PAGE_UNBOXED(pi1),              PAGE_UNBOXED(pi1),
5701              PAGE_GENERATION(pi1),              PAGE_GENERATION(pi1),
# Line 6149  static void    garbage_collect_generation(i Line 6154  static void    garbage_collect_generation(i
6154    
6155    if (gencgc_verbose > 1) {    if (gencgc_verbose > 1) {
6156      int num_dont_move_pages = count_dont_move_pages();      int num_dont_move_pages = count_dont_move_pages();
6157      fprintf(stderr, "Non-movable pages due to conservative pointers = %d, %d bytes\n",      fprintf(stderr, "Non-movable pages due to conservative pointers = %d, %ld bytes\n",
6158              num_dont_move_pages, PAGE_SIZE * num_dont_move_pages);              num_dont_move_pages, (long)PAGE_SIZE * num_dont_move_pages);
6159  #ifndef i386  #ifndef i386
6160      /*      /*
6161       * 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 6541  void   gc_free_heap(void) Line 6546  void   gc_free_heap(void)
6546        os_invalidate(page_start, PAGE_SIZE);        os_invalidate(page_start, PAGE_SIZE);
6547        addr = os_validate(page_start, PAGE_SIZE);        addr = os_validate(page_start, PAGE_SIZE);
6548        if(addr == NULL || addr != page_start)        if(addr == NULL || addr != page_start)
6549          fprintf(stderr, "gc_zero: page moved, 0x%08lx ==> 0x%08lx!\n",          fprintf(stderr, "gc_zero: page moved, %p ==> %p!\n", page_start, addr);
                 (unsigned long) page_start, (unsigned long) addr);  
6550      } else if (gencgc_zero_check_during_free_heap && page < 16384) {      } else if (gencgc_zero_check_during_free_heap && page < 16384) {
6551        int *page_start;        int *page_start;
6552        unsigned i;        unsigned i;
# Line 6555  void   gc_free_heap(void) Line 6559  void   gc_free_heap(void)
6559    
6560        for(i = 0; i < 1024; i++)        for(i = 0; i < 1024; i++)
6561          if (page_start[i] != 0)          if (page_start[i] != 0)
6562            fprintf(stderr, "** Free region not zero @ %lx\n",            fprintf(stderr, "** Free region not zero @ %p\n", (page_start + i));
                   (unsigned long) (page_start + i));  
6563      }      }
6564    
6565    bytes_allocated = 0;    bytes_allocated = 0;
# Line 6912  int get_bytes_allocated_lower(void) Line 6915  int get_bytes_allocated_lower(void)
6915    static int previous = -1;    static int previous = -1;
6916    
6917    if (current_region_end_addr != boxed_region.end_addr) {    if (current_region_end_addr != boxed_region.end_addr) {
6918      fprintf(stderr, "NOT BOXED: %lx %lx %lx\n",      fprintf(stderr, "NOT BOXED: %p %p %p\n",
6919              (unsigned long) current_region_end_addr,              current_region_end_addr,
6920              (unsigned long) boxed_region.end_addr,              boxed_region.end_addr,
6921              (unsigned long) unboxed_region.end_addr);              unboxed_region.end_addr);
6922    }    }
6923    
6924    if (current_region_end_addr == boxed_region.end_addr) {    if (current_region_end_addr == boxed_region.end_addr) {

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.34.2.1

  ViewVC Help
Powered by ViewVC 1.1.5