Changeset 7303


Ignore:
Timestamp:
Sep 26, 2007, 9:57:37 AM (12 years ago)
Author:
gb
Message:

More heap-freezing changes.

Location:
branches/working-0709/ccl/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0709/ccl/lisp-kernel/image.c

    r6215 r7303  
    211211
    212212    a->static_dnodes = sect->static_dnodes;
    213     if (a->static_dnodes) {
    214       natural pages_size = (align_to_power_of_2((align_to_power_of_2(a->static_dnodes,
    215                                                                      log2_nbits_in_word)>>3),
    216                                                 log2_page_size));
    217       lseek(fd,pos+mem_size, SEEK_SET);
    218       pos = seek_to_next_page(fd);
    219       addr = mmap(NULL,
    220                   pages_size,
    221                   PROT_READ | PROT_WRITE,
    222                   MAP_PRIVATE,
    223                   fd,
    224                   pos);
    225       if (addr == MAP_FAILED) {
    226         return;
    227       }
    228       a->static_used = addr;
    229       advance = pages_size;
    230     }
    231213    sect->area = a;
    232214    break;
     
    477459    case FWDNUM:
    478460    case GC_NUM:
    479     case DELETED_STATIC_PAIRS:
     461    case STATIC_CONSES:
    480462      break;
    481463    default:
     
    503485        return errno;
    504486      }
    505       if (nstatic) {
    506         /* Need to write the static_used bitmap */
    507         natural static_used_size_in_bytes =
    508           (align_to_power_of_2((align_to_power_of_2(nstatic, log2_nbits_in_word)>>3),
    509                                log2_page_size));
    510         seek_to_next_page(fd);
    511         if (write(fd, tenured_area->static_used, static_used_size_in_bytes)
    512             != static_used_size_in_bytes) {
    513           return errno;
    514         }
    515       }
    516487    }
    517488  }
  • branches/working-0709/ccl/lisp-kernel/lisp_globals.h

    r6901 r7303  
    3333#define TCR_AREA_LOCK (-11)       /* all_areas/tcr queue lock */
    3434#define EXCEPTION_LOCK (-12)    /* serialize exception handling */
    35 #define DELETED_STATIC_PAIRS (-13) /* for hash-consing */
     35#define STATIC_CONSES (-13)
    3636#define DEFAULT_ALLOCATION_QUANTUM (-14)
    3737#define INTFLAG (-15)
  • branches/working-0709/ccl/lisp-kernel/x86-exceptions.c

    r7296 r7303  
    237237      fatal_oserr(": save_application", err);
    238238    }
    239     switch {salector) {
     239    switch (selector) {
    240240    case GC_TRAP_FUNCTION_SET_HONS_AREA_SIZE:
    241241      xpGPR(xp, Iimm0) = 0;
     
    243243    case GC_TRAP_FUNCTION_FREEZE:
    244244      a->active = (BytePtr) align_to_power_of_2(a->active, log2_page_size);
    245       static_area->static_dnodes = area_dnode(a->active, a->low);
    246       xpGPR(xp, Iimm0) = static_area->static_dnodes;
     245      tenured_area->static_dnodes = area_dnode(a->active, a->low);
     246      xpGPR(xp, Iimm0) = tenured_area->static_dnodes << dnode_shift;
    247247      break;
    248248    default:
     
    18971897
    18981898int
    1899 change_hons_area_size_from_xp(ExceptionInformation *xp, signed_natural delta_in_bytes)
    1900 {
    1901   return gc_like_from_xp(xp, change_hons_area_size, delta_in_bytes);
    1902 }
    1903 
    1904 int
    19051899purify_from_xp(ExceptionInformation *xp, signed_natural param)
    19061900{
  • branches/working-0709/ccl/lisp-kernel/x86-gc.c

    r7296 r7303  
    21122112}
    21132113
    2114 void
    2115 forward_and_resolve_static_references(area *a)
    2116 {
    2117   natural
    2118     nstatic = static_dnodes_for_area(a),
    2119     nstatic_bitmap_words = nstatic >> bitmap_shift;
    2120   if (nstatic != 0) {
    2121     /* exploit the fact that a cons is the same size as a dnode. */
    2122     cons *pagelet_start = (cons *) a->low, *work;
    2123     bitvector markbits = GCmarkbits,
    2124       usedbits = tenured_area->static_used;
    2125     natural marked, used, used_but_not_marked, ndeleted = 0, i;
    2126 
    2127     while (nstatic_bitmap_words--) {
    2128       marked = *markbits++;
    2129       used = *usedbits;
    2130       if (marked != used) {
    2131         *usedbits = marked;
    2132       }
    2133       used |= marked;
    2134       used_but_not_marked = used & ~marked;
    2135 
    2136       while (marked) {
    2137         i = count_leading_zeros(marked);
    2138         marked &= ~(BIT0_MASK >> i);
    2139         work = pagelet_start+i;
    2140         update_noderef(&work->cdr);
    2141         update_noderef(&work->car);
    2142       }
    2143 
    2144       while (used_but_not_marked) {
    2145         i = count_leading_zeros(used_but_not_marked);
    2146         used_but_not_marked &= ~(BIT0_MASK >> i);
    2147         work = pagelet_start+i;
    2148         if ((work->cdr != undefined) &&
    2149             (work->cdr != slot_unbound)) {
    2150           work->car = slot_unbound;
    2151           work->cdr = slot_unbound;
    2152           ndeleted++;
    2153         }
    2154       }
    2155       usedbits++;
    2156       pagelet_start += nbits_in_word;
    2157     }
    2158     lisp_global(DELETED_STATIC_PAIRS) += box_fixnum(ndeleted);
    2159   }
    2160 }
     2114
    21612115
    21622116
     
    23242278}
    23252279
     2280void
     2281reclaim_static_dnodes()
     2282{
     2283  natural nstatic = tenured_area->static_dnodes, i, bits, mask, bitnum;
     2284  cons *c = (cons *)tenured_area->low, *d;
     2285  bitvector bitsp = GCmarkbits;
     2286  LispObj head = lisp_global(STATIC_CONSES);
     2287
     2288  if (nstatic) {
     2289    if (head) {
     2290      for (i = 0; i < nstatic; i+= nbits_in_word, c+= nbits_in_word) {
     2291        bits = *bitsp++;
     2292        if (bits != ALL_ONES) {
     2293          for (bitnum = 0; bitnum < nbits_in_word; bitnum++) {
     2294            if (! (bits & (BIT0_MASK>>bitnum))) {
     2295              d = c + bitnum;
     2296              d->car = 0;
     2297              d->cdr = head;
     2298              head = ((LispObj)d)+fulltag_cons;
     2299            }
     2300          }
     2301        }
     2302      }
     2303      lisp_global(STATIC_CONSES) = head;
     2304    } else {
     2305      for (i = 0; i < nstatic; i+= nbits_in_word, c+= nbits_in_word) {
     2306        bits = *bitsp++;
     2307        if (bits != ALL_ONES) {
     2308          for (bitnum = 0; bitnum < nbits_in_word; bitnum++) {
     2309            if (! (bits & (BIT0_MASK>>bitnum))) {
     2310              d = c + bitnum;
     2311              d->car = 0;
     2312              d->cdr = 0;
     2313            }
     2314          }
     2315        }
     2316      }
     2317    }
     2318  }
     2319}
    23262320
    23272321Boolean
     
    25982592    GCfirstunmarked = calculate_relocation();
    25992593
    2600     forward_range((LispObj *) ptr_from_lispobj(GCareadynamiclow), (LispObj *) ptr_from_lispobj(GCfirstunmarked));
     2594    if (!GCephemeral_low) {
     2595      reclaim_static_dnodes();
     2596    }
     2597
     2598    forward_range((LispObj *) ptr_from_lispobj(GCarealow), (LispObj *) ptr_from_lispobj(GCfirstunmarked));
    26012599
    26022600    other_tcr = tcr;
     
    26442642    if (GCephemeral_low) {
    26452643      forward_memoized_area(tenured_area, area_dnode(a->low, tenured_area->low));
    2646     } else {
    2647       /* Full GC, need to process static space */
    2648       forward_and_resolve_static_references(a);
    26492644    }
    26502645 
Note: See TracChangeset for help on using the changeset viewer.