Changeset 7137


Ignore:
Timestamp:
Sep 5, 2007, 1:08:47 AM (12 years ago)
Author:
gb
Message:

Lose "HeapHighWaterMark?", which was supposed to allow us to track the
high end of a range of pages that'd been written to and not freed (so
we'd zero them lazily when they were reallocated.) Such a scheme would
really need to track both ends of such a range, and the old scheme wound
up being overly zealous and often zeroed pages that were already zeroed.
Zero the range between the old free pointer and the new one after each
GC, instead.

At least partly address ticket:101, by doing GROW-DYNAMIC-AREA more
carefully.

Location:
trunk/ccl/lisp-kernel
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/gc.h

    r4579 r7137  
    5454
    5555
    56 extern BytePtr HeapHighWaterMark; /* highest zeroed dynamic address  */
     56extern void zero_memory_range(BytePtr,BytePtr);
    5757extern LispObj GCarealow, GCareadynamiclow;
    5858extern natural GCndnodes_in_area, GCndynamic_dnodes_in_area;
  • trunk/ccl/lisp-kernel/memory.c

    r4545 r7137  
    176176
    177177
     178void
     179zero_memory_range(BytePtr start, BytePtr end)
     180{
     181  bzero(start,end-start);
     182}
     183
    178184
    179185 
     
    190196{
    191197  extern int page_size;
    192   natural protbytes, zerobytes;
    193198  area *a = active_dynamic_area;
    194199  BytePtr newlimit, protptr, zptr;
    195200  int psize = page_size;
    196   /*
    197      Zero the region between the new freepointer and the end of the
    198      containing segment.
    199   */
    200   zptr = (BytePtr) align_to_power_of_2(newfree,log2_heap_segment_size);
    201   zerobytes = zptr-newfree;
    202   HeapHighWaterMark = zptr;
    203 
    204   while (zerobytes >= psize) {
    205     zptr -= psize;
    206     zerobytes -= psize;
    207     zero_page(zptr);
    208   }
    209  
    210   if (zerobytes) {
    211     bzero(newfree, zerobytes);
    212   }
    213201  if (free_space_size) {
    214202    BytePtr lowptr = a->active;
     
    217205    if (newlimit > a->high) {
    218206      return grow_dynamic_area(newlimit-a->high);
    219     } else if ((HeapHighWaterMark + free_space_size) < a->high) {
     207    } else if ((lowptr + free_space_size) < a->high) {
    220208      shrink_dynamic_area(a->high-newlimit);
    221209      return true;
  • trunk/ccl/lisp-kernel/pmcl-kernel.c

    r6902 r7137  
    408408*/
    409409
    410 BytePtr
    411 HeapHighWaterMark = NULL;
    412 
    413410void
    414411uncommit_pages(void *start, size_t len)
     
    427424    }
    428425  }
    429   if (HeapHighWaterMark > (BytePtr) start) {
    430     HeapHighWaterMark = start;
    431   }
    432426}
    433427
     
    468462      if (addr == start) {
    469463        if (touch_all_pages(start, len)) {
    470           HeapHighWaterMark = ((BytePtr)start) + len;
    471464          return true;
    472465        }
     
    701694}
    702695
     696
    703697void *
    704698allocate_from_reserved_area(natural size)
     
    783777    return false;
    784778  }
     779
     780  if (!commit_pages(a->high,delta)) {
     781    return false;
     782  }
     783
     784
    785785  if (!allocate_from_reserved_area(delta)) {
    786786    return false;
    787787  }
    788   /*
    789     commit_pages(a->high,delta);
    790   */
    791   commit_pages(HeapHighWaterMark,(a->high+delta)-HeapHighWaterMark);
     788
    792789
    793790  a->high += delta;
  • trunk/ccl/lisp-kernel/ppc-exceptions.c

    r6546 r7137  
    597597  xpGPR(xp,allocbase) = (LispObj) oldlimit;
    598598
    599   while (HeapHighWaterMark < (BytePtr)newlimit) {
    600     zero_page(HeapHighWaterMark);
    601     HeapHighWaterMark+=page_size;
    602   }
    603599  return true;
    604600}
  • trunk/ccl/lisp-kernel/ppc-gc.c

    r6393 r7137  
    27392739    }
    27402740
     2741    zero_memory_range(a->active, oldfree);
     2742
    27412743    resize_dynamic_heap(a->active,
    27422744                        (GCephemeral_low == 0) ? lisp_heap_gc_threshold : 0);
  • trunk/ccl/lisp-kernel/x86-exceptions.c

    r6908 r7137  
    9999  tcr->save_allocbase = (void *) oldlimit;
    100100
    101   while (HeapHighWaterMark < (BytePtr)newlimit) {
    102     zero_page(HeapHighWaterMark);
    103     HeapHighWaterMark+=page_size;
    104   }
    105101  return true;
    106102}
  • trunk/ccl/lisp-kernel/x86-gc.c

    r6528 r7137  
    26532653    }
    26542654
     2655    zero_memory_range(a->active, oldfree);
     2656
    26552657    resize_dynamic_heap(a->active,
    26562658                        (GCephemeral_low == 0) ? lisp_heap_gc_threshold : 0);
Note: See TracChangeset for help on using the changeset viewer.