* configure.in: New check for uca lib (needed for IA64 on HP-UX).
authorNeil Jerram <neil@ossau.uklinux.net>
Wed, 25 Oct 2006 22:37:24 +0000 (22:37 +0000)
committerNeil Jerram <neil@ossau.uklinux.net>
Wed, 25 Oct 2006 22:37:24 +0000 (22:37 +0000)
* threads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp() and
scm_ia64_register_backing_store_base() instead of Linux-specific
implementations.

* gc.h (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp):
New declarations.

* gc.c (__libc_ia64_register_backing_store_base): Declaration
removed.
(scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, with
implementations for Linux and HP-UX.

* coop-pthreads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp()
and scm_ia64_register_backing_store_base() instead of
Linux-specific implementations.

* continuations.h (__libc_ia64_register_backing_store_base):
Declaration removed.
(scm_t_contregs): New "fresh" field.

* continuations.c (ia64_getcontext): Removed.
(scm_make_continuation): Use continuation fresh field instead of
interpreting getcontext return values (which isn't portable).  Use
scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base()
instead of Linux-specific implementations.
(copy_stack_and_call): Use scm_ia64_register_backing_store_base()
instead of Linux-specific implementation.

* _scm.h (__ia64__): Also detect __ia64.

ChangeLog
configure.in
libguile/ChangeLog
libguile/_scm.h
libguile/continuations.c
libguile/continuations.h
libguile/coop-pthreads.c
libguile/gc.c
libguile/gc.h
libguile/threads.c

index aad1690..637b8fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-25  Neil Jerram  <neil@ossau.uklinux.net>
+
+       IA64 HP-UX patch from Hrvoje Nikšić.  (Thanks!)
+       
+       * configure.in: New check for uca lib (needed for IA64 on HP-UX).
+
 2006-10-06  Rob Browning  <rlb@defaultvalue.org>
 
        Guile 1.8.1 released.
@@ -23,7 +29,7 @@
 
        * configure.in (complex.h, complex double, csqrt): New tests.
 
-2006-09-20  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2006-09-20  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * configure.in: Check for `isblank ()'.
 
@@ -57,7 +63,7 @@
 
        * configure.in (AC_CHECK_MEMBERS): Test struct tm.tm_gmtoff.
 
-2006-06-13  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2006-06-13  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * NEWS: Mentioned the new behavior of `equal?' for structures.
 
 
        * acinclude.m4 (ACX_PTHREAD): New.
        * configure.in: Use it instead of simply looking for -lpthread.
-       Thanks to Andreas Vögele!
+       Thanks to Andreas Vögele!
        
 2004-09-08  Marius Vollmer  <marius.vollmer@uni-dortmund.de>
 
 2004-07-09  Marius Vollmer  <mvo@zagadka.de>
 
        * configure.in: Bugfix: set SCM_I_GSC_T_UINTMAX, not
-       SCM_I_GSC_T_INTMAX in two places.  Thanks to Andreas Vögele!
+       SCM_I_GSC_T_INTMAX in two places.  Thanks to Andreas Vögele!
 
 2004-07-07  Marius Vollmer  <marius.vollmer@uni-dortmund.de>
 
@@ -2032,7 +2038,7 @@ Tue Dec 14 09:12:22 1999  Greg J. Badros  <gjb@cs.washington.edu>
 
 1999-07-19  Jim Blandy  <jimb@savonarola.red-bean.com>
 
-       Fixes for EMX from Mikael Ståldal.
+       Fixes for EMX from Mikael Ståldal.
 
        * configure.in: Check for <io.h>.
        * configure: Regenerated.
index 9578cdf..e63c0a7 100644 (file)
@@ -212,6 +212,7 @@ if test "$enable_elisp" = yes; then
 else
   SCM_I_GSC_ENABLE_ELISP=0
 fi
+AC_CHECK_LIB(uca, __uc_get_ar_bsp)
 
 AC_C_CONST
 
@@ -221,6 +222,7 @@ if test "$ac_cv_c_inline" != no; then
 else
   SCM_I_GSC_C_INLINE=NULL
 fi
+AC_CHECK_LIB(uca, __uc_get_ar_bsp)
 
 AC_C_BIGENDIAN
 
index 01a17aa..6d3a2db 100644 (file)
@@ -1,3 +1,37 @@
+2006-10-25  Neil Jerram  <neil@ossau.uklinux.net>
+
+       IA64 HP-UX GC patch from Hrvoje Nikšić.  (Thanks!)
+       
+       * threads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp() and
+       scm_ia64_register_backing_store_base() instead of Linux-specific
+       implementations.
+
+       * gc.h (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp):
+       New declarations.
+
+       * gc.c (__libc_ia64_register_backing_store_base): Declaration
+       removed.
+       (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, with
+       implementations for Linux and HP-UX.
+
+       * coop-pthreads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp()
+       and scm_ia64_register_backing_store_base() instead of
+       Linux-specific implementations.
+
+       * continuations.h (__libc_ia64_register_backing_store_base):
+       Declaration removed.
+       (scm_t_contregs): New "fresh" field.
+
+       * continuations.c (ia64_getcontext): Removed.
+       (scm_make_continuation): Use continuation fresh field instead of
+       interpreting getcontext return values (which isn't portable).  Use
+       scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base()
+       instead of Linux-specific implementations.
+       (copy_stack_and_call): Use scm_ia64_register_backing_store_base()
+       instead of Linux-specific implementation.
+
+       * _scm.h (__ia64__): Also detect __ia64.
+
 2006-10-03  Kevin Ryde  <user42@zip.com.au>
 
        * eval.c (SCM_APPLY): For scm_tc7_subr_2o, throw wrong-num-args on 0
@@ -45,7 +79,7 @@
        * numbers.c, numbers.h (scm_log, scm_log10, scm_exp, scm_sqrt): New
        functions.
 
-2006-09-20  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2006-09-20  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * srfi-14.c: Include <config.h>.  Define `_GNU_SOURCE'.
        (make_predset, define_predset, make_strset, define_strset, false,
        arrangements and avoid an illegal instruction during
        call-with-current-continuation.
 
-2006-07-12  Ludovic Courtès <ludovic.courtes@laas.fr>
+2006-07-12  Ludovic Courtès <ludovic.courtes@laas.fr>
 
        * numbers.c (guile_ieee_init): Use regular ANSI C casts rather
        than C++-style `X_CAST ()'.  Patch posted by by Mike Gran.
        (scm_strptime): Use tm_gmtoff from the strptime result when that field
        exists, it's set by glibc strptime "%s".
        
-2006-06-13  Ludovic Courtès <ludovic.courtes@laas.fr>
+2006-06-13  Ludovic Courtès <ludovic.courtes@laas.fr>
 
        * eq.c: Include "struct.h", "goops.h" and "objects.h".
        (scm_equal_p): Invoke `scm_i_struct_equalp ()' on structures that
 2006-04-06  Kevin Ryde  <user42@zip.com.au>
 
        * fports.c (scm_setvbuf): Fix for not _IOLBF, clear SCM_BUFLINE
-       instead of toggling it.  Reported by Ludovic Courtès.
+       instead of toggling it.  Reported by Ludovic Courtès.
        
 2006-03-26  Marius Vollmer  <mvo@zagadka.de>
 
        * gc_os_dep.c (scm_get_stack_base): Abort when the machine type is
        unknown instead of returning NULL.
 
-2006-03-21  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2006-03-21  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
         * numbers.c (scm_i_mem2number): Renamed to
        scm_c_locale_stringn_to_number.
         (scm_i_sweep_statistics_init): New macro.
         (scm_i_sweep_statistics_sum): New macro
 
-2006-02-14  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2006-02-14  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
         * strings.c (scm_i_take_stringbufn): Register LEN+1 bytes instead of
        LEN.  Without this, too much collectable memory gets unregistered,
        * inline.h, pairs.c (scm_is_pair): Moved scm_is_pair from pairs.c
        to inline.h to make it inline.
 
-2005-12-19  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2005-12-19  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
         * strings.c (scm_i_take_stringbufn): New.
         (scm_i_c_take_symbol): New.
 
 2005-12-29  Neil Jerram  <neil@ossau.uklinux.net>
 
-       * fluids.c (next_fluid_num): [From Ludovic Courtès:] Don't trigger
+       * fluids.c (next_fluid_num): [From Ludovic Courtès:] Don't trigger
        the GC when allocated_fluids_len is zero.
 
 2005-12-14  Neil Jerram  <neil@ossau.uklinux.net>
 
        * srfi-4.h, srfi-4.c, srfi-4.i.c (take_uvec): Make BASE pointer
        non-const.
-       (scm_take_u8vector, etc): Likewise.  Thanks to Ludovic Courtès!
+       (scm_take_u8vector, etc): Likewise.  Thanks to Ludovic Courtès!
        
        * threads.h, threads.c (scm_t_guile_ticket, scm_leave_guile,
        scm_enter_guile): Removed from public API.  See comment at
        * eval.c (scm_m_cond): Recognize SRFI 61 cond syntax.
        (CEVAL): Evaluate SRFI 61 cond clauses.
 
-2005-12-06  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2005-12-06  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * gc-card.c (scm_i_card_statistics): Return if BITVEC is NULL.
        This was typically hit when running `gc-live-object-stats' right
 2005-11-26  Kevin Ryde  <user42@zip.com.au>
 
        * gc-mark.c (scm_mark_all): Change C++ comment to C comment.  Reported
-       by Ludovic Courtès.
+       by Ludovic Courtès.
 
        * list.c (list): Should be "primitive" in SCM_SNARF_DOCS, not
        "register".
        * socket.c (scm_fill_sockaddr): Remove SCM_C_INLINE_KEYWORD, this is
        much too big to want to inline.
 
-2005-11-17  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2005-11-17  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * print.c (EXIT_NESTED_DATA): Before popping from the stack, reset
        the value at its top.  This fixes a reference leak.
        `PSTATE_STACK_SET ()' in order to avoid undesired potential side
        effects.
 
-2005-11-12  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2005-11-12  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * gc.c (scm_weak_vectors): Removed.
 
 2005-11-12  Kevin Ryde  <user42@zip.com.au>
 
        * socket.c (scm_setsockopt): Missing @defvar in docstring.  Reported
-       by Ludovic Courtès.
+       by Ludovic Courtès.
 
 2005-11-07  Marius Vollmer  <mvo@zagadka.de>
 
 
        * debug.h (SCM_CHEAPTRAPS_P): Removed.
 
-2005-10-27  Ludovic Courtès  <ludovic.courtes@laas.fr>
+2005-10-27  Ludovic Courtès  <ludovic.courtes@laas.fr>
 
        * socket.c (scm_fill_sockaddr): No need to check NULL from scm_malloc.
        (scm_connect, scm_bind, scm_sendto): Accept sockaddr object.
 
 2005-05-11  Neil Jerram  <neil@ossau.uklinux.net>
 
-       Fix C99isms reported by Ludovic Courtès:
+       Fix C99isms reported by Ludovic Courtès:
        
        * threads.c (s_scm_lock_mutex): Don't declare msg in middle of
        code.
 2005-03-18  Kevin Ryde  <user42@zip.com.au>
 
        * arbiters.c (FETCH_STORE) [generic C]: Should be
-       scm_i_scm_pthread_mutex_lock/unlock now.  Reported by Ludovic Courtès.
+       scm_i_scm_pthread_mutex_lock/unlock now.  Reported by Ludovic Courtès.
 
 2005-03-13  Kevin Ryde  <user42@zip.com.au>
 
 
 2004-11-02  Marius Vollmer  <mvo@zagadka.de>
 
-        Mac OS X and OpenBSD compatibility patches from Andreas Vögele.
+        Mac OS X and OpenBSD compatibility patches from Andreas Vögele.
        Thanks!
 
        * backtrace.c (scm_display_backtrace_with_highlights): Join the
        * numbers.h, numbers.c: Include <gmp.h> in numbers.h, not in
        numbers.c.
        (scm_to_mpz, scm_from_mpz): New.
-       Thanks to Andreas Vögele!
+       Thanks to Andreas Vögele!
        
        * read.c (skip_scsh_block_comment): Recognize "!#" everywhere, not
        just on a line of its own.
        scm_string_tabulate, string_upcase_x, string_down_case_x,
        string_titlecase_x, string_reverse_x, scm_string_tokenize): Use
        size_t instead of int for indices into strings.  Make sure that no
-       over- or underflow occurs.  Thanks to Andreas Vögele!
+       over- or underflow occurs.  Thanks to Andreas Vögele!
        (scm_xsubstring, scm_string_xcopy_x): Use ints for 'extended'
        indices, which can also be negative.
        
 
        * filesys.c, stime.c (_POSIX_C_SOURCE): Use this only on hpux, it
        causes too many problems elsewhere (glibc, freebsd, mingw).  Reported
-       by Andreas Vögele.
+       by Andreas Vögele.
 
 2004-09-08  Marius Vollmer  <marius.vollmer@uni-dortmund.de>
 
        * gc_os_dep.c: update ifdefery for macosx.
        (scm_get_stack_base): separate result initialization from
        declaration to slience warnings with macosx and hp-ux using gcc
-       3.3.  Thanks to Andreas Vögele.
+       3.3.  Thanks to Andreas Vögele.
 
 2004-06-13  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
 2004-05-02  Kevin Ryde  <user42@zip.com.au>
 
        * eval.c (scm_macroexp): Add prototype, since it's not in eval.h under
-       --disable-deprecated.  Reported by Andreas Vögele.
+       --disable-deprecated.  Reported by Andreas Vögele.
 
        * filesys.c (_POSIX_C_SOURCE): Define to 199506L to get readdir_r (in
-       particular on HP-UX).  Reported by Andreas Vögele.
+       particular on HP-UX).  Reported by Andreas Vögele.
 
        * list.c (varargs.h): Remove, leave just stdarg.h which is all the
        code has support for.  Fixes building with AIX cc, which is ansi but
 2004-05-01  Kevin Ryde  <user42@zip.com.au>
 
        * continuations.c (scm_dynthrow): Use >= instead of SCM_PTR_GE which
-       is now gone.  Reported by Andreas Vögele.
+       is now gone.  Reported by Andreas Vögele.
 
 2004-04-28  Kevin Ryde  <user42@zip.com.au>
 
        * backtrace.c (display_frame_expr), numbers.c (XDIGIT2UINT,
        mem2uinteger, mem2decimal_from_point, mem2ureal): Cast char to int for
        ctype.h tests, to avoid warnings from gcc on HP-UX about char as array
-       subscript.  Reported by Andreas Vögele.
+       subscript.  Reported by Andreas Vögele.
        Also cast through unsigned char to avoid passing negatives to those
        macros if input contains 8-bit values.
 
        
        * numbers.c (scm_bit_extract): Use min instead of MIN.
        (MIN): Remove, this conflicts with similar macro defined by limits.h
-       on HP-UX.  Reported by Andreas Vögele.
+       on HP-UX.  Reported by Andreas Vögele.
 
        * stime.c (_POSIX_C_SOURCE): Define to 199506L to get gmtime_r (in
-       particular on HP-UX).  Reported by Andreas Vögele.
+       particular on HP-UX).  Reported by Andreas Vögele.
 
        * threads.c (scm_threads_mark_stacks): Correction sizet -> size_t.
-       Reported by Andreas Vögele.
+       Reported by Andreas Vögele.
 
        * threads-plugin.h (SCM_MUTEX_MAXSIZE): Increase to 25*sizeof(long),
        for the benefit of hpux11 where pthread_mutex_t is 88 bytes.  Reported
-       by Andreas Vögele.
+       by Andreas Vögele.
 
 2004-04-22  Dirk Herrmann  <dirk@dirk-herrmanns-seiten.de>
 
 2002-08-26  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * script.c (scm_compile_shell_switches): Added "2002" to Copyright
-       years.  Thanks to Martin Grabmüller!
+       years.  Thanks to Martin Grabmüller!
 
 2002-08-25  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * deprecation.c (scm_include_deprecated_features): Simplified.
 
        * eval.c (EVALCAR, unmemocopy), eval.h (SCM_XEVALCAR): Use
-       `SCM_IMP' instead of `!SCM_CELLP´.
+       `SCM_IMP' instead of `!SCM_CELLP´.
 
        * eval.c (unmemocopy): Eliminate redundant SCM_CELLP tests.
        Extract side-effecting operations from macros.
 2001-06-09  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * ports.c (scm_lfwrite): Maintain columnd and row count in port.
-       Thanks to Matthias Köppe!
+       Thanks to Matthias Köppe!
 
 2001-06-08  Michael Livshin  <mlivshin@bigfoot.com>
 
        space-happy C preprocessors.
 
        * filter-doc-snarfage.c, guile-snarf.in: try to cope with spaces
-       inside cookies.  thanks to Matthias Köppe!
+       inside cookies.  thanks to Matthias Köppe!
 
 2001-06-08  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        SCM_VARIABLE_INIT since that it what it used to be.
 
        * deprecation.c (scm_include_deprecated_features): Make docstring
-       ANSIsh.  Thanks to Matthias Köppe!
+       ANSIsh.  Thanks to Matthias Köppe!
 
 2001-05-21  Marius Vollmer  <mvo@zagadka.ping.de>
 
 2001-05-15  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * values.c (print_values): Print as a unreadable object, not as
-       multiple lines.  Thanks to Matthias Köppe!
+       multiple lines.  Thanks to Matthias Köppe!
 
 2001-05-14  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
 
 2001-05-09  Michael Livshin  <mlivshin@bigfoot.com>
 
-       from Matthias Köppe (thanks!):
+       from Matthias Köppe (thanks!):
 
        * ports.c (scm_c_read): pointer arithmetic on void pointers isn't
        portable.
 
 2001-01-11  Michael Livshin  <mlivshin@bigfoot.com>
 
-       from Matthias Köppe:
+       from Matthias Köppe:
 
        * objects.h (SCM_SET_ENTITY_SETTER): new macro.  SCM_ENTITY_SETTER
        casts its result, so doesn't yield an lvalue per ANSI C.
index 906de37..fd05770 100644 (file)
@@ -54,6 +54,9 @@
  and differences between _scm.h and __scm.h.
  **********************************************************************/
 
+#if defined(__ia64) && !defined(__ia64__)
+# define __ia64__
+#endif
 
 #if HAVE_CONFIG_H
 #  include <config.h>
index 5ae89d8..39785a5 100644 (file)
@@ -92,22 +92,6 @@ continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
   return 1;
 }
 
-#ifdef __ia64__
-/* Extern declaration of getcontext()/setcontext() in order to redefine
-   getcontext() since on ia64-linux the second return value indicates whether
-   it returned from getcontext() itself or by running setcontext(). */
-struct rv
-{
-  long retval;
-  long first_return;
-};
-
-#ifdef __GNUC__
-__attribute__ ((returns_twice))
-#endif /* __GNUC__ */
-extern struct rv ia64_getcontext (ucontext_t *) __asm__ ("getcontext");
-#endif /* __ia64__ */
-
 /* this may return more than once: the first time with the escape
    procedure, then subsequently with the value to be passed to the
    continuation.  */
@@ -120,9 +104,6 @@ scm_make_continuation (int *first)
   scm_t_contregs *continuation;
   long stack_size;
   SCM_STACKITEM * src;
-#ifdef __ia64__
-  struct rv rv;
-#endif /* __ia64__ */
 
   SCM_FLUSH_REGISTER_WINDOWS;
   stack_size = scm_stack_size (thread->continuation_base);
@@ -144,20 +125,23 @@ scm_make_continuation (int *first)
   memcpy (continuation->stack, src, sizeof (SCM_STACKITEM) * stack_size);
 
 #ifdef __ia64__
-  rv = ia64_getcontext (&continuation->ctx);
-  if (rv.first_return)
+  continuation->fresh = 1;
+  getcontext (&continuation->ctx);
+  if (continuation->fresh)
     {
-      continuation->backing_store_size = 
-        continuation->ctx.uc_mcontext.sc_ar_bsp - 
-        (unsigned long) __libc_ia64_register_backing_store_base;
+      continuation->backing_store_size =
+       (char *) scm_ia64_ar_bsp(&continuation->ctx)
+       -
+       (char *) scm_ia64_register_backing_store_base ();
       continuation->backing_store = NULL;
       continuation->backing_store = 
         scm_gc_malloc (continuation->backing_store_size,
                       "continuation backing store");
       memcpy (continuation->backing_store, 
-              (void *) __libc_ia64_register_backing_store_base
+              (void *) scm_ia64_register_backing_store_base ()
               continuation->backing_store_size);
       *first = 1;
+      continuation->fresh = 0;
       return cont;
     }
   else
@@ -252,7 +236,7 @@ copy_stack_and_call (scm_t_contregs *continuation, SCM val,
 
   continuation->throw_value = val;
 #ifdef __ia64__
-  memcpy ((void *) __libc_ia64_register_backing_store_base,
+  memcpy (scm_ia64_register_backing_store_base (),
           continuation->backing_store,
           continuation->backing_store_size);
   setcontext (&continuation->ctx);
index d102979..0274c1b 100644 (file)
@@ -27,7 +27,6 @@
 #ifdef __ia64__
 #include <signal.h>
 #include <ucontext.h>
-extern unsigned long * __libc_ia64_register_backing_store_base;
 #endif /* __ia64__ */
 \f
 
@@ -48,6 +47,7 @@ typedef struct
   SCM dynenv;
 #ifdef __ia64__
   ucontext_t ctx;
+  int fresh;
   void *backing_store;
   unsigned long backing_store_size;
 #endif /* __ia64__ */
index a9b1b86..b1759f9 100644 (file)
@@ -31,6 +31,7 @@
 #include "libguile/eval.h"
 #include "libguile/async.h"
 #include "libguile/ports.h"
+#include "libguile/gc.h"
 
 #undef DEBUG
 
@@ -847,8 +848,8 @@ scm_threads_init (SCM_STACKITEM *base)
     scm_mark_locations ((SCM_STACKITEM *) &ctx.uc_mcontext,           \
       ((size_t) (sizeof (SCM_STACKITEM) - 1 + sizeof ctx.uc_mcontext) \
        / sizeof (SCM_STACKITEM)));                                    \
-    bot = (SCM_STACKITEM *) __libc_ia64_register_backing_store_base;  \
-    top = (SCM_STACKITEM *) ctx.uc_mcontext.sc_ar_bsp;                \
+    bot = (SCM_STACKITEM *) scm_ia64_register_backing_store_base ();  \
+    top = (SCM_STACKITEM *) scm_ia64_ar_bsp (&ctx);                   \
     scm_mark_locations (bot, top - bot); } while (0)
 #else
 # define SCM_MARK_BACKING_STORE()
index 30d1cad..8998488 100644 (file)
 #include <string.h>
 #include <assert.h>
 
-#ifdef __ia64__
-#include <ucontext.h>
-extern unsigned long * __libc_ia64_register_backing_store_base;
-#endif
-
 #include "libguile/_scm.h"
 #include "libguile/eval.h"
 #include "libguile/stime.h"
@@ -1036,6 +1031,44 @@ scm_init_gc ()
 #include "libguile/gc.x"
 }
 
+#ifdef __ia64__
+# ifdef __hpux
+#  include <sys/param.h>
+#  include <sys/pstat.h>
+void *
+scm_ia64_register_backing_store_base (void)
+{
+  struct pst_vm_status vm_status;
+  int i = 0;
+  while (pstat_getprocvm (&vm_status, sizeof (vm_status), 0, i++) == 1)
+    if (vm_status.pst_type == PS_RSESTACK)
+      return (void *) vm_status.pst_vaddr;
+  abort ();
+}
+void *
+scm_ia64_ar_bsp (const void *ctx)
+{
+  uint64_t bsp;
+  __uc_get_ar_bsp(ctx, &bsp);
+  return (void *) bsp;
+}
+# endif /* hpux */
+# ifdef linux
+#  include <ucontext.h>
+void *
+scm_ia64_register_backing_store_base (void)
+{
+  extern void *__libc_ia64_register_backing_store_base;
+  return __libc_ia64_register_backing_store_base;
+}
+void *
+scm_ia64_ar_bsp (const void *opaque)
+{
+  ucontext_t *ctx = opaque;
+  return (void *) ctx->uc_mcontext.sc_ar_bsp;
+}
+# endif        /* linux */
+#endif /* __ia64__ */
 
 void
 scm_gc_sweep (void)
index 439cf8a..7c991bf 100644 (file)
@@ -246,6 +246,11 @@ SCM_API scm_i_pthread_mutex_t scm_i_gc_admin_mutex;
 #define scm_gc_running_p (SCM_I_CURRENT_THREAD->gc_running_p)
 SCM_API scm_i_pthread_mutex_t scm_i_sweep_mutex;
 
+#ifdef __ia64__
+void *scm_ia64_register_backing_store_base (void);
+void *scm_ia64_ar_bsp (const void *);
+#endif
+
 \f
 
 #if (SCM_ENABLE_DEPRECATED == 1)
index 428133d..6e2bce9 100644 (file)
@@ -1304,8 +1304,8 @@ SCM_DEFINE (scm_broadcast_condition_variable, "broadcast-condition-variable", 1,
     scm_mark_locations ((SCM_STACKITEM *) &ctx.uc_mcontext,           \
       ((size_t) (sizeof (SCM_STACKITEM) - 1 + sizeof ctx.uc_mcontext) \
        / sizeof (SCM_STACKITEM)));                                    \
-    bot = (SCM_STACKITEM *) __libc_ia64_register_backing_store_base;  \
-    top = (SCM_STACKITEM *) ctx.uc_mcontext.sc_ar_bsp;                \
+    bot = (SCM_STACKITEM *) scm_ia64_register_backing_store_base ();  \
+    top = (SCM_STACKITEM *) scm_ia64_ar_bsp (&ctx);                   \
     scm_mark_locations (bot, top - bot); } while (0)
 #else
 # define SCM_MARK_BACKING_STORE()