Changeset 16378


Ignore:
Timestamp:
May 1, 2015, 8:29:43 PM (5 years ago)
Author:
gb
Message:

changes to try to make static-cons interact better with the EGC than it has.

support a --debug option, which allows the kernel debugger to use /dev/tty when
stdin is redirected. only tested on Linux.

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

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/gc-common.c

    r16119 r16378  
    12811281  natural nstatic = tenured_area->static_dnodes,
    12821282    i,
    1283     bits,
    12841283    bitnum,
    1285     nfree = 0,
    1286     nstatic_conses = area_dnode(static_cons_area->high, static_cons_area->low);
     1284    nfree = 0;
    12871285  cons *c = (cons *)tenured_area->low, *d;
    1288   bitvector bitsp = GCmarkbits;
    1289   LispObj head = lisp_global(STATIC_CONSES);
    1290 
    1291   for (i = 0; i < nstatic; i+= nbits_in_word, c+= nbits_in_word) {
    1292     bits = *bitsp++;
    1293     if (bits != ALL_ONES) {
    1294       for (bitnum = 0; bitnum < nbits_in_word; bitnum++) {
    1295         if (! (bits & (BIT0_MASK>>bitnum))) {
    1296           d = c + bitnum;
    1297           if (i < nstatic_conses) {               
    1298             d->car = unbound;
    1299             d->cdr = head;
    1300             head = ((LispObj)d)+fulltag_cons;
    1301             nfree++;
    1302           } else {
    1303             d->car = 0;
    1304             d->cdr = 0;
    1305           }
    1306         }
    1307       }
     1286  bitvector bits = GCmarkbits;
     1287  LispObj head = lisp_nil;
     1288
     1289  for (i = 0; i < nstatic; i++) {
     1290    if(!ref_bit(bits,i)) {
     1291      d=c+i;
     1292      d->cdr = head;
     1293      d->car = unbound;
     1294      nfree++;
     1295      head = ((LispObj) d)+fulltag_cons;
    13081296    }
    13091297  }
     
    17091697      }
    17101698    }
    1711 
    1712     mark_root(lisp_global(STATIC_CONSES));
     1699    /* those static conses that are reachable will be marked */
     1700    /*mark_root(lisp_global(STATIC_CONSES)); */
    17131701
    17141702    {
     
    18341822    GCfirstunmarked = calculate_relocation();
    18351823
     1824
     1825
    18361826    if (!GCephemeral_low) {
    18371827      reclaim_static_dnodes();
    18381828    }
     1829
    18391830
    18401831    forward_range((LispObj *) ptr_from_lispobj(GCarealow), (LispObj *) ptr_from_lispobj(GCfirstunmarked));
  • trunk/source/lisp-kernel/image.c

    r15842 r16378  
    312312  case AREA_STATIC_CONS:
    313313    addr = (char *) lisp_global(HEAP_START);
     314    tenured_area = new_area(addr, addr, AREA_STATIC);
     315
    314316    a = new_area(addr-align_to_power_of_2(mem_size,log2_page_size), addr, AREA_STATIC_CONS);
    315317    if (mem_size) {     
     
    325327    sect->area = a;
    326328    static_cons_area = a;
     329    /* not yet
     330    lower_heap_start(a->low,tenured_area);
     331    */
    327332    break;
    328333
     
    421426        break;
    422427      case AREA_STATIC_CONS:
     428        /* not yet
     429 lower_heap_start(static_cons_area->low,tenured_area);
     430        */
    423431        break;
    424432      case AREA_DYNAMIC:
    425         lower_heap_start(static_cons_area->low,a);
    426433        if (bias) {
    427434          relocate_area_contents(a, bias);
  • trunk/source/lisp-kernel/lisp-debug.c

    r16366 r16378  
    224224{
    225225#ifndef WINDOWS
    226   if (!isatty(fileno(dbgin))) {
     226  if (1 || !isatty(fileno(dbgin))) {
    227227    int fd = open("/dev/tty", O_RDWR);
    228228    if (fd >=0) {
  • trunk/source/lisp-kernel/lisp.h

    r16366 r16378  
    9292void ensure_static_conses(ExceptionInformation *, TCR *,natural);
    9393
     94void ensure_gc_structures_writable(void);
     95
    9496extern FILE *dbgout,*dbgin;
    9597
  • trunk/source/lisp-kernel/memory.c

    r16110 r16378  
    708708untenure_from_area(area *from)
    709709{
    710   if (lisp_global(OLDEST_EPHEMERAL) != 0) {
     710  if ((lisp_global(OLDEST_EPHEMERAL) != 0)) {
    711711    area *a = active_dynamic_area, *child;
    712712    BytePtr curlow = from->low;
     
    714714   
    715715    for (child = from; child != a; child = child->younger) {
    716       child->low = child->active = child->high = curlow;
    717       child->ndnodes = 0;
     716      child->low = from->low;
     717
     718     child->active = child->high = curlow;
     719     child->ndnodes = area_dnode(child->high, child->low);
    718720    }
    719721   
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r16366 r16378  
    55
    66   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
    7    License , known as the LLGPL and distributed with Clozure CL as the
     7   License , known as the LLGPL and distributed+ with Clozure CL as the
    88   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
    99   which is distributed with Clozure CL as the file "LGPL".  Where these
     
    703703    CommitMemory(new_markbits,n);
    704704    dynamic_mark_ref_bits = (bitvector)new_markbits;
    705     if (a->refbits) {
     705    if (a) {
     706      if (a->refbits) {
    706707      a->refbits= dynamic_mark_ref_bits;
    707     }
    708     a->static_dnodes += new_dnodes;
    709     a->ndnodes += new_dnodes;
    710     a->low = new_low;
    711     a->refidx -= nidx;
     708      }
     709      a->static_dnodes += new_dnodes;
     710      a->ndnodes += new_dnodes;
     711      a->low = new_low;
     712      a->refidx -= nidx;
     713    }
    712714    low_markable_address = new_low;
    713715    lisp_global(HEAP_START) = (LispObj)new_low;
    714716    static_cons_area->ndnodes = area_dnode(static_cons_area->high,new_low);
     717    ensure_gc_structures_writable();
    715718  }
    716719}
     
    720723{
    721724  natural
    722     ndnodes = area_dnode(lisp_global(HEAP_END),low_relocatable_address),
     725    ndnodes = area_dnode(lisp_global(HEAP_END),tenured_area->low),
    723726    markbits_size = (3*sizeof(LispObj))+((ndnodes+7)>>3),
    724727    reloctab_size = (sizeof(LispObj)*(((ndnodes+((1<<bitmap_shift)-1))>>bitmap_shift)+1)),
     
    14021405    }
    14031406  }
     1407#if 0
     1408  redirect_debugger_io();
     1409  fprintf(dbgout,"ccl pid = %d", getpid());
     1410  sleep(20);
     1411#endif
     1412
     1413
    14041414}
    14051415
     
    17801790    g1_area = new_area(lowptr, lowptr, AREA_STATIC);
    17811791    g2_area = new_area(lowptr, lowptr, AREA_STATIC);
    1782     tenured_area = new_area(lowptr, lowptr, AREA_STATIC);
    1783     add_area_holding_area_lock(tenured_area);
    17841792    add_area_holding_area_lock(g2_area);
    17851793    add_area_holding_area_lock(g1_area);
    1786 
     1794    add_area_holding_area_lock(tenured_area);
    17871795    g1_area->code = AREA_DYNAMIC;
    17881796    g2_area->code = AREA_DYNAMIC;
     
    18111819    g1_area->threshold = default_g1_threshold;
    18121820    a->threshold = default_g0_threshold;
     1821    if (static_cons_area && static_cons_area->ndnodes) {
     1822      lower_heap_start(static_cons_area->low, tenured_area);
     1823    }
    18131824  }
    18141825}
     
    25442555ensure_static_conses(ExceptionInformation *xp, TCR *tcr, natural nconses)
    25452556{
    2546   area *a = active_dynamic_area;
    2547   natural nbytes = nconses>>dnode_shift, have;
    2548   BytePtr p = a->high-nbytes;
    2549 #ifdef USE_GC_NOTIFICATION
    2550   Boolean crossed_notify_threshold = false;
    2551   LispObj before_shrink, after_shrink;
    2552 #endif
    2553 
    2554   if (p < a->active) {
    2555     untenure_from_area(tenured_area);
    2556     gc_from_xp(xp, 0L);
    2557 #ifdef USE_GC_NOTIFICATION
    2558     did_gc_notification_since_last_full_gc = false;
    2559 #endif
    2560   }
    2561 
    2562   have = unbox_fixnum(lisp_global(FREE_STATIC_CONSES));
    2563   if (have < nconses) {
    2564 #ifdef USE_GC_NOTIFICATION
    2565     before_shrink = a->high-a->active;
    2566     if (before_shrink>nbytes) {
    2567       shrink_dynamic_area(nbytes);
    2568       after_shrink = a->high-a->active;
    2569       if ((before_shrink >= lisp_heap_notify_threshold) &&
    2570           (after_shrink < lisp_heap_notify_threshold)) {
    2571         crossed_notify_threshold = true;
    2572       }
    2573     }
    2574 #endif
    2575     allocate_static_conses(nconses);
    2576     TCR_AUX(tcr)->bytes_allocated += nbytes;
    2577   }
    2578 #ifdef USE_GC_NOTIFICATION
    2579   if (crossed_notify_threshold && !did_gc_notification_since_last_full_gc) {
    2580     callback_for_gc_notification(xp,tcr);
    2581   }
    2582 #endif
     2557  natural nbytes = nconses<<dnode_shift;
     2558  allocate_static_conses(nconses);
     2559  TCR_AUX(tcr)->bytes_allocated += nbytes;
     2560
    25832561}
    25842562     
  • trunk/source/lisp-kernel/x86-gc.c

    r16339 r16378  
    311311
    312312  if (current != end) {
    313     Bug(NULL, "Overran end of memory range: start = 0x%08x, end = 0x%08x, prev = 0x%08x, current = 0x%08x",
     313    Bug(NULL, "Overran end of memory range: start = 0x" LISP ", end = 0x" LISP ", prev = 0x" LISP ", current = 0x" LISP "",
    314314        start, end, prev, current);
    315315  }
Note: See TracChangeset for help on using the changeset viewer.