Merge branch 'upstream'

Former-commit-id: 61b4ed274cec4ed6aa1c485888b2426dbd72d5a3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:41:41 +00:00
1200 changed files with 29534 additions and 26161 deletions

View File

@@ -49,7 +49,7 @@ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
openbsd_stop_world.c mach_dep.c $(asm_libgc_sources)
mach_dep.c $(asm_libgc_sources)
# Include THREADDLLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:

View File

@@ -120,8 +120,8 @@ am__libmonogc_static_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c \
ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c \
solaris_threads.c specific.c stubborn.c typd_mlc.c backgraph.c \
win32_threads.c pthread_support.c pthread_stop_world.c \
darwin_stop_world.c openbsd_stop_world.c mach_dep.c \
powerpc_darwin_mach_dep.s ia64_save_regs_in_stack.s
darwin_stop_world.c mach_dep.c powerpc_darwin_mach_dep.s \
ia64_save_regs_in_stack.s
@POWERPC_DARWIN_FALSE@@TARGET_IA64_TRUE@am__objects_1 = ia64_save_regs_in_stack.lo
@POWERPC_DARWIN_TRUE@am__objects_1 = powerpc_darwin_mach_dep.lo
am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \
@@ -131,8 +131,8 @@ am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \
real_malloc.lo reclaim.lo solaris_pthreads.lo \
solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \
pthread_stop_world.lo darwin_stop_world.lo \
openbsd_stop_world.lo mach_dep.lo $(am__objects_1)
pthread_stop_world.lo darwin_stop_world.lo mach_dep.lo \
$(am__objects_1)
am_libmonogc_static_la_OBJECTS = $(am__objects_2)
libmonogc_static_la_OBJECTS = $(am_libmonogc_static_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -150,8 +150,8 @@ am__libmonogc_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c \
ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c \
solaris_threads.c specific.c stubborn.c typd_mlc.c backgraph.c \
win32_threads.c pthread_support.c pthread_stop_world.c \
darwin_stop_world.c openbsd_stop_world.c mach_dep.c \
powerpc_darwin_mach_dep.s ia64_save_regs_in_stack.s
darwin_stop_world.c mach_dep.c powerpc_darwin_mach_dep.s \
ia64_save_regs_in_stack.s
am_libmonogc_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 \
@@ -159,8 +159,8 @@ am_libmonogc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo \
ptr_chck.lo real_malloc.lo reclaim.lo solaris_pthreads.lo \
solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \
pthread_stop_world.lo darwin_stop_world.lo \
openbsd_stop_world.lo mach_dep.lo $(am__objects_1)
pthread_stop_world.lo darwin_stop_world.lo mach_dep.lo \
$(am__objects_1)
libmonogc_la_OBJECTS = $(am_libmonogc_la_OBJECTS)
libmonogc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -475,7 +475,7 @@ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
openbsd_stop_world.c mach_dep.c $(asm_libgc_sources)
mach_dep.c $(asm_libgc_sources)
# Include THREADDLLIBS here to ensure that the correct versions of
@@ -644,7 +644,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/new_hblk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obj_map.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openbsd_stop_world.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_dep.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr_interface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_stop_world.Plo@am__quote@

View File

@@ -1 +1 @@
c841193b7c64c1bee86f6f6635a9d7a58b35700a
6c00925e1b2d39be32ba24980bf24b1b747ceace

View File

@@ -104,6 +104,10 @@ case "$THREADS" in
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
;;
*-*-haiku*)
AC_DEFINE(GC_HAIKU_THREADS)
AC_DEFINE(_REENTRANT)
;;
*-*-hpux*)
AC_MSG_WARN("Only HP/UX 11 threads are supported.")
AC_DEFINE(GC_HPUX_THREADS)

View File

@@ -59,7 +59,7 @@
!(defined(FREEBSD) && defined(__ELF__)) && \
!(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
!defined(DARWIN)
!defined(DARWIN) && !defined(HAIKU)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
--> hard to add.
@@ -1258,6 +1258,23 @@ GC_bool GC_register_main_static_data()
#endif /* DARWIN */
#if defined(HAIKU)
#include <kernel/image.h>
void GC_register_dynamic_libraries()
{
image_info info;
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK)
{
void *data = info.data;
GC_add_roots_inner(data, data + info.data_size, TRUE);
}
}
#endif /* HAIKU */
#else /* !DYNAMIC_LOADING */
#ifdef PCR

View File

@@ -57,7 +57,7 @@
defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
defined(GC_OPENBSD_THREADS) || \
defined(GC_OPENBSD_THREADS) || defined(GC_HAIKU_THREADS) ||\
(defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
# define GC_PTHREADS
# endif

View File

@@ -1979,6 +1979,8 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
/* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */
# define SIG_SUSPEND SIGPWR
# endif
# elif defined(GC_OPENBSD_THREADS)
# define SIG_SUSPEND SIGXFSZ
# else /* !GC_LINUX_THREADS */
# if defined(_SIGRTMIN)
# define SIG_SUSPEND _SIGRTMIN + 6

View File

@@ -238,6 +238,16 @@
# define BEOS
# define mach_type_known
# endif
# if defined(__HAIKU__) && defined(_X86_)
# define I386
# define HAIKU
# define mach_type_known
# endif
# if defined(__HAIKU__) && defined(__amd64__)
# define X86_64
# define HAIKU
# define mach_type_known
# endif
# if defined(LINUX) && (defined(i386) || defined(__i386__))
# define I386
# define mach_type_known
@@ -1164,6 +1174,15 @@
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
# include <OS.h>
# define GETPAGESIZE() B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# define DYNAMIC_LOADING
# define MPROTECT_VDB
# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int _etext[], _end[];
@@ -2134,6 +2153,15 @@
/* There seems to be some issues with trylock hanging on darwin. This
should be looked into some more */
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
# include <OS.h>
# define GETPAGESIZE() B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# define DYNAMIC_LOADING
# define MPROTECT_VDB
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# ifndef GC_FREEBSD_THREADS
@@ -2251,7 +2279,7 @@
# if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
|| defined(DGUX) || defined(BSD) || defined(SUNOS4) \
|| defined(_AIX) || defined(DARWIN) || defined(OSF1)
|| defined(_AIX) || defined(DARWIN) || defined(OSF1) || defined(HAIKU)
# define UNIX_LIKE /* Basic Unix-like system calls work. */
# endif
@@ -2507,6 +2535,9 @@
# if defined(SN_TARGET_PS3)
extern void *ps3_get_mem (size_t size);
# define GET_MEM(bytes) (struct hblk*) ps3_get_mem (bytes)
# elif defined(HAIKU)
ptr_t GC_haiku_get_mem(GC_word bytes);
# define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes)
# else
extern ptr_t GC_unix_get_mem(word size);
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)

View File

@@ -1,12 +0,0 @@
#ifndef GC_OPENBSD_STOP_WORLD_H
#define GC_OPENBSD_STOP_WORLD_H
#if !defined(GC_OPENBSD_THREADS)
#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined
#endif
struct thread_stop_info {
ptr_t stack_ptr; /* Valid only when stopped. */
};
#endif

View File

@@ -8,8 +8,6 @@
#if defined(GC_DARWIN_THREADS)
# include "private/darwin_stop_world.h"
#elif defined(GC_OPENBSD_THREADS)
# include "private/openbsd_stop_world.h"
#else
# include "private/pthread_stop_world.h"
#endif

View File

@@ -1,161 +0,0 @@
#include "private/pthread_support.h"
/* derived from pthread_stop_world.c */
# if defined(GC_OPENBSD_THREADS)
#define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2)
/* We hold allocation lock. Should do exactly the right thing if the */
/* world is stopped. Should not fail if it isn't. */
void GC_push_all_stacks()
{
GC_bool found_me = FALSE;
size_t nthreads = 0;
int i;
GC_thread p;
ptr_t lo, hi;
pthread_t me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
# if DEBUG_THREADS
GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me);
# endif
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> flags & FINISHED) continue;
++nthreads;
if (THREAD_EQUAL(p -> id, me)) {
# ifdef SPARC
lo = (ptr_t)GC_save_regs_in_stack();
# else
lo = GC_approx_sp();
# endif
found_me = TRUE;
} else {
lo = p -> stop_info.stack_ptr;
}
if ((p -> flags & MAIN_THREAD) == 0) {
hi = p -> stack_end;
} else {
/* The original stack. */
hi = GC_stackbottom;
}
# if DEBUG_THREADS
GC_printf("Stack for thread 0x%x = [%p,%p)\n",
(unsigned)(p -> id), lo, hi);
# endif
if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
# ifdef STACK_GROWS_UP
/* We got them backwards! */
GC_push_all_stack(hi, lo);
# else
GC_push_all_stack(lo, hi);
# endif
}
}
if (!found_me && !GC_in_thread_creation)
ABORT("Collecting from unknown thread.");
}
/* We hold the allocation lock. Suspend all threads that might */
/* still be running. */
void GC_suspend_all()
{
int i;
GC_thread p;
int result;
pthread_t my_thread = pthread_self();
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (!THREAD_EQUAL(p -> id, my_thread)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) /* Will wait */ continue;
# if DEBUG_THREADS
GC_printf("Suspending thread 0x%x\n",
(unsigned)(p -> id));
# endif
if (pthread_suspend_np(p -> id) != 0)
ABORT("pthread_suspend_np failed");
/*
* This will only work for userland pthreads. It will
* fail badly on rthreads. Perhaps we should consider
* a pthread_sp_np() function that returns the stack
* pointer for a suspended thread and implement in
* both pthreads and rthreads.
*/
p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET);
}
}
}
}
void GC_stop_world()
{
int i;
GC_ASSERT(I_HOLD_LOCK());
# if DEBUG_THREADS
GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self());
# endif
/* Make sure all free list construction has stopped before we start. */
/* No new construction can start, since free list construction is */
/* required to acquire and release the GC lock before it starts, */
/* and we have the lock. */
# ifdef PARALLEL_MARK
GC_acquire_mark_lock();
GC_ASSERT(GC_fl_builder_count == 0);
/* We should have previously waited for it to become zero. */
# endif /* PARALLEL_MARK */
GC_suspend_all();
# ifdef PARALLEL_MARK
GC_release_mark_lock();
# endif
#if DEBUG_THREADS
GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self());
#endif
}
/* Caller holds allocation lock, and has held it continuously since */
/* the world stopped. */
void GC_start_world()
{
pthread_t my_thread = pthread_self();
register int i;
register GC_thread p;
register int result;
# if DEBUG_THREADS
GC_printf("World starting\n");
# endif
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (!THREAD_EQUAL(p -> id, my_thread)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) continue;
#if DEBUG_THREADS
GC_printf("Resuming thread 0x%x\n",
(unsigned)(p -> id));
#endif
if (pthread_resume_np(p -> id) != 0)
ABORT("pthread_kill failed");
}
}
}
# if DEBUG_THREADS
GC_printf("World started\n");
# endif
}
void GC_stop_init() {
}
#endif

View File

@@ -1 +1 @@
191e4b4ed7d06a8ea02f73a38ea84b941fc758c5
dca79850754069953233f0376304a45583a842ec

View File

@@ -2,8 +2,7 @@
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \
&& !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS) \
&& !defined(GC_OPENBSD_THREADS)
&& !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS)
#include <signal.h>
#include <semaphore.h>

View File

@@ -1135,7 +1135,7 @@ void GC_thr_init()
# if defined(GC_HPUX_THREADS)
GC_nprocs = pthread_num_processors_np();
# endif
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) || defined(GC_HAIKU_THREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# endif