PATCH: Fix boehm-gc IRIX bitrot

Mark Mitchell mark@codesourcery.com
Sun May 19 10:38:00 GMT 2002


The IRIX stuff in boehm-gc failed to build due to bitrot.  Here are
patches to bring it back to building, and, so far as I can tell,
working.

Bootstrapped and tested on mips-sgi-irix6.5.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Sun May 19 11:32:03 2002  Mark P Mitchell  <mark@codesourcery.com>

	* irix_threads.cc (GC_pthread_detach): Do not use REAL_FUNC.
	(GC_pthread_create): Fix typo.
	(GC_TRY_LOCK): Likewise.
	* include/private/gc_locks.h (GC_test_and_set): Only take one
	one argument.
	(LOCK): Adjust appropriately.
	* include/private/gc_priv.h (SIG_SUSPEND): Use SIGRTMIN if 
	_SIGRTMIN is unavailable.

Index: boehm-gc/irix_threads.c
===================================================================
RCS file: /usr/local/Repository/gcc/boehm-gc/irix_threads.c,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 irix_threads.c
*** boehm-gc/irix_threads.c	2002/04/28 19:17:09	1.1.1.1
--- boehm-gc/irix_threads.c	2002/05/19 17:15:06
*************** int GC_pthread_detach(pthread_t thread)
*** 519,525 ****
      LOCK();
      thread_gc_id = GC_lookup_thread(thread);
      UNLOCK();
!     result = REAL_FUNC(pthread_detach)(thread);
      if (result == 0) {
        LOCK();
        thread_gc_id -> flags |= DETACHED;
--- 519,525 ----
      LOCK();
      thread_gc_id = GC_lookup_thread(thread);
      UNLOCK();
!     result = pthread_detach(thread);
      if (result == 0) {
        LOCK();
        thread_gc_id -> flags |= DETACHED;
*************** GC_pthread_create(pthread_t *new_thread,
*** 599,605 ****
      si -> start_routine = start_routine;
      si -> arg = arg;
      LOCK();
!     if (!GC_initialized) GC_init();
      if (NULL == attr) {
          stack = 0;
  	(void) pthread_attr_init(&new_attr);
--- 599,605 ----
      si -> start_routine = start_routine;
      si -> arg = arg;
      LOCK();
!     if (!GC_is_initialized) GC_init();
      if (NULL == attr) {
          stack = 0;
  	(void) pthread_attr_init(&new_attr);
*************** VOLATILE GC_bool GC_collecting = 0;
*** 655,661 ****
  #define SLEEP_THRESHOLD 3
  
  unsigned long GC_allocate_lock = 0;
! # define GC_TRY_LOCK() !GC_test_and_set(&GC_allocate_lock,1)
  # define GC_LOCK_TAKEN GC_allocate_lock
  
  void GC_lock()
--- 655,661 ----
  #define SLEEP_THRESHOLD 3
  
  unsigned long GC_allocate_lock = 0;
! # define GC_TRY_LOCK() !GC_test_and_set(&GC_allocate_lock)
  # define GC_LOCK_TAKEN GC_allocate_lock
  
  void GC_lock()
Index: boehm-gc/include/private/gc_locks.h
===================================================================
RCS file: /usr/local/Repository/gcc/boehm-gc/include/private/gc_locks.h,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 gc_locks.h
*** boehm-gc/include/private/gc_locks.h	2002/04/28 19:17:10	1.1.1.1
--- boehm-gc/include/private/gc_locks.h	2002/05/19 17:15:06
***************
*** 221,229 ****
  #  ifdef MIPS
  #    if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) \
  	|| !defined(_COMPILER_VERSION) || _COMPILER_VERSION < 700
! #        define GC_test_and_set(addr, v) test_and_set(addr,v)
  #    else
! #	 define GC_test_and_set(addr, v) __test_and_set(addr,v)
  #	 define GC_clear(addr) __lock_release(addr);
  #	 define GC_CLEAR_DEFINED
  #    endif
--- 221,229 ----
  #  ifdef MIPS
  #    if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) \
  	|| !defined(_COMPILER_VERSION) || _COMPILER_VERSION < 700
! #        define GC_test_and_set(addr) test_and_set(addr, 1)
  #    else
! #	 define GC_test_and_set(addr) __test_and_set(addr,1)
  #	 define GC_clear(addr) __lock_release(addr);
  #	 define GC_CLEAR_DEFINED
  #    endif
***************
*** 431,437 ****
  #    define NO_THREAD (pthread_t)(-1)
  #    define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
  #    define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
! #    define LOCK() { if (GC_test_and_set(&GC_allocate_lock, 1)) GC_lock(); }
  #    define UNLOCK() GC_clear(&GC_allocate_lock);
       extern VOLATILE GC_bool GC_collecting;
  #    define ENTER_GC() \
--- 431,437 ----
  #    define NO_THREAD (pthread_t)(-1)
  #    define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
  #    define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
! #    define LOCK() { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); }
  #    define UNLOCK() GC_clear(&GC_allocate_lock);
       extern VOLATILE GC_bool GC_collecting;
  #    define ENTER_GC() \
Index: boehm-gc/include/private/gc_priv.h
===================================================================
RCS file: /usr/local/Repository/gcc/boehm-gc/include/private/gc_priv.h,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 gc_priv.h
*** boehm-gc/include/private/gc_priv.h	2002/04/28 19:17:10	1.1.1.1
--- boehm-gc/include/private/gc_priv.h	2002/05/19 17:15:08
*************** void GC_err_puts GC_PROTO((GC_CONST char
*** 1916,1922 ****
  #      define SIG_SUSPEND SIGPWR
  #    endif
  #   else  /* !GC_LINUX_THREADS */
! #    define SIG_SUSPEND _SIGRTMIN + 6
  #   endif
  #  endif /* !SIG_SUSPEND */
    
--- 1916,1926 ----
  #      define SIG_SUSPEND SIGPWR
  #    endif
  #   else  /* !GC_LINUX_THREADS */
! #     if defined(_SIGRTMIN)
! #       define SIG_SUSPEND _SIGRTMIN + 6
! #     else
! #       define SIG_SUSPEND SIGRTMIN + 6
! #     endif       
  #   endif
  #  endif /* !SIG_SUSPEND */
    



More information about the Java mailing list