/[emacs]/emacs/gc/misc.c
ViewVC logotype

Diff of /emacs/gc/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.1 by fx, Thu Jun 5 18:23:04 2003 UTC revision 1.2.2.1.2.1 by fx, Mon Jun 16 15:19:52 2003 UTC
# Line 49  Line 49 
49  #          if defined(GC_WIN32_THREADS)  #          if defined(GC_WIN32_THREADS)
50  #             if defined(GC_PTHREADS)  #             if defined(GC_PTHREADS)
51                    pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;                    pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
52  #             elif !defined(GC_NOT_DLL) && (defined(_DLL) || defined(GC_DLL))  #             elif defined(GC_DLL)
53                   __declspec(dllexport) CRITICAL_SECTION GC_allocate_ml;                   __declspec(dllexport) CRITICAL_SECTION GC_allocate_ml;
54  #             else  #             else
55                   CRITICAL_SECTION GC_allocate_ml;                   CRITICAL_SECTION GC_allocate_ml;
# Line 487  void GC_init() Line 487  void GC_init()
487            GC_init_parallel();            GC_init_parallel();
488          }          }
489  #   endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */  #   endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
490    
491    #   if defined(DYNAMIC_LOADING) && defined(DARWIN)
492        {
493            /* This must be called WITHOUT the allocation lock held
494            and before any threads are created */
495            extern void GC_init_dyld();
496            GC_init_dyld();
497        }
498    #   endif
499  }  }
500    
501  #if defined(MSWIN32) || defined(MSWINCE)  #if defined(MSWIN32) || defined(MSWINCE)
# Line 499  void GC_init() Line 508  void GC_init()
508    
509  extern void GC_setpagesize();  extern void GC_setpagesize();
510    
511    
512    #ifdef MSWIN32
513    extern GC_bool GC_no_win32_dlls;
514    #else
515    # define GC_no_win32_dlls FALSE
516    #endif
517    
518    void GC_exit_check GC_PROTO((void))
519    {
520       GC_gcollect();
521    }
522    
523    #ifdef SEARCH_FOR_DATA_START
524      extern void GC_init_linux_data_start GC_PROTO((void));
525    #endif
526    
527  #ifdef UNIX_LIKE  #ifdef UNIX_LIKE
528    
529  extern void GC_set_and_save_fault_handler GC_PROTO((void (*handler)(int)));  extern void GC_set_and_save_fault_handler GC_PROTO((void (*handler)(int)));
# Line 509  int sig; Line 534  int sig;
534      GC_err_printf1("Caught signal %d: looping in handler\n", sig);      GC_err_printf1("Caught signal %d: looping in handler\n", sig);
535      for(;;);      for(;;);
536  }  }
 #endif  
537    
538  #ifdef MSWIN32  static GC_bool installed_looping_handler = FALSE;
 extern GC_bool GC_no_win32_dlls;  
 #else  
 # define GC_no_win32_dlls FALSE  
 #endif  
539    
540  void GC_exit_check GC_PROTO((void))  void maybe_install_looping_handler()
541  {  {
542     GC_gcollect();      /* Install looping handler before the write fault handler, so we    */
543        /* handle write faults correctly.                                   */
544          if (!installed_looping_handler && 0 != GETENV("GC_LOOP_ON_ABORT")) {
545            GC_set_and_save_fault_handler(looping_handler);
546            installed_looping_handler = TRUE;
547          }
548  }  }
549    
550  #ifdef SEARCH_FOR_DATA_START  #else /* !UNIX_LIKE */
551    extern void GC_init_linux_data_start GC_PROTO((void));  
552    # define maybe_install_looping_handler()
553    
554  #endif  #endif
555    
556  void GC_init_inner()  void GC_init_inner()
# Line 590  void GC_init_inner() Line 617  void GC_init_inner()
617          }          }
618        }        }
619      }      }
620  #   ifdef UNIX_LIKE      maybe_install_looping_handler();
       if (0 != GETENV("GC_LOOP_ON_ABORT")) {  
         GC_set_and_save_fault_handler(looping_handler);  
       }  
 #   endif  
621      /* Adjust normal object descriptor for extra allocation.    */      /* Adjust normal object descriptor for extra allocation.    */
622      if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) {      if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) {
623        GC_obj_kinds[NORMAL].ok_descriptor = ((word)(-ALIGNMENT) | GC_DS_LENGTH);        GC_obj_kinds[NORMAL].ok_descriptor = ((word)(-ALIGNMENT) | GC_DS_LENGTH);
# Line 641  void GC_init_inner() Line 664  void GC_init_inner()
664  #       endif  #       endif
665        }        }
666  #   endif  #   endif
667      GC_ASSERT(sizeof (ptr_t) == sizeof(word));      GC_STATIC_ASSERT(sizeof (ptr_t) == sizeof(word));
668      GC_ASSERT(sizeof (signed_word) == sizeof(word));      GC_STATIC_ASSERT(sizeof (signed_word) == sizeof(word));
669      GC_ASSERT(sizeof (struct hblk) == HBLKSIZE);      GC_STATIC_ASSERT(sizeof (struct hblk) == HBLKSIZE);
670  #   ifndef THREADS  #   ifndef THREADS
671  #     if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)  #     if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)
672          ABORT(          ABORT(
# Line 765  void GC_enable_incremental GC_PROTO(()) Line 788  void GC_enable_incremental GC_PROTO(())
788      if (GC_incremental) goto out;      if (GC_incremental) goto out;
789      GC_setpagesize();      GC_setpagesize();
790      if (GC_no_win32_dlls) goto out;      if (GC_no_win32_dlls) goto out;
791  #   ifndef GC_SOLARIS_THREADS  #   ifndef GC_SOLARIS_THREADS
792          GC_dirty_init();        maybe_install_looping_handler();  /* Before write fault handler! */
793          GC_dirty_init();
794  #   endif  #   endif
795      if (!GC_is_initialized) {      if (!GC_is_initialized) {
796          GC_init_inner();          GC_init_inner();

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26