Changeset 11501


Ignore:
Timestamp:
Dec 11, 2008, 1:31:44 PM (11 years ago)
Author:
gb
Message:

Try to use non-conflicting, platform-dependent signals instead of
SIGQUIT. (Darwin uses SIGEMT, which doesn't seem to be raised
by the kernel on x86 or PPC; other platfroms can use user-defined
(possibly "realtime" signals).

Rename kernel things that had 'quit' in their names and had to
do with terminating threads to instead have 'thread_kill' in
their names (e.g. quit_handler -> thread_kill_handler.)

In the x86 GC, at least in mark_root and the recursive case of
rmark, check the dnode against gc_area_dnode before mapping
a TRA to the containing function. (This keeps us from crashing
in those cases if we see a garbage root that's tagged as a TRA,
but that fixes the symptom and not the proble, that would cause
such a garbage root to appear.) This is x86-specific; the
PPC ports don't use TRAs.

Save lisp_heap_gc_threshold, the EGC enable state, and the
sizes of the ephemeral generations in the image and restore
them on startup. (The -T option - which sets the global
GC threshold from the command line - overrides any value
set in the image; more accurately, it does that if the value
of the -T argument isn't the default GC threshold size.)
This is probably the right idea, but it's an incompatible
change; people who override the defaults at build or startup
time may need to change how their systems are built and
initialized.

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

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/Threads.h

    r11500 r11501  
    241241
    242242
    243 #define SIG_KILL_THREAD  SIGQUIT   /* unless we can find something better */
    244 
    245 extern int thread_suspend_signal, thread_quit_signal;
     243#ifdef DARWIN
     244#define SIG_KILL_THREAD SIGEMT
     245#endif
     246
     247#if defined(LINUX) && defined(SIGRTMIN)
     248#define SIG_KILL_THREAD (SIGRTMIN+7)
     249#endif
     250
     251#ifdef SOLARIS
     252#define SIG_KILL_THREAD SIGRTMIN
     253#endif
     254
     255#ifdef FREEBSD
     256#define SIG_KILL_THREAD (SIG_THR+5)
     257#endif
     258
     259
     260extern int thread_suspend_signal, thread_kill_signal;
    246261
    247262void *
  • trunk/source/lisp-kernel/image.c

    r11468 r11501  
    455455  prepare_to_write_dynamic_space(active_dynamic_area);
    456456
     457  {
     458    area *g0_area = g1_area->younger;
     459
     460    /* Save GC config */
     461    lisp_global(LISP_HEAP_THRESHOLD) = lisp_heap_gc_threshold;
     462    lisp_global(G0_THRESHOLD) = g0_area->threshold;
     463    lisp_global(G1_THRESHOLD) = g1_area->threshold;
     464    lisp_global(G1_THRESHOLD) = g2_area->threshold;
     465    lisp_global(EGC_ENABLED) = (LispObj)(active_dynamic_area->older != NULL);
     466  }
    457467  /*
    458468    lisp_global(GC_NUM) and lisp_global(FWDNUM) are persistent,
     
    466476    case STATIC_CONSES:
    467477    case WEAK_GC_METHOD:
     478    case LISP_HEAP_THRESHOLD:
     479    case EGC_ENABLED:
     480    case G0_THRESHOLD:
     481    case G1_THRESHOLD:
     482    case G2_THRESHOLD:
    468483      break;
    469484    default:
  • trunk/source/lisp-kernel/lisp-debug.c

    r11244 r11501  
    929929#endif
    930930  {debug_kill_process,
    931    "Kill OpenMCL process",
     931   "Kill Clozure CL process",
    932932   0,
    933933   NULL,
     
    10571057  while (state == debug_continue) {
    10581058#ifdef WINDOWS
    1059     fprintf(stderr, "[%d] OpenMCL kernel debugger: ", (int)GetCurrentProcessId());
     1059    fprintf(stderr, "[%d] Clozure CL kernel debugger: ", (int)GetCurrentProcessId());
    10601060#else
    1061     fprintf(stderr, "[%d] OpenMCL kernel debugger: ", main_thread_pid);
     1061    fprintf(stderr, "[%d] Clozure CL kernel debugger: ", main_thread_pid);
    10621062#endif
    10631063    state = apply_debug_command(xp, readc(), info, why);
     
    11101110lisp_bug(char *string)
    11111111{
    1112   Bug(NULL, "Bug in OpenMCL system code:\n%s", string);
    1113 }
    1114 
     1112  Bug(NULL, "Bug in Clozure CL system code:\n%s", string);
     1113}
     1114
  • trunk/source/lisp-kernel/lisp_globals.h

    r10969 r11501  
    7272#define MIN_KERNEL_GLOBAL INITIAL_TCR
    7373
     74/* These are only non-zero when an image is being saved or loaded */
     75
     76#if (WOED_SIZE==64)
     77#define LISP_HEAP_THRESHOLD (-511)
     78#define EGC_ENABLED (-510)
     79#define G0_THRESHOLD (-509)
     80#define G1_THRESHOLD (-508)
     81#define G2_THRESHOLD (-507)
     82#else
     83#define LISP_HEAP_THRESHOLD (-1023)
     84#define EGC_ENABLED (-1022)
     85#define G0_THRESHOLD (-1021)
     86#define G1_THRESHOLD (-1020)
     87#define G2_THRESHOLD (-1019)
     88#endif
     89
    7490#ifdef PPC
    7591#ifdef PPC64
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r11450 r11501  
    14691469{
    14701470  extern int page_size;
     1471  natural default_g0_threshold = G0_AREA_THRESHOLD,
     1472    default_g1_threshold = G1_AREA_THRESHOLD,
     1473    default_g2_threshold = G2_AREA_THRESHOLD,
     1474    lisp_heap_threshold_from_image = 0;
     1475  Boolean egc_enabled =
     1476#ifdef DISABLE_EGC
     1477    false
     1478#else
     1479    true
     1480#endif
     1481    ;
     1482  Boolean lisp_heap_threshold_set_from_command_line = false;
    14711483
    14721484#ifdef PPC
     
    15851597    process_options(argc,argv);
    15861598  }
     1599  if (lisp_heap_gc_threshold != DEFAULT_LISP_HEAP_GC_THRESHOLD) {
     1600    lisp_heap_threshold_set_from_command_line = true;
     1601  }
     1602
    15871603  initial_stack_size = ensure_stack_limit(initial_stack_size);
    15881604  if (image_name == NULL) {
     
    16011617
    16021618  set_nil(load_image(image_name));
     1619  lisp_heap_threshold_from_image = lisp_global(LISP_HEAP_THRESHOLD);
     1620  if (lisp_heap_threshold_from_image) {
     1621    if ((!lisp_heap_threshold_set_from_command_line) &&
     1622        (lisp_heap_threshold_from_image != lisp_heap_gc_threshold)) {
     1623      lisp_heap_gc_threshold = lisp_heap_threshold_from_image;
     1624      resize_dynamic_heap(active_dynamic_area->active,lisp_heap_gc_threshold);
     1625    }
     1626    /* If lisp_heap_threshold_from_image was set, other image params are
     1627       valid. */
     1628    default_g0_threshold = lisp_global(G0_THRESHOLD);
     1629    default_g1_threshold = lisp_global(G1_THRESHOLD);
     1630    default_g2_threshold = lisp_global(G2_THRESHOLD);
     1631    egc_enabled = lisp_global(EGC_ENABLED);
     1632  }
     1633
    16031634  lisp_global(TCR_AREA_LOCK) = ptr_to_lispobj(tcr_area_lock);
    16041635
     
    16641695    lisp_global(TENURED_AREA) = ptr_to_lispobj(tenured_area);
    16651696    lisp_global(REFBITS) = ptr_to_lispobj(tenured_area->refbits);
    1666     g2_area->threshold = G2_AREA_THRESHOLD;
    1667     g1_area->threshold = G1_AREA_THRESHOLD;
    1668     a->threshold = G0_AREA_THRESHOLD;
     1697    g2_area->threshold = default_g2_threshold;
     1698    g1_area->threshold = default_g1_threshold;
     1699    a->threshold = default_g0_threshold;
    16691700  }
    16701701
     
    16941725  (nrs_GC_EVENT_STATUS_BITS.vcell |= gc_integrity_check_bit);
    16951726#endif
    1696 #ifndef DISABLE_EGC
    1697   egc_control(true, NULL);
    1698 #endif
     1727  if (egc_enabled) {
     1728    egc_control(true, NULL);
     1729  }
    16991730  atexit(lazarus);
    17001731  start_lisp(TCR_TO_TSD(tcr), 0);
  • trunk/source/lisp-kernel/ppc-exceptions.c

    r11500 r11501  
    21742174
    21752175void
    2176 quit_handler(int signum, siginfo_t info, ExceptionInformation *xp)
     2176thread_kill_handler(int signum, siginfo_t info, ExceptionInformation *xp)
    21772177{
    21782178  TCR *tcr = get_tcr(false);
     
    22062206{
    22072207  thread_suspend_signal = SIG_SUSPEND_THREAD;
    2208   thread_quit_signal = SIG_KILL_THREAD;
     2208  thread_kill_signal = SIG_KILL_THREAD;
    22092209
    22102210  install_signal_handler(thread_suspend_signal, (void *) suspend_resume_handler);
    2211   install_signal_handler(SIGQUIT, (void *)quit_handler);
     2211  install_signal_handler(thread_kill_signal, (void *)thread_kill_handler);
    22122212}
    22132213
  • trunk/source/lisp-kernel/thread_manager.c

    r11500 r11501  
    547547
    548548
    549 int thread_suspend_signal = 0, thread_quit_signal = 0;
     549int thread_suspend_signal = 0, thread_kill_signal = 0;
    550550
    551551
     
    20212021      }
    20222022#else
    2023       if (pthread_kill((pthread_t)osid,thread_quit_signal)) {
     2023      if (pthread_kill((pthread_t)osid,thread_kill_signal)) {
    20242024        result = false;
    20252025      }
  • trunk/source/lisp-kernel/x86-exceptions.c

    r11500 r11501  
    20112011#ifdef WINDOWS
    20122012void
    2013 quit_handler(int signum, siginfo_t *info, ExceptionInformation *xp)
    2014 {
    2015 }
    2016 #else
    2017 void
    2018 quit_handler(int signum, siginfo_t *info, ExceptionInformation *xp)
     2013thread_kill_handler(int signum, siginfo_t *info, ExceptionInformation *xp)
     2014{
     2015}
     2016#else
     2017void
     2018thread_kill_handler(int signum, siginfo_t *info, ExceptionInformation *xp)
    20192019{
    20202020#ifdef DARWIN_GS_HACK
     
    20362036#ifndef USE_SIGALTSTACK
    20372037void
    2038 arbstack_quit_handler(int signum, siginfo_t *info, ExceptionInformation *context)
     2038arbstack_thread_kill_handler(int signum, siginfo_t *info, ExceptionInformation *context)
    20392039{
    20402040#ifdef DARWIN_GS_HACK
     
    20482048      (current_sp < vs->high)) {
    20492049    handle_signal_on_foreign_stack(tcr,
    2050                                    quit_handler,
     2050                                   thread_kill_handler,
    20512051                                   signum,
    20522052                                   info,
     
    20652065    }
    20662066#endif
    2067     quit_handler(signum, info, context);
    2068   }
    2069 }
    2070 
    2071 
    2072 #else
    2073 void
    2074 altstack_quit_handler(int signum, siginfo_t *info, ExceptionInformation *context)
     2067    thread_kill_handler(signum, info, context);
     2068  }
     2069}
     2070
     2071
     2072#else
     2073void
     2074altstack_thread_kill_handler(int signum, siginfo_t *info, ExceptionInformation *context)
    20752075{
    20762076#ifdef DARWIN_GS_HACK
     
    20792079  TCR* tcr = get_tcr(true);
    20802080  handle_signal_on_foreign_stack(tcr,
    2081                                  quit_handler,
     2081                                 thread_kill_handler,
    20822082                                 signum,
    20832083                                 info,
     
    20942094#ifdef USE_SIGALTSTACK
    20952095#define SUSPEND_RESUME_HANDLER altstack_suspend_resume_handler
    2096 #define QUIT_HANDLER altstack_quit_handler
     2096#define THREAD_KILL_HANDLER altstack_thread_kill_handler
    20972097#else
    20982098#define SUSPEND_RESUME_HANDLER arbstack_suspend_resume_handler
    2099 #define QUIT_HANDLER arbstack_quit_handler
     2099#define THREAD_KILL_HANDLER arbstack_thread_kill_handler
    21002100#endif
    21012101
     
    21102110{
    21112111  thread_suspend_signal = SIG_SUSPEND_THREAD;
    2112   thread_quit_signal = SIG_KILL_THREAD;
     2112  thread_kill_signal = SIG_KILL_THREAD;
    21132113
    21142114  install_signal_handler(thread_suspend_signal, (void *)SUSPEND_RESUME_HANDLER);
    2115   install_signal_handler(thread_quit_signal, (void *)QUIT_HANDLER);
     2115  install_signal_handler(thread_kill_signal, (void *)THREAD_KILL_HANDLER);
    21162116}
    21172117#endif
  • trunk/source/lisp-kernel/x86-gc.c

    r11168 r11501  
    375375  }
    376376
     377  dnode = gc_area_dnode(n);
     378  if (dnode >= GCndnodes_in_area) {
     379    return;
     380  }
     381
    377382#ifdef X8632
    378383  if (tag_n == fulltag_tra) {
     
    380385      n = *(LispObj *)(n + 1);
    381386      tag_n = fulltag_misc;
     387      dnode = gc_area_dnode(n);
    382388    } else
    383389      return;
     
    391397      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
    392398      tag_n = fulltag_function;
     399      dnode = gc_area_dnode(n);
    393400    }
    394401    else {
     
    398405#endif
    399406
    400 
    401   dnode = gc_area_dnode(n);
    402   if (dnode >= GCndnodes_in_area) {
    403     return;
    404   }
    405407  set_bits_vars(GCmarkbits,dnode,bitsp,bits,mask);
    406408  if (bits & mask) {
     
    594596  }
    595597
     598  dnode = gc_area_dnode(n);
     599  if (dnode >= GCndnodes_in_area) {
     600    return;
     601  }
     602
    596603#ifdef X8632
    597604  if (tag_n == fulltag_tra) {
     
    599606      n = *(LispObj *)(n + 1);
    600607      tag_n = fulltag_misc;
     608      dnode = gc_area_dnode(n);
    601609    } else {
    602610      return;
     
    611619      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
    612620      tag_n = fulltag_function;
     621      dnode = gc_area_dnode(n);
    613622    } else {
    614623      return;
     
    617626#endif
    618627
    619   dnode = gc_area_dnode(n);
    620   if (dnode >= GCndnodes_in_area) {
    621     return;
    622   }
    623628  set_bits_vars(markbits,dnode,bitsp,bits,mask);
    624629  if (bits & mask) {
Note: See TracChangeset for help on using the changeset viewer.