/[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.27 by moore, Tue Aug 27 22:18:31 2002 UTC revision 1.28 by cracauer, Tue Nov 5 22:45:48 2002 UTC
# Line 48  Line 48 
48   * and only a few rare messages are printed at level 1.   * and only a few rare messages are printed at level 1.
49   */   */
50  unsigned gencgc_verbose = 0;  unsigned gencgc_verbose = 0;
51    unsigned counters_verbose = 0;
52    
53  /*  /*
54   * To enable the use of page protection to help avoid the scavenging   * To enable the use of page protection to help avoid the scavenging
55   * of pages that don't have pointers to younger generations.   * of pages that don't have pointers to younger generations.
56   */   */
57    #ifndef AT_ITA
58  #ifdef __NetBSD__  #ifdef __NetBSD__
59    
60  /* NetBSD on x86 has no way to retrieve the faulting address in the  /* NetBSD on x86 has no way to retrieve the faulting address in the
61   * SIGSEGV handler, so for the moment we can't use page protection. */   * SIGSEGV handler, so for the moment we can't use page protection. */
62  boolean  enable_page_protection = FALSE;  boolean  enable_page_protection = FALSE;
63  #else  #else /* Netbsd */
64  boolean  enable_page_protection = TRUE;  boolean  enable_page_protection = TRUE;
65  #endif  #endif /* Netbsd */
66    
67    #else /* we are ITA */
68    boolean  enable_page_protection = FALSE;
69    #endif /* ITA */
70    
71  /*  /*
72   * Hunt for pointers to old-space, when GCing generations >= verify_gen.   * Hunt for pointers to old-space, when GCing generations >= verify_gen.
# Line 132  boolean enable_pointer_filter = TRUE; Line 139  boolean enable_pointer_filter = TRUE;
139  unsigned long bytes_allocated = 0;  unsigned long bytes_allocated = 0;
140    
141  /*  /*
142     * The total amount of bytes ever allocated.  Not decreased by GC.
143     */
144    
145    volatile unsigned long long bytes_allocated_sum = 0;
146    
147    /*
148   * GC trigger; a value of 0xffffffff represents disabled.   * GC trigger; a value of 0xffffffff represents disabled.
149   */   */
150  unsigned long auto_gc_trigger = 0xffffffff;  unsigned long auto_gc_trigger = 0xffffffff;
# Line 6387  char *alloc(int nbytes) Line 6400  char *alloc(int nbytes)
6400    gc_assert(((unsigned) SymbolValue(CURRENT_REGION_FREE_POINTER) & 0x7) == 0    gc_assert(((unsigned) SymbolValue(CURRENT_REGION_FREE_POINTER) & 0x7) == 0
6401              && (nbytes & 0x7) == 0);              && (nbytes & 0x7) == 0);
6402    
6403      bytes_allocated_sum += nbytes;
6404    
6405    if (SymbolValue(PSEUDO_ATOMIC_ATOMIC)) {    if (SymbolValue(PSEUDO_ATOMIC_ATOMIC)) {
6406      /* Already within a pseudo atomic. */      /* Already within a pseudo atomic. */
6407      void *new_free_pointer;      void *new_free_pointer;
# Line 6469  char *alloc(int nbytes) Line 6484  char *alloc(int nbytes)
6484          do_pending_interrupt();          do_pending_interrupt();
6485          goto retry2;          goto retry2;
6486        }        }
   
6487        return (void *) new_obj;        return (void *) new_obj;
6488      }      }
6489    
# Line 6499  char *alloc(int nbytes) Line 6513  char *alloc(int nbytes)
6513        do_pending_interrupt();        do_pending_interrupt();
6514        goto retry2;        goto retry2;
6515      }      }
   
6516      return result;      return result;
6517    }    }
6518  }  }
# Line 6535  lispobj * component_ptr_from_pc(lispobj Line 6548  lispobj * component_ptr_from_pc(lispobj
6548    
6549    return NULL;    return NULL;
6550  }  }
6551    
6552    /*
6553     * Get lower and upper(middle) 28 bits of total allocation
6554     */
6555    int get_bytes_consed_lower(void)
6556    {
6557      return (int)bytes_allocated_sum & 0xFFFFFFF;
6558    }
6559    
6560    int get_bytes_consed_upper(void)
6561    {
6562      return ((int)bytes_allocated_sum / 0x10000000) & 0xFFFFFFF;
6563    }
6564    
6565    #define current_region_free_pointer SymbolValue(CURRENT_REGION_FREE_POINTER)
6566    #define current_region_end_addr     SymbolValue(CURRENT_REGION_END_ADDR)
6567    
6568    int get_bytes_allocated_lower(void)
6569    {
6570      int size = bytes_allocated;
6571      static int previous = -1;
6572    
6573      if (current_region_end_addr != boxed_region.end_addr) {
6574        fprintf(stderr, "NOT BOXED: %d %d %d\n"
6575                ,current_region_end_addr, boxed_region.end_addr
6576                ,unboxed_region.end_addr);
6577      }
6578    
6579      if (current_region_end_addr == boxed_region.end_addr) {
6580        size += current_region_free_pointer - (int)boxed_region.start_addr;
6581      } else {
6582        size += current_region_free_pointer - (int)unboxed_region.start_addr;
6583      }
6584    
6585      if (counters_verbose)
6586        fprintf(stderr, ">%10d%10d%10d%10d%10d (max%d @0x%X)\n", size
6587                ,previous != -1? size - previous: -1
6588                ,current_region_free_pointer - (int)boxed_region.start_addr
6589                ,(int)boxed_region.free_pointer - (int)boxed_region.start_addr
6590                ,(int)unboxed_region.free_pointer - (int)unboxed_region.start_addr
6591                ,boxed_region.end_addr - (int)boxed_region.start_addr
6592                ,boxed_region.start_addr
6593                );
6594    
6595      previous = size;
6596    
6597      return (int)size & 0xFFFFFFF;
6598    }
6599    
6600    int get_bytes_allocated_upper(void)
6601    {
6602      int size = bytes_allocated;
6603    
6604      if (current_region_end_addr == boxed_region.end_addr) {
6605        size += current_region_free_pointer - (int)boxed_region.start_addr;
6606      } else {
6607        size += current_region_free_pointer - (int)unboxed_region.start_addr;
6608      }
6609      return ((int)size / 0x10000000) & 0xFFFFFFF;
6610    }
6611    
6612    void print_bytes_allocated_sum(void)
6613    {
6614    #if 0
6615      int size;
6616      /*
6617                  gc_alloc_update_page_tables(0, &);
6618                  gc_alloc_update_page_tables(1, &unboxed_region);
6619      */
6620    
6621      size = bytes_allocated;
6622    
6623      if (current_region_end_addr == boxed_region.end_addr) {
6624        size += current_region_free_pointer - boxed_region.start_addr;
6625        size += unboxed_region.free_pointer - unboxed_region.start_addr;
6626      } else {
6627        size += current_region_free_pointer - unboxed_region.start_addr;
6628        size += boxed_region.free_pointer - boxed_region.start_addr;
6629      }
6630      fprintf(stdout, "manually counted: %10d %10d %10d\n"
6631              , size, size - bytes_allocated, size - bytes_allocated_sum);
6632    
6633      /*
6634      fprintf(stdout, "%llu -> %d / %d\n", bytes_allocated_sum
6635              ,get_bytes_consed_upper(), get_bytes_consed_lower());
6636      fprintf(stdout, "0x%llX -> 0x%x / 0x%x\n", bytes_allocated_sum
6637              ,get_bytes_consed_upper(), get_bytes_consed_lower());
6638      */
6639    #endif
6640    }

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.5