=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/gc/Attic/test.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -p -r1.1.1.1 -r1.2 --- OpenXM_contrib2/asir2000/gc/Attic/test.c 1999/12/03 07:39:10 1.1.1.1 +++ OpenXM_contrib2/asir2000/gc/Attic/test.c 2000/04/10 08:31:32 1.2 @@ -45,7 +45,7 @@ # include # endif -# if defined(IRIX_THREADS) || defined(LINUX_THREADS) +# if defined(IRIX_THREADS) || defined(LINUX_THREADS) || defined(HPUX_THREADS) # include # endif @@ -53,9 +53,6 @@ # include static CRITICAL_SECTION incr_cs; # endif -# if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) -# define THREADS -# endif # ifdef AMIGA long __stack = 200000; @@ -281,7 +278,7 @@ struct { } # if defined(IRIX_THREADS) || defined(LINUX_THREADS) \ - || defined(SOLARIS_PTHREADS) + || defined(SOLARIS_PTHREADS) || defined(HPUX_THREADS) void fork_a_thread() { pthread_t t; @@ -362,14 +359,14 @@ void reverse_test() d = uncollectable_ints(1, 100); e = uncollectable_ints(1, 1); /* Check that realloc updates object descriptors correctly */ - f = (sexpr *)GC_malloc(4 * sizeof(sexpr)); - f = (sexpr *)GC_realloc((GC_PTR)f, 6 * sizeof(sexpr)); + f = (sexpr *)GC_MALLOC(4 * sizeof(sexpr)); + f = (sexpr *)GC_REALLOC((GC_PTR)f, 6 * sizeof(sexpr)); f[5] = ints(1,17); - g = (sexpr *)GC_malloc(513 * sizeof(sexpr)); - g = (sexpr *)GC_realloc((GC_PTR)g, 800 * sizeof(sexpr)); + g = (sexpr *)GC_MALLOC(513 * sizeof(sexpr)); + g = (sexpr *)GC_REALLOC((GC_PTR)g, 800 * sizeof(sexpr)); g[799] = ints(1,18); - h = (sexpr *)GC_malloc(1025 * sizeof(sexpr)); - h = (sexpr *)GC_realloc((GC_PTR)h, 2000 * sizeof(sexpr)); + h = (sexpr *)GC_MALLOC(1025 * sizeof(sexpr)); + h = (sexpr *)GC_REALLOC((GC_PTR)h, 2000 * sizeof(sexpr)); h[1999] = ints(1,19); /* Try to force some collections and reuse of small list elements */ for (i = 0; i < 10; i++) { @@ -453,7 +450,7 @@ VOLATILE int dropped_something = 0; static mutex_t incr_lock; mutex_lock(&incr_lock); # 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; pthread_mutex_lock(&incr_lock); # endif @@ -471,7 +468,7 @@ VOLATILE int dropped_something = 0; # ifdef SOLARIS_THREADS mutex_unlock(&incr_lock); # endif -# if defined(IRIX_THREADS) || defined(LINUX_THREADS) +# if defined(IRIX_THREADS) || defined(LINUX_THREADS) || defined(HPUX_THREADS) pthread_mutex_unlock(&incr_lock); # endif # ifdef WIN32_THREADS @@ -532,7 +529,8 @@ int n; static mutex_t incr_lock; mutex_lock(&incr_lock); # 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; pthread_mutex_lock(&incr_lock); # endif @@ -548,7 +546,8 @@ int n; # ifdef SOLARIS_THREADS mutex_unlock(&incr_lock); # endif -# if defined(IRIX_THREADS) || defined(LINUX_THREADS) +# if defined(IRIX_THREADS) || defined(LINUX_THREADS) \ + || defined(HPUX_THREADS) pthread_mutex_unlock(&incr_lock); # endif # ifdef WIN32_THREADS @@ -610,8 +609,8 @@ thread_key_t fl_key; void * alloc8bytes() { -# ifdef SMALL_CONFIG - return(GC_malloc(8)); +# if defined(SMALL_CONFIG) || defined(GC_DEBUG) + return(GC_MALLOC(8)); # else void ** my_free_list_ptr; void * my_free_list; @@ -644,7 +643,7 @@ void * alloc8bytes() #else # if defined(_SOLARIS_PTHREADS) || defined(IRIX_THREADS) \ - || defined(LINUX_THREADS) + || defined(LINUX_THREADS) || defined(HPUX_THREADS) pthread_key_t fl_key; void * alloc8bytes() @@ -857,6 +856,7 @@ void run_one_test() (void)GC_printf0("GC_malloc_uncollectable(0) failed\n"); FAIL; } + GC_FREE(0); GC_is_valid_displacement_print_proc = fail_proc1; GC_is_visible_print_proc = fail_proc1; x = GC_malloc(16); @@ -879,7 +879,7 @@ void run_one_test() FAIL; } 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 */ /* data segment, so there should have been no failures. */ (void)GC_printf0("GC_is_visible produced wrong failure indication\n"); @@ -1030,7 +1030,8 @@ void SetMinimumStack(long minSize) #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 int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n) #else @@ -1161,7 +1162,8 @@ test() } #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) { run_one_test(); @@ -1222,7 +1224,7 @@ main() *((volatile char *)&code - 1024*1024) = 0; /* Require 1 Mb */ # endif /* IRIX_THREADS */ pthread_attr_init(&attr); -# ifdef IRIX_THREADS +# if defined(IRIX_THREADS) || defined(HPUX_THREADS) pthread_attr_setstacksize(&attr, 1000000); # endif n_tests = 0; @@ -1232,7 +1234,7 @@ main() (void) GC_printf0("Emulating dirty bits with mprotect/signals\n"); # endif (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); FAIL; } @@ -1260,4 +1262,4 @@ main() return(0); } #endif /* pthreads */ -#endif /* SOLARIS_THREADS || IRIX_THREADS || LINUX_THREADS */ +#endif /* SOLARIS_THREADS || IRIX_THREADS || LINUX_THREADS || HPUX_THREADS */