[BACK]Return to test.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc

Diff for /OpenXM_contrib2/asir2000/gc/Attic/test.c between version 1.1 and 1.2

version 1.1, 1999/12/03 07:39:10 version 1.2, 2000/04/10 08:31:32
Line 45 
Line 45 
 #   include <synch.h>  #   include <synch.h>
 # endif  # endif
   
 # if defined(IRIX_THREADS) || defined(LINUX_THREADS)  # if defined(IRIX_THREADS) || defined(LINUX_THREADS) || defined(HPUX_THREADS)
 #   include <pthread.h>  #   include <pthread.h>
 # endif  # endif
   
Line 53 
Line 53 
 #   include <process.h>  #   include <process.h>
     static CRITICAL_SECTION incr_cs;      static CRITICAL_SECTION incr_cs;
 # endif  # endif
 # if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS)  
 #   define THREADS  
 # endif  
   
 # ifdef AMIGA  # ifdef AMIGA
    long __stack = 200000;     long __stack = 200000;
Line 281  struct {
Line 278  struct {
 }  }
   
 # if defined(IRIX_THREADS) || defined(LINUX_THREADS) \  # if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
      || defined(SOLARIS_PTHREADS)       || defined(SOLARIS_PTHREADS) || defined(HPUX_THREADS)
     void fork_a_thread()      void fork_a_thread()
     {      {
       pthread_t t;        pthread_t t;
Line 362  void reverse_test()
Line 359  void reverse_test()
     d = uncollectable_ints(1, 100);      d = uncollectable_ints(1, 100);
     e = uncollectable_ints(1, 1);      e = uncollectable_ints(1, 1);
     /* Check that realloc updates object descriptors correctly */      /* Check that realloc updates object descriptors correctly */
     f = (sexpr *)GC_malloc(4 * sizeof(sexpr));      f = (sexpr *)GC_MALLOC(4 * sizeof(sexpr));
     f = (sexpr *)GC_realloc((GC_PTR)f, 6 * sizeof(sexpr));      f = (sexpr *)GC_REALLOC((GC_PTR)f, 6 * sizeof(sexpr));
     f[5] = ints(1,17);      f[5] = ints(1,17);
     g = (sexpr *)GC_malloc(513 * sizeof(sexpr));      g = (sexpr *)GC_MALLOC(513 * sizeof(sexpr));
     g = (sexpr *)GC_realloc((GC_PTR)g, 800 * sizeof(sexpr));      g = (sexpr *)GC_REALLOC((GC_PTR)g, 800 * sizeof(sexpr));
     g[799] = ints(1,18);      g[799] = ints(1,18);
     h = (sexpr *)GC_malloc(1025 * sizeof(sexpr));      h = (sexpr *)GC_MALLOC(1025 * sizeof(sexpr));
     h = (sexpr *)GC_realloc((GC_PTR)h, 2000 * sizeof(sexpr));      h = (sexpr *)GC_REALLOC((GC_PTR)h, 2000 * sizeof(sexpr));
     h[1999] = ints(1,19);      h[1999] = ints(1,19);
     /* Try to force some collections and reuse of small list elements */      /* Try to force some collections and reuse of small list elements */
       for (i = 0; i < 10; i++) {        for (i = 0; i < 10; i++) {
Line 453  VOLATILE int dropped_something = 0;
Line 450  VOLATILE int dropped_something = 0;
     static mutex_t incr_lock;      static mutex_t incr_lock;
     mutex_lock(&incr_lock);      mutex_lock(&incr_lock);
 # endif  # endif
 # if  defined(IRIX_THREADS) || defined(LINUX_THREADS)  # if  defined(IRIX_THREADS) || defined(LINUX_THREADS) || defined(HPUX_THREADS)
     static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;      static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;
     pthread_mutex_lock(&incr_lock);      pthread_mutex_lock(&incr_lock);
 # endif  # endif
Line 471  VOLATILE int dropped_something = 0;
Line 468  VOLATILE int dropped_something = 0;
 # ifdef SOLARIS_THREADS  # ifdef SOLARIS_THREADS
     mutex_unlock(&incr_lock);      mutex_unlock(&incr_lock);
 # endif  # endif
 # if defined(IRIX_THREADS) || defined(LINUX_THREADS)  # if defined(IRIX_THREADS) || defined(LINUX_THREADS) || defined(HPUX_THREADS)
     pthread_mutex_unlock(&incr_lock);      pthread_mutex_unlock(&incr_lock);
 # endif  # endif
 # ifdef WIN32_THREADS  # ifdef WIN32_THREADS
Line 532  int n;
Line 529  int n;
             static mutex_t incr_lock;              static mutex_t incr_lock;
             mutex_lock(&incr_lock);              mutex_lock(&incr_lock);
 #         endif  #         endif
 #         if defined(IRIX_THREADS) || defined(LINUX_THREADS)  #         if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
                || defined(HPUX_THREADS)
             static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;              static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;
             pthread_mutex_lock(&incr_lock);              pthread_mutex_lock(&incr_lock);
 #         endif  #         endif
Line 548  int n;
Line 546  int n;
 #         ifdef SOLARIS_THREADS  #         ifdef SOLARIS_THREADS
             mutex_unlock(&incr_lock);              mutex_unlock(&incr_lock);
 #         endif  #         endif
 #         if defined(IRIX_THREADS) || defined(LINUX_THREADS)  #         if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
                || defined(HPUX_THREADS)
             pthread_mutex_unlock(&incr_lock);              pthread_mutex_unlock(&incr_lock);
 #         endif  #         endif
 #         ifdef WIN32_THREADS  #         ifdef WIN32_THREADS
Line 610  thread_key_t fl_key;
Line 609  thread_key_t fl_key;
   
 void * alloc8bytes()  void * alloc8bytes()
 {  {
 # ifdef SMALL_CONFIG  # if defined(SMALL_CONFIG) || defined(GC_DEBUG)
     return(GC_malloc(8));      return(GC_MALLOC(8));
 # else  # else
     void ** my_free_list_ptr;      void ** my_free_list_ptr;
     void * my_free_list;      void * my_free_list;
Line 644  void * alloc8bytes()
Line 643  void * alloc8bytes()
 #else  #else
   
 # if defined(_SOLARIS_PTHREADS) || defined(IRIX_THREADS) \  # if defined(_SOLARIS_PTHREADS) || defined(IRIX_THREADS) \
      || defined(LINUX_THREADS)       || defined(LINUX_THREADS) || defined(HPUX_THREADS)
 pthread_key_t fl_key;  pthread_key_t fl_key;
   
 void * alloc8bytes()  void * alloc8bytes()
Line 857  void run_one_test()
Line 856  void run_one_test()
         (void)GC_printf0("GC_malloc_uncollectable(0) failed\n");          (void)GC_printf0("GC_malloc_uncollectable(0) failed\n");
             FAIL;              FAIL;
     }      }
       GC_FREE(0);
     GC_is_valid_displacement_print_proc = fail_proc1;      GC_is_valid_displacement_print_proc = fail_proc1;
     GC_is_visible_print_proc = fail_proc1;      GC_is_visible_print_proc = fail_proc1;
     x = GC_malloc(16);      x = GC_malloc(16);
Line 879  void run_one_test()
Line 879  void run_one_test()
         FAIL;          FAIL;
     }      }
     if (!TEST_FAIL_COUNT(1)) {      if (!TEST_FAIL_COUNT(1)) {
 #       if!(defined(RS6000) || defined(POWERPC))  #       if!(defined(RS6000) || defined(POWERPC) || defined(IA64))
           /* ON RS6000s function pointers point to a descriptor in the  */            /* ON RS6000s function pointers point to a descriptor in the  */
           /* data segment, so there should have been no failures.       */            /* data segment, so there should have been no failures.       */
           (void)GC_printf0("GC_is_visible produced wrong failure indication\n");            (void)GC_printf0("GC_is_visible produced wrong failure indication\n");
Line 1030  void SetMinimumStack(long minSize)
Line 1030  void SetMinimumStack(long minSize)
   
   
 #if !defined(PCR) && !defined(SOLARIS_THREADS) && !defined(WIN32_THREADS) \  #if !defined(PCR) && !defined(SOLARIS_THREADS) && !defined(WIN32_THREADS) \
   && !defined(IRIX_THREADS) && !defined(LINUX_THREADS) || defined(LINT)    && !defined(IRIX_THREADS) && !defined(LINUX_THREADS) \
     && !defined(HPUX_THREADS) || defined(LINT)
 #ifdef MSWIN32  #ifdef MSWIN32
   int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n)    int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n)
 #else  #else
Line 1161  test()
Line 1162  test()
 }  }
 #endif  #endif
   
 #if defined(SOLARIS_THREADS) || defined(IRIX_THREADS) || defined(LINUX_THREADS)  #if defined(SOLARIS_THREADS) || defined(IRIX_THREADS) \
    || defined(HPUX_THREADS) || defined(LINUX_THREADS)
 void * thr_run_one_test(void * arg)  void * thr_run_one_test(void * arg)
 {  {
     run_one_test();      run_one_test();
Line 1222  main()
Line 1224  main()
         *((volatile char *)&code - 1024*1024) = 0;      /* Require 1 Mb */          *((volatile char *)&code - 1024*1024) = 0;      /* Require 1 Mb */
 #   endif /* IRIX_THREADS */  #   endif /* IRIX_THREADS */
     pthread_attr_init(&attr);      pthread_attr_init(&attr);
 #   ifdef IRIX_THREADS  #   if defined(IRIX_THREADS) || defined(HPUX_THREADS)
         pthread_attr_setstacksize(&attr, 1000000);          pthread_attr_setstacksize(&attr, 1000000);
 #   endif  #   endif
     n_tests = 0;      n_tests = 0;
Line 1232  main()
Line 1234  main()
         (void) GC_printf0("Emulating dirty bits with mprotect/signals\n");          (void) GC_printf0("Emulating dirty bits with mprotect/signals\n");
 #   endif  #   endif
     (void) GC_set_warn_proc(warn_proc);      (void) GC_set_warn_proc(warn_proc);
     if (pthread_key_create(&fl_key, 0) != 0) {      if ((code = pthread_key_create(&fl_key, 0)) != 0) {
         (void)GC_printf1("Key creation failed %lu\n", (unsigned long)code);          (void)GC_printf1("Key creation failed %lu\n", (unsigned long)code);
         FAIL;          FAIL;
     }      }
Line 1260  main()
Line 1262  main()
     return(0);      return(0);
 }  }
 #endif /* pthreads */  #endif /* pthreads */
 #endif /* SOLARIS_THREADS || IRIX_THREADS || LINUX_THREADS */  #endif /* SOLARIS_THREADS || IRIX_THREADS || LINUX_THREADS || HPUX_THREADS */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>