Commit 90bf8c23 authored by separdau's avatar separdau

Merge des threads

Added --enable-threads={none,lurc,pthreads} to configure
Added support for no threads and lurc threads.
Basic srfi-18 support extended for lurc, plus lurc.stk for additionnal
 functions.
New GC with lurc support.
Examples in examples/thread.stk
boot.stk now generated in configure
callcc.stk out of r5rs.stk
parent c62502cf
......@@ -73,6 +73,7 @@ AMTAR = @AMTAR@
AWK = @AWK@
BUILD_ARCH = @BUILD_ARCH@
BUILD_OS = @BUILD_OS@
CALLCC_STK = @CALLCC_STK@
CC = @CC@
COMPOBJ = @COMPOBJ@
COMPSRC = @COMPSRC@
......@@ -277,7 +278,7 @@ distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/doc $(distdir)/doc/skb $(distdir)/extensions $(distdir)/gtklos $(distdir)/src $(distdir)/utils
$(mkinstalldirs) $(distdir)/doc $(distdir)/doc/skb $(distdir)/extensions $(distdir)/gtklos $(distdir)/lib $(distdir)/src $(distdir)/utils
@list='$(DISTFILES)'; for file in $$list; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
......
This diff is collapsed.
......@@ -77,6 +77,7 @@ dnl Now look at what threads we want
case "$THREADS" in
no | none | single)
THREADS=none
CALLCC_STK=callcc.stk
AC_DEFINE(THREADS_NONE, [], [No thread support])
;;
posix | pthreads)
......@@ -84,6 +85,7 @@ case "$THREADS" in
AC_CHECK_LIB(pthread, pthread_create, LIBS="-lpthread $LIBS",
[AC_MSG_ERROR([Missing PThread library])])
THREADS=pthreads
CALLCC_STK=callcc.stk
AC_DEFINE(THREADS_PTHREADS, [], [PThread support])
;;
lurc)
......@@ -98,6 +100,7 @@ case "$THREADS" in
[AC_MSG_ERROR([Missing GC support in LURC])])
dnl That should be good
AC_DEFINE(THREADS_LURC, [], [LURC threads support])
CALLCC_STK=dyn-wind-lurc.stk
;;
*)
AC_MSG_ERROR([Unknown thread system: $THREADS])
......@@ -312,13 +315,13 @@ then
GC=gc
GCLIB="../gc/.libs/libgc.a"
GCINC="-I../gc/include"
AC_DEFINE(HAVE_GC, [], [Use system GC])
# Eventually add a distclean target to the GC Makefile
else
echo "Using the system Boehm-Demers-Weiser library"
GC=""
GCLIB="-lgc"
GCINC=""
AC_DEFINE(HAVE_GC, [], [Use system GC])
fi
if test "$HAVE_PCRE" = "no"
......@@ -491,11 +494,11 @@ AC_SUBST(DEF_PCRE)
AC_SUBST(SVN_URL)
AC_SUBST(THREADS)
AC_SUBST(LURCDIR)
AC_SUBST(CALLCC_STK)
AC_OUTPUT(Makefile src/Makefile src/extraconf.h doc/Makefile
lib/Makefile gtklos/Makefile gtklos/gtklosconf.h
utils/Makefile
utils/Makefile lib/boot.stk
utils/stklos-config utils/stklos-script
extensions/Makefile examples/Makefile
examples/images/Makefile lib/Match.d/Makefile
......
......@@ -74,6 +74,7 @@ AMTAR = @AMTAR@
AWK = @AWK@
BUILD_ARCH = @BUILD_ARCH@
BUILD_OS = @BUILD_OS@
CALLCC_STK = @CALLCC_STK@
CC = @CC@
COMPOBJ = @COMPOBJ@
COMPSRC = @COMPSRC@
......@@ -154,7 +155,7 @@ NROFF = nroff
MANS = $(man_MANS)
DATA = $(dochtml_DATA) $(docimg_DATA) $(docpdf_DATA) $(scheme_DATA)
DIST_COMMON = Makefile.am Makefile.in TODO stklos-compile.1.in \
DIST_COMMON = Makefile.am Makefile.in stklos-compile.1.in \
stklos-config.1.in stklos-genlex.1.in stklos-install.1.in \
stklos.1.in
all: all-am
......
......@@ -67,6 +67,7 @@ AMTAR = @AMTAR@
AWK = @AWK@
BUILD_ARCH = @BUILD_ARCH@
BUILD_OS = @BUILD_OS@
CALLCC_STK = @CALLCC_STK@
CC = @CC@
COMPOBJ = @COMPOBJ@
COMPSRC = @COMPSRC@
......
......@@ -67,6 +67,7 @@ AMTAR = @AMTAR@
AWK = @AWK@
BUILD_ARCH = @BUILD_ARCH@
BUILD_OS = @BUILD_OS@
CALLCC_STK = @CALLCC_STK@
CC = @CC@
COMPOBJ = @COMPOBJ@
COMPSRC = @COMPSRC@
......
(set! *load-path* (cons "lib/" (cons "lib/Lurc.d/" *load-path*)))
(load "threads")
(print (%thread-system))
(define (printer str)
(make-list 5 66)
(print str)
(thread-yield!)
(printer str))
(define (thrower str iter)
(if (> iter 0)
(begin
(print str " iter " iter)
(with-exception-handler
(lambda (exc)
(print "handler " str " iter " iter)
(thread-yield!)
(raise exc))
(lambda ()
(thread-yield!)
(thrower str (- iter 1)))))
(error "damn damn damn" str)))
(define thread1 (make-thread (lambda () (thrower "2lev" 2))))
(define thread2 (make-thread (lambda () (thrower "4lev" 4))))
(thread-start! thread1)
(thread-start! thread2)
(print "awaiting thread1")
(with-handler
(lambda (c)
(print "got thread exception " c))
(thread-join! thread1))
(print "awaiting thread2")
(with-handler
(lambda (c)
(print "got thread exception " c))
(thread-join! thread2))
(print "done")
(when (eq? (%thread-system) 'lurc)
(load "lurc")
(let ((sig (lurc:signal "test")))
(lurc:watch
sig
(lurc:emit sig)
(lurc:pause)
(print "ERROR")))
(print "done"))
......@@ -8,7 +8,7 @@
STKCONF = ../utils/stklos-config
INCLUDES = -I../src $(COMPFLAGS)
CC = @CC@
CFLAGS = @CFLAGS@ @SH_COMP_FLAGS@ @GTK_CONFIG_CFLAGS@ $(INCLUDES)
CFLAGS = @CFLAGS@ @SH_COMP_FLAGS@ @GTK_CONFIG_CFLAGS@ @GCINC@ $(INCLUDES)
shobjectdir = $(prefix)/lib/@PACKAGE@/@VERSION@
......
......@@ -73,6 +73,7 @@ AMTAR = @AMTAR@
AWK = @AWK@
BUILD_ARCH = @BUILD_ARCH@
BUILD_OS = @BUILD_OS@
CALLCC_STK = @CALLCC_STK@
CC = @CC@
COMPOBJ = @COMPOBJ@
COMPSRC = @COMPSRC@
......@@ -123,7 +124,7 @@ install_sh = @install_sh@
STKCONF = ../utils/stklos-config
INCLUDES = -I../src $(COMPFLAGS)
CFLAGS = @CFLAGS@ @SH_COMP_FLAGS@ @GTK_CONFIG_CFLAGS@ $(INCLUDES)
CFLAGS = @CFLAGS@ @SH_COMP_FLAGS@ @GTK_CONFIG_CFLAGS@ @GCINC@ $(INCLUDES)
shobjectdir = $(prefix)/lib/@PACKAGE@/@VERSION@
shobject_SCRIPTS = ldap.@SH_SUFFIX@
......@@ -152,7 +153,7 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES =
DATA = $(scheme_DATA)
DIST_COMMON = README Makefile.am Makefile.in TODO extconf.h.in
DIST_COMMON = README Makefile.am Makefile.in extconf.h.in
all: all-am
.SUFFIXES:
......
......@@ -76,6 +76,10 @@ if DARWIN_THREADS
libgc_la_SOURCES += darwin_stop_world.c
endif
if LURC_THREADS
libgc_la_SOURCES += lurc_support.c
endif
if WIN32_THREADS
libgc_la_SOURCES += win32_threads.c
endif
......
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
......@@ -72,8 +72,6 @@
SOURCES = $(libcord_la_SOURCES) $(libgc_la_SOURCES) $(EXTRA_libgc_la_SOURCES) $(libgccpp_la_SOURCES) $(gctest_SOURCES) $(leaktest_SOURCES) $(middletest_SOURCES) $(test_cpp_SOURCES) $(threadleaktest_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
......@@ -128,12 +126,13 @@ DIST_COMMON = $(am__configure_deps) $(am__pkginclude_HEADERS_DIST) \
#endif
@POWERPC_DARWIN_TRUE@am__append_6 = powerpc_darwin_mach_dep.s
@DARWIN_THREADS_TRUE@am__append_7 = darwin_stop_world.c
@WIN32_THREADS_TRUE@am__append_8 = win32_threads.c
@LURC_THREADS_TRUE@am__append_8 = lurc_support.c
@WIN32_THREADS_TRUE@am__append_9 = win32_threads.c
# C++ Interface
# -------------
@CPLUSPLUS_TRUE@am__append_9 = libgccpp.la
@CPLUSPLUS_TRUE@am__append_10 = include/gc_cpp.h include/gc_allocator.h
@CPLUSPLUS_TRUE@am__append_10 = libgccpp.la
@CPLUSPLUS_TRUE@am__append_11 = include/gc_cpp.h include/gc_allocator.h
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
......@@ -168,19 +167,21 @@ am__libgc_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c checksums.c \
real_malloc.c reclaim.c specific.c stubborn.c typd_mlc.c \
backgraph.c thread_local_alloc.c pthread_support.c \
pthread_stop_world.c powerpc_darwin_mach_dep.s \
darwin_stop_world.c win32_threads.c
darwin_stop_world.c lurc_support.c win32_threads.c
@PTHREADS_TRUE@am__objects_1 = pthread_support.lo \
@PTHREADS_TRUE@ pthread_stop_world.lo
@POWERPC_DARWIN_TRUE@am__objects_2 = powerpc_darwin_mach_dep.lo
@DARWIN_THREADS_TRUE@am__objects_3 = darwin_stop_world.lo
@WIN32_THREADS_TRUE@am__objects_4 = win32_threads.lo
@LURC_THREADS_TRUE@am__objects_4 = lurc_support.lo
@WIN32_THREADS_TRUE@am__objects_5 = win32_threads.lo
am_libgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo thread_local_alloc.lo $(am__objects_1) \
$(am__objects_2) $(am__objects_3) $(am__objects_4)
$(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5)
libgc_la_OBJECTS = $(am_libgc_la_OBJECTS)
@CPLUSPLUS_TRUE@libgccpp_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@CPLUSPLUS_TRUE@ $(am__DEPENDENCIES_1)
......@@ -324,6 +325,8 @@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LURC_THREADS_FALSE = @LURC_THREADS_FALSE@
LURC_THREADS_TRUE = @LURC_THREADS_TRUE@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
......@@ -442,7 +445,7 @@ EXTRA_DIST = cord/cordbscs.c cord/cordtest.c cord/de.c cord/cordprnt.c \
# C Library
# ---------
lib_LTLIBRARIES = libcord.la libgc.la $(am__append_9)
lib_LTLIBRARIES = libcord.la libgc.la $(am__append_10)
include_HEADERS =
# installed headers
......@@ -453,7 +456,7 @@ pkginclude_HEADERS = include/gc.h include/gc_typed.h \
include/gc_allocator.h include/gc_backptr.h include/gc_gcj.h \
include/leak_detector.h include/gc_amiga_redirects.h \
include/gc_pthread_redirects.h include/gc_config_macros.h \
include/gc_tiny_fl.h $(am__append_10)
include/gc_tiny_fl.h $(am__append_11)
# headers which are not installed
#
......@@ -542,7 +545,7 @@ libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
specific.c stubborn.c typd_mlc.c backgraph.c \
thread_local_alloc.c $(am__append_5) $(am__append_6) \
$(am__append_7) $(am__append_8)
$(am__append_7) $(am__append_8) $(am__append_9)
# Include THREADDLLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
......@@ -736,6 +739,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gc_dlopen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcj_mlc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/headers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lurc_support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mallocx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mark.Plo@am__quote@
......@@ -911,7 +915,13 @@ uninstall-pkgincludeHEADERS:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
......@@ -923,7 +933,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
......@@ -931,7 +941,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
......@@ -952,7 +968,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
......@@ -1249,10 +1265,10 @@ installdirs-am:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install:
install-exec:
install-data:
uninstall:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ set -e
# These version are ok, pre-1.7 is not. Post 1.7 may produce a lot of
# warnings for unrelated projects, so prefer 1.7 for now.
am_version=
for v in 1.7 1.9 1.8; do
for v in 1.8 1.9 1.8; do
if type -p &>/dev/null automake-$v; then
am_version="-$v"
break
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -45,6 +45,23 @@ AC_PROG_INSTALL
GC_CFLAGS=${gc_cflags}
AC_SUBST(GC_CFLAGS)
AC_LANG(C)
AC_DEFUN(GC_CHECK_DEFINE, [
dnl $1: header file
dnl $2: CPP variable
dnl $3: then
dnl $4: else
AC_PREPROC_IFELSE([
#include <$1>
#ifndef $2
# error "$2 undefined"
#else
ok
#endif
],
[$3], [$4])
])
AC_ARG_ENABLE(threads,
[AC_HELP_STRING([--enable-threads=TYPE], [choose threading package])],
THREADS=$enableval,
......@@ -68,6 +85,20 @@ AC_ARG_ENABLE(parallel-mark,
AC_ARG_ENABLE(cplusplus,
[AC_HELP_STRING([--enable-cplusplus], [install C++ support])])
if test "$THREADS" = lurc
then
AC_CHECK_HEADER([lurc.h], [], [AC_MSG_ERROR([Missing lurc.h])])
AC_MSG_CHECKING([for LURC GC support])
GC_CHECK_DEFINE([lurc.h], [LURC_ENABLE_GC],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([LURC not compiled with GC support])])
AC_MSG_CHECKING([for LURC PThread support])
GC_CHECK_DEFINE([lurc.h], [LURC_ENABLE_PTHREAD],
[AC_MSG_RESULT(yes); THREADS=pthreads; LURC=yes],
[AC_MSG_RESULT(no)])
fi
INCLUDES=-I${srcdir}/include
THREADDLLIBS=
## Libraries needed to support dynamic loading and/or threads.
......@@ -78,6 +109,12 @@ case "$THREADS" in
posix | pthreads)
THREADS=posix
THREADDLLIBS=-lpthread
# check wether we want LURC support
if test $LURC = yes
then
THREADDLLIBS="$THREADLIBS -llurc"
AC_DEFINE(GC_LURC_THREADS)
fi
case "$host" in
x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
AC_DEFINE(GC_LINUX_THREADS)
......@@ -151,6 +188,10 @@ case "$THREADS" in
;;
esac
;;
lurc)
THREADDLLIBS=-llurc
AC_DEFINE(GC_LURC_THREADS)
;;
win32)
AC_DEFINE(GC_WIN32_THREADS)
dnl Wine getenv may not return NULL for missing entry
......@@ -187,6 +228,7 @@ esac
AC_SUBST(THREADDLLIBS)
AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
AM_CONDITIONAL(LURC_THREADS, test x$THREADS = xlurc)
AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
AM_CONDITIONAL(ARCH_SOLARIS, test x$solaris_threads = xtrue)
AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
......@@ -214,7 +256,9 @@ fi
# We never want libdl on darwin. It is a fake libdl that just ends up making
# dyld calls anyway
case "$host" in
*-*-darwin*) ;;
*-*-darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
*)
AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
;;
......
......@@ -2,6 +2,10 @@
# if defined(GC_DARWIN_THREADS)
#ifdef GC_LURC_THREADS
# include <lurc.h>
#endif /* GC_LURC_THREADS */
/* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple
Page 49:
"The space beneath the stack pointer, where a new stack frame would normally
......@@ -145,6 +149,22 @@ void GC_push_all_stacks() {
#else /* !DARWIN_DONT_PARSE_STACK; Use FindTopOfStack() */
#ifdef GC_LURC_THREADS
static GC_thread lookup_gc_thread(thread_act_t mach_thread){
int i;
GC_thread p;
for (i = 0; i < THREAD_TABLE_SZ; ++i) {
for (p = GC_threads[i]; 0 != p; p = p -> next) {
if(p->stop_info.mach_thread == mach_thread)
return p;
}
}
/* not found ? */
return NULL;
}
#endif /* GC_LURC_THREADS */
void GC_push_all_stacks() {
int i;
kern_return_t r;
......@@ -152,6 +172,10 @@ void GC_push_all_stacks() {
ptr_t lo, hi;
thread_act_array_t act_list = 0;
mach_msg_type_number_t listcount = 0;
# ifdef GC_LURC_THREADS
lurc_thread_t lt = NULL;
void *llo,*lhi;
# endif /* GC_LURC_THREADS */
me = mach_thread_self();
if (!GC_thr_initialized) GC_thr_init();
......@@ -160,6 +184,9 @@ void GC_push_all_stacks() {
if(r != KERN_SUCCESS) ABORT("task_threads failed");
for(i = 0; i < listcount; i++) {
thread_act_t thread = act_list[i];
# ifdef GC_LURC_THREADS
GC_thread gct = lookup_gc_thread(thread);
# endif /* GC_LURC_THREADS */
if (thread == me) {
lo = GC_approx_sp();
hi = (ptr_t)FindTopOfStack(0);
......@@ -243,8 +270,27 @@ void GC_push_all_stacks() {
(unsigned long) thread, lo, hi
);
# endif
# ifdef GC_LURC_THREADS
/* check wether the lurc lib wants us to push this now or later */
if (gct != NULL
&& lurc_gc_is_lurc_thread(gct -> id, lo, hi))
continue;
# endif /* GC_LURC_THREADS */
GC_push_all_stack(lo, hi);
} /* for(p=GC_threads[i]...) */
# ifdef GC_LURC_THREADS
/* walk all those threads to ask for the roots */
while ((lt = lurc_get_next_thread(lt)) != NULL) {
lurc_gc_get_root(lt, &llo, &lhi);
if(llo != NULL)
GC_push_all_stack(llo, lhi);
}
/* does it have another part ? */
lurc_gc_get_additional_root(&llo, &lhi);
if (llo != NULL)
GC_push_all_stack(llo, lhi);
# endif /* GC_LURC_THREADS */
}
#endif /* !DARWIN_DONT_PARSE_STACK */
......
......@@ -917,7 +917,8 @@ void * GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(void * *)(p)) /* Retrieve the next element */
/* in returned list. */
extern void GC_thr_init(void); /* Needed for Solaris/X86 */
#elif defined(GC_LURC_THREADS)
extern void GC_thr_init(void); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
#if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
......
......@@ -22,6 +22,9 @@
#if defined(AIX_THREADS)
# define GC_AIX_THREADS
#endif
#if defined(LURC_THREADS)
# define GC_LURC_THREADS
#endif
#if defined(HPUX_THREADS)
# define GC_HPUX_THREADS
#endif
......
......@@ -139,6 +139,13 @@
# endif
# endif /* GC_PTHREADS with linux_threads.c implementation */
# if defined(GC_LURC_THREADS) && !defined(GC_PTHREADS)
# define LOCK()
# define UNLOCK()
# define SET_LOCK_HOLDER()
# define UNSET_LOCK_HOLDER()
# define I_HOLD_LOCK() TRUE
# endif
# else /* !THREADS */
# define LOCK()
......
......@@ -311,7 +311,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
PCR_waitForever);
# else
# if defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) \
|| defined(GC_PTHREADS)
|| defined(GC_PTHREADS) || defined(GC_LURC_THREADS)
void GC_stop_world();
void GC_start_world();
# define STOP_WORLD() GC_stop_world()
......
......@@ -1986,7 +1986,7 @@
# if defined(PCR) || defined(SRC_M3) || \
defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
defined(GC_PTHREADS)
defined(GC_PTHREADS) || defined(GC_LURC_THREADS)
# define THREADS
# endif
......
......@@ -112,7 +112,7 @@ AO_test_and_set_full(volatile AO_TS_t *addr)
unsigned char oldval;
/* Note: the "xchg" instruction does not need a "lock" prefix */
__asm__ __volatile__("xchgb %0, %1"
: "=r"(oldval), "=m"(*addr)
: "=q"(oldval), "=m"(*addr)
: "0"(0xff), "m"(*addr) : "memory");
return (AO_TS_VAL_t)oldval;
}
......
/* src/config.h. Generated by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "libatomic_ops"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "libatomic_ops"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libatomic_ops 1.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libatomic_ops"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.1"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.1"
This diff is collapsed.
This diff is collapsed.
#if defined(GC_LURC_THREADS) && !defined(GC_PTHREADS)
#include "private/gc_priv.h"
#include <lurc.h>
#ifdef LURC_ENABLE_PTHREAD
#error "LURC is compiled with pthread support, but the GC is not. Please use ./configure --enable-threads=lurc-pthreads if you intend to use LURC with PThreads. Or compile LURC without PThread support."
#endif
static int GC_lurc_initialized = 0;
void
GC_push_all_stacks(void){
lurc_thread_t lt = NULL;
void *llo, *lhi;
/* give lurc the main thread's lo and hi */
lurc_gc_setup_stack(GC_approx_sp(), GC_stackbottom);
/* now iterate through all lurcs' threads */
while ((lt = lurc_get_next_thread(lt)) != NULL) {
lurc_gc_get_root(lt, &llo, &lhi);
if(llo != NULL)
GC_push_all_stack(llo, lhi);
}
/* does it have another part ? */
lurc_gc_get_additional_root(&llo, &lhi);
if (llo != NULL)
GC_push_all_stack(llo, lhi);
}
void GC_push_thread_structures(void){}
void GC_stop_world(void){}
void GC_start_world(void){}
void GC_thr_init(void){
if(!GC_lurc_initialized){
GC_lurc_initialized = 1;
lurc_gc_init(GC_enable, GC_disable);
}
}
#endif /* GC_LURC_THREADS && ! GC_PTHREADS */
......@@ -619,7 +619,7 @@ void GC_init_inner()
GC_init_netbsd_elf();
# endif
# if defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) \
|| defined(GC_WIN32_THREADS)
|| defined(GC_WIN32_THREADS) || defined(GC_LURC_THREADS)
GC_thr_init();
# endif
# ifdef GC_SOLARIS_THREADS
......@@ -627,7 +627,7 @@ void GC_init_inner()
GC_dirty_init();
# endif
# if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \
|| defined(GC_SOLARIS_THREADS)
|| defined(GC_SOLARIS_THREADS) || defined(GC_LURC_THREADS)
if (GC_stackbottom == 0) {
GC_stackbottom = GC_get_main_stack_base();
# if (defined(LINUX) || defined(HPUX)) && defined(IA64)
......