summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix GC_suspend_thread for terminated threadsthread-suspendIvan Maidanski2016-06-212-2/+4
| | | | | | | | | * pthread_stop_world.c (GC_suspend_thread): Do not clear SUSPENDED_EXT flag in case of RAISE_SIGNAL() failure, add assertion about FINISHED (in case of ESRCH), update comment. * pthread_stop_world.c (GC_register_my_thread): Add assertion that SUSPENDED_EXT flag is not set if the thread is registered from a thread key destructor.
* Fix deadlock (and double lock) in explicit thread suspend/resumeIvan Maidanski2016-06-201-17/+45
| | | | | | | | | | | | | | | * pthread_stop_world.c (GC_suspend_handler_inner) [GC_ENABLE_SUSPEND_THREAD]: If SUSPENDED_EXT flag then set stop_info.stack_ptr, call sem_post(suspend_ack_sem), and call suspend_self_inner instead of GC_do_blocking(suspend_self_inner). * pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread): No-op if already suspended; UNLOCK before GC_do_blocking (if self-suspend); add TODO about GC_retry_signals; clear SUSPENDED_EXT flag if RAISE_SIGNAL failed with ESRCH code; sem_wait(suspend_ack_sem) to let the suspend handler to lookup the thread and store stack_ptr (and save registers if needed). * pthread_stop_world.c (GC_suspend_all, GC_start_world): Skip threads with SUSPENDED_EXT flag.
* Refactoring of android_thread_kill/pthread_kill callsIvan Maidanski2016-05-301-56/+29
| | | | | | | | | | | | | | * pthread_stop_world.c (android_thread_kill) [USE_TKILL_ON_ANDROID]: Move definition upper (to be before its first use); remove forward declaration. * pthread_stop_world.c (THREAD_SYSTEM_ID, RAISE_SIGNAL): New macro. * pthread_stop_world.c (GC_suspend_thread): Remove "result" local variable * pthread_stop_world.c (GC_suspend_thread, GC_suspend_all, GC_start_world): Use RAISE_SIGNAL() instead of pthread_kill and android_thread_kill. * pthread_stop_world.c (GC_suspend_all, GC_start_world): Remove "thread_id" local variable; use THREAD_SYSTEM_ID instead of thread_id.
* Add test for thread suspend/resume APIIvan Maidanski2015-11-201-0/+29
| | | | | | | | | * tests/test.c (tiny_reverse_test): Call GC_gcollect (only if GC_ENABLE_SUSPEND_THREAD). * tests/test.c: Include "javaxfc.h" if GC_ENABLE_SUSPEND_THREAD (and GC_PTHREADS) to GC_suspend/resume_thread declared. * tests/test.c (fork_a_thread): Test GC_is_thread_suspended, GC_suspend_thread, GC_resume_thread (only if the functions defined).
* Code refactoring of thread suspend/resume API supportIvan Maidanski2015-11-207-82/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * CMakeLists.txt (enable_gcj_support): Define GC_ENABLE_SUSPEND_THREAD. * configure.ac (enable_gcj_support): Likewise. * doc/README.macros (GC_ENABLE_SUSPEND_THREAD): Document. * include/gc.h (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Move to javaxfc.h. * include/gc_pthread_redirects.h (GC_SUSPEND_THREAD_ID): New macro. * include/javaxfc.h (GC_SUSPEND_THREAD_ID): Likewise. * include/javaxfc.h (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Define if and only if GC_THREADS; refine comment. * include/javaxfc.h (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Decorate with GC_CALL; change argument type from pthread_t to GC_SUSPEND_THREAD_ID. * pthread_stop_world.c (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Likewise. * pthread_stop_world.c (GC_suspend_handler): Move check for SUSPENDED_EXT to GC_suspend_handler_inner (to avoid duplicate GC_lookup_thread call). * pthread_stop_world.c (suspend_self_inner, GC_TIME_LIMIT, GC_brief_async_signal_safe_sleep, GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Do not defined unless GC_ENABLE_SUSPEND_THREAD. * pthread_stop_world.c (suspend_self): Remove (invoke GC_do_blocking(suspend_self_inner) directly). * pthread_stop_world.c (GC_brief_async_signal_safe_sleep): Decorate with STATIC. * pthread_stop_world.c (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Wrap code into LOCK/UNLOCK (because, at least, GC_lookup_thread should be called with the allocation lock held). * pthread_stop_world.c (GC_suspend_thread, GC_resume_thread): Do not ABORT if thread is unregistered in GC (just no-op instead). * pthread_stop_world.c (GC_is_thread_suspended): Return 0 if thread is not registered in GC.
* Add GC_is_thread_suspended API functionKeith Seitz2015-11-202-0/+9
| | | | | | | | | | | | (Cherry-picked commit 30c2f0e from 'gcc_boehmgc' branch.) * include/gc.h (GC_is_thread_suspended): Declare. * pthread_stop_world.c (GC_is_thread_suspended): New function. Conflicts: * ChangeLog * include/gc.h * pthread_stop_world.c
* Update AUTHORS fileIvan Maidanski2015-11-201-0/+1
|
* Implement thread suspend/resume API (Linux threads only)Keith Seitz2015-11-203-3/+85
| | | | | | | | | | | | | | | | | | (Cherry-picked commit 42fe54a from 'gcc_boehmgc' branch.) * pthread_stop_world.c (GC_suspend_handler): Redirect to suspension routine if signal is received and thread is flagged SUSPENDED_EXT. * pthread_stop_world.c (GC_brief_async_signal_safe_sleep, suspend_self_inner, suspend_self, GC_suspend_thread, GC_resume_thread): New function. * include/gc.h (GC_suspend_thread, GC_resume_thread): Declare. * include/private/pthread_support.h (SUSPENDED_EXT): Update comment. Conflicts: * ChangeLog * include/gc.h * include/private/pthread_support.h * pthread_stop_world.c
* Remove 'sig' argument of GC_suspend_handler_innerIvan Maidanski2015-11-201-15/+17
| | | | | | | | | | | (Code refactoring) * pthread_stop_world.c (GC_suspend_handler_inner): Rename "sig_arg" argument to "dummy"; mark it as GC_ATTR_UNUSED. * pthread_stop_world.c (GC_suspend_handler): Pass NULL instead of sig to GC_suspend_handler_inner. * pthread_stop_world.c (GC_suspend_handler): Move sig check from GC_suspend_handler_inner.
* Allow specific TLS attributes for GC_thread_keyIvan Maidanski2015-11-183-5/+12
| | | | | | | | | * doc/README.macros (GC_ATTR_TLS_FAST): Document. * include/private/thread_local_alloc.h (GC_ATTR_TLS_FAST): New macro (empty by default). * include/private/thread_local_alloc.h (GC_thread_key): Use GC_ATTR_TLS_FAST. * thread_local_alloc.c (GC_thread_key): Likewise.
* Fix USE_COMPILER_TLS macro duplicate description in READMEIvan Maidanski2015-11-181-4/+0
| | | | * doc/README.macros (USE_COMPILER_TLS): Remove duplicate description.
* Document GC_register_my_thread returned valueIvan Maidanski2015-11-111-0/+1
| | | | | * include/gc.h (GC_register_my_thread): Refine comment (about returned value).
* Avoid unstructured procfs on SolarisRainer Orth2015-10-301-7/+4
| | | | | | | (Cherry-picked commit f9711f5 from 'gcc_boehmgc' branch.) * os_dep.c [PROC_VDB] (GC_dirty_init): Use /proc/<pid>/pagedata instead of PIOCOPENPD; remove fd local variable; increase buf[] size.
* Do no declare kernel_id field of GC_Thread_Rep for 64-bit AndroidIvan Maidanski2015-10-302-3/+4
| | | | | | | | * include/private/pthread_support.h (GC_Thread_Rep): Do not declare kernel_id field unless USE_TKILL_ON_ANDROID (instead of PLATFORM_ANDROID). * pthread_support.c (GC_new_thread, GC_remove_all_threads_but_me): Do not set kernel_id field unless USE_TKILL_ON_ANDROID.
* ABORT_ARGn log details at INFO level (Android)Ivan Maidanski2015-10-271-3/+3
| | | | | * include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3): Use GC_INFOLOG_PRINTF instead of GC_COND_LOG_PRINTF.
* Remove item from TODO file about resuming parallel markersIvan Maidanski2015-10-261-2/+0
|
* Check DATASTART is less than DATAEND even assertions offIvan Maidanski2015-10-262-12/+31
| | | | | | | | | | | * dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr): Abort with the appropriate message if DATASTART is NULL or greater than DATAEND (same for DATASTART2 and DATAEND2). * os_dep.c (GC_init_linux_data_start, GC_register_data_segments): Likewise. * os_dep.c (GC_init_linux_data_start, GC_register_data_segments): Remove assertion about DATASTART and DATAEND. * os_dep.c (GC_init_linux_data_start): Code refactoring.
* Workaround invalid '_end' symbol on Android clang 3.5+Ivan Maidanski2015-10-233-20/+37
| | | | | | | | | | | * include/gc.h (GC_INIT_CONF_ROOTS): Handle Android clang (3.5-3.6) case when "_end" symbol has incorrect address but "__end__" is defined (by bfd linker only); declare "__end__" symbol as weak. * include/private/gcconfig.h (DATAEND): Redefine for Android/clang; define __end__ as weak symbol. * os_dep.c (_end): Remove declaration (declared in gcconfig.h). * os_dep.c (GC_init_linux_data_start): Define new local variable (data_end); set it to DATAEND; use it instead of _end.
* Fix lock assert violation in GC_gcollect_inner if GC_ALWAYS_MULTITHREADEDIvan Maidanski2015-10-224-4/+23
| | | | | | | | | | | * alloc.c (GC_expand_hp): Do not hold the allocation lock when calling GC_init. * malloc.c (GC_alloc_large, GC_generic_malloc_inner): Likewise. * mallocx.c (GC_generic_malloc_many): Likewise. * misc.c (GC_enable_incremental): Likewise. * misc.c (GC_init): Surround GC_gcollect_inner call with LOCK/UNLOCK (only if GC_ASSERTIONS and GC_ALWAYS_MULTITHREADED otherwise redundant).
* Workaround 'unresolved __tls_get_addr' error for Android NDK ClangIvan Maidanski2015-10-221-10/+2
| | | | | * include/private/thread_local_alloc.h (USE_COMPILER_TLS): Do not define for Android Clang (any CPU arch); update comment.
* Add assertion on lock status to GC_alloc_large and its callersIvan Maidanski2015-10-224-20/+24
| | | | | | | | | | | | (code refactoring) * alloc.c (GC_try_to_collect_inner): Remove comment about expected lock status; add assertion about holding the allocation lock. * finalize.c (GC_grow_table): Likewise. * malloc.c (GC_alloc_large, GC_alloc_large_and_clear, GC_generic_malloc_inner, GC_generic_malloc_inner_ignore_off_page): Likewise. * misc.c (GC_new_free_list_inner): Likewise.
* Fix lock assertion violation in GC_new_thread if GC_ALWAYS_MULTITHREADEDIvan Maidanski2015-10-214-32/+37
| | | | | | | | | | | | | | | | | | | | | | | * include/private/gc_priv.h (GC_start_mark_threads_inner): Define macro (or declare function depending on CAN_HANDLE_FORK). * misc.c (GC_init): Surround GC_thr_init call with LOCK/UNLOCK (only if GC_ASSERTIONS and GC_ALWAYS_MULTITHREADED otherwise redundant); call GC_start_mark_threads_inner (if PARALLEL_MARK). * pthread_support.c (GC_mark_thread): Update comment. * win32_threads.c (GC_mark_thread): Likewise. * pthread_support.c (start_mark_threads): Remove macro (moved to gc_priv.h); rename function to GC_start_mark_threads_inner; replace "static" to GC_INNER; check assertion on GC_fl_builder_count only if the markers should actually be started; move the check for disabled parallel markers (available_markers_m1) from GC_thr_init (make it unconditional). * win32_threads.c (start_mark_threads): Likewise. * win32_threads.c (GC_start_mark_threads_inner): Add assertion about the lock status. * pthread_support.c (GC_thr_init): Remove comment about expected lock status; add assertion about holding the lock (duplicating that in GC_new_thread); remove start_mark_threads call (moved to GC_init). * win32_threads.c (GC_thr_init): Likewise.
* Consistently set type of DATASTART/END to ptr_tIvan Maidanski2015-10-163-16/+17
| | | | | | | | | | | (code refactoring) * dyn_load.c (GC_register_map_entries, GC_register_dynamic_libraries_dl_iterate_phdr): Remove redundant casting to ptr_t of DATASTART, DATAEND, DATAEND2. * os_dep.c (GC_register_data_segments): Likewise. * include/private/gcconfig.h (DATAEND, DATASTART): Add cast to ptr_t where missing.
* Consistently use outermost parentheses for DATASTART/END, STACKBOTTOMIvan Maidanski2015-10-151-104/+103
| | | | | | | | (code refactoring) * include/private/gcconfig.h (DATASTART, DATAEND, STACKBOTTOM, DATAEND2): Add outermost parentheses where missing; remove space in cast.
* NaCl/arm initial supportElijah Taylor2015-10-073-5/+30
| | | | | | | | | (Apply part of commit 21f0df7 from 'mono_libgc' branch.) Conflicts: * include/private/gc_locks.h * include/private/gcconfig.h * pthread_stop_world.c
* NaCl runtime fixesElijah Taylor2015-10-065-28/+66
| | | | | | | | | | | | | | | | (Apply commit b328e88 from 'mono_libgc' branch.) * fix compile/runtime issues caused by upstream changes * add NaCl glibc support * various changes to support running tests in NaCl glibc from 'make check' Conflicts: * dyn_load.c * include/private/gcconfig.h * misc.c * pthread_stop_world.c * pthread_support.c
* NaCl GC improvements (fix volatile for vars accessed by syscall hooks)Elijah Taylor2015-10-021-9/+9
| | | | | | | | (Apply part of commit 204bcc6 from 'mono_libgc' branch.) Conflicts: * pthread_stop_world.c * pthread_support.c
* Define GC_LINUX_THREADS, NO_EXECUTE_PERMISSION in configure for NaClElijah Taylor2015-10-021-1/+4
| | | | | | | (Apply part of commit 14b353e from 'mono_libgc' branch.) * configure.ac: Handle *-*-nacl* (define GC_LINUX_THREADS and NO_EXECUTE_PERMISSION).
* Fix gc.mak regarding msvc_dbg and test (MSVC)Ivan Maidanski2015-10-011-24/+31
| | | | | | | | | | * gc.mak (CLEAN, BSC32_SBRS, LINK32_OBJS): Rename msvc_dbg.* to msvc_dbg.copied.* file names. * gc.mak (CLEAN): Erase msvc_dbg.copied.c, test.copied.c. * gc.mak (msvc_dbg.copied.c): New rule. * gc.mak (CLEAN, LINK32_OBJS, BSC32_SBRS, test.c): Rename test.* to test.copied.* file names. * gc.mak (CPP_PROJ): Add /D for "ALL_INTERIOR_POINTERS".
* .gitignore: Ignore .copied.c, .dll.manifest, idb, ilk files (MSVC)Ivan Maidanski2015-09-301-2/+6
|
* Fix race (and potential deadlock) at marker threads initializationIvan Maidanski2015-09-224-5/+40
| | | | | | | | | | | | * include/private/gc_priv.h (GC_wait_for_markers_init): New prototype. * mark.c (GC_wait_for_markers_init): New function (if PARALLEL_MARK). * pthread_support.c (GC_mark_thread): Notify start_mark_threads() about completion of marker data initialization. * win32_threads.c (GC_mark_thread): Likewise. * pthread_support.c (start_mark_threads): Add assertion about GC_fl_builder_count; call GC_wait_for_markers_init. * win32_threads.c (start_mark_threads): Likewise. * win32_threads.c (GC_mark_thread): Reformat code.
* Fix 'value truncated' compiler warning in CORD_cat (MS VC)Ivan Maidanski2015-09-191-2/+4
| | | | | | * cord/cordbscs.c (CORD_cat_char_star, CORD_cat): Cast "lenx" to unsigned char (to workaround false compiler warning about value truncation).
* Fix compilation for Android clang/arm with bfd linkerIvan Maidanski2015-09-171-5/+7
| | | | | * include/private/thread_local_alloc.h (USE_COMPILER_TLS): Do not define if ARM32 (and PLATFORM_ANDROID and __clang__); update comment.
* Enable thread-local storage for Android ClangIvan Maidanski2015-09-161-4/+11
| | | | | * include/private/thread_local_alloc.h (USE_COMPILER_TLS): Define for Android NDK clang3.6+ arm/arm64/x86/x86_64 (NDK r10e); update comment.
* windows-untested: Fix paths to msvc_dbg.c/hIvan Maidanski2015-09-159-18/+18
| | | | | | | | | | | | | * windows-untested/vc60/gc.dsp (SOURCE): Fix paths to msvc_dbg.c and msvc_dbg.h. * windows-untested/vc60/libgc.dsp (SOURCE): Likewise. * windows-untested/vc60/libgcmt.dsp (SOURCE): Likewise. * windows-untested/vc60/libgcmt.dsp (File RelativePath): Likewise. * windows-untested/vc70/libgc.vcproj (File RelativePath): Likewise. * windows-untested/vc70/libgcmt.vcproj (File RelativePath): Likewise. * windows-untested/vc71/gc.vcproj (File RelativePath): Likewise. * windows-untested/vc71/libgc.vcproj (File RelativePath): Likewise. * windows-untested/vc71/libgcmt.vcproj (File RelativePath): Likewise.
* Update AUTHORS fileIvan Maidanski2015-09-151-0/+1
|
* Fix typos in README for ews4800Terrell Russell2015-09-151-3/+3
| | | | * doc/README.ews4800: Fix typos ("information", "vendor", "the").
* Update compiler options in gc.mak (Win32)Ivan Maidanski2015-09-141-140/+140
| | | | | | | * gc.mak (CFG): Fix info about default configuration. * gc.mak (CPP_PROJ): Replace deprecated /GX option with /EHsc; remove deprecated /YX option; add /D _CRT_SECURE_NO_DEPRECATE option (to suppress warning about vsprintf usage).
* .gitignore: Ignore .exp and .sbr also in subfolders (MSVC)Ivan Maidanski2015-09-141-2/+2
|
* Turn off sigsetjmp workaround for Android/x86 starting from NDK r8eIvan Maidanski2015-09-111-3/+9
| | | | | * include/private/gcconfig.h (GC_NO_SIGSETJMP): Do not define for Android/x86 if NDK r8e+; update comment.
* Fix abort message in GC_move_long_linkIvan Maidanski2015-09-111-1/+1
| | | | * finalize.c (GC_move_long_link): Fix function name in abort message.
* Fix 'comparison of non-null parameter is always false' warning (Clang)Ivan Maidanski2015-09-104-9/+19
| | | | | | | | | | | * alloc.c (GC_set_stop_func, GC_try_to_collect): Use NONNULL_ARG_NOT_NULL to check argument marked as non-null (in function declaration) is actually non-null. * finalize.c (GC_general_register_disappearing_link, GC_register_long_link, GC_move_disappearing_link, GC_move_long_link): Likewise. * misc.c (GC_set_warn_proc, GC_set_abort_func, GC_set_oom_fn): Likewise. * include/private/gc_priv.h (NONNULL_ARG_NOT_NULL): New macro.
* Allow fork() automatic handling on Android with API level 21+Ivan Maidanski2015-09-101-1/+2
| | | | | * include/private/gcconfig.h (CAN_CALL_ATFORK): Define also if __ANDROID_API__ >= 21.
* Consistently use int[] type for '_end' symbolIvan Maidanski2015-09-101-10/+10
| | | | | | | (code refactoring) * include/private/gcconfig.h (_end): Change char[] type to int[] (for remaining entries).
* Workaround 'sa_sigaction member missing' compiler error (Android/x32)Ivan Maidanski2015-09-102-5/+14
| | | | | | | | | | | Client should define NO_SA_SIGACTION to enable the workaround. * include/private/gcconfig.h (NO_SA_SIGACTION): New macro (explicitly define if SA_SIGINFO undefined). * include/private/gcconfig.h (MPROTECT_VDB): Undefine if NO_SA_SIGACTION unless DARWIN, MSWIN32 or MSWINCE. * pthread_stop_world.c (GC_suspend_handler, GC_stop_init): Check NO_SA_SIGACTION instead of SA_SIGINFO.
* Support build for Android 64-bit (arm64, mips64, x86_64)Ivan Maidanski2015-09-102-8/+14
| | | | | | | | | | | | * include/private/gcconfig.h (_end): Replace type from char[] to int[] to avoid redefinition error (as it is also declared in gc.h) for Linux/x86_64. * include/private/gcconfig.h (NO_GETCONTEXT): Define for all Android targets. * include/private/gcconfig.h (USE_TKILL_ON_ANDROID): New macro (defined only for 32-bit Android targets). * pthread_stop_world.c (tkill, android_thread_kill, GC_suspend_all, GC_start_world): Use USE_TKILL_ON_ANDROID instead of PLATFORM_ANDROID.
* Fix 'cast to pointer from integer' warning in GC_on_thread_event (64-bit)Ivan Maidanski2015-09-091-2/+3
| | | | | * pthread_stop_world.c (GC_suspend_all, GC_start_world): Cast thread_id to pointer via word type on passing to GC_on_thread_event; add comment.
* Support Android API level 21Ivan Maidanski2015-09-091-3/+3
| | | | | | | (fix 'link_map redefinition' error on Android with API level 21+) * dyn_load.c (link_map, r_debug): Do not define if android-21 (or higher) API is used; update comment.
* Fix (allow) thread local allocations from within pthread TLS destructorsNiklas Therning2015-09-042-2/+17
| | | | | | | | | | | | Prevents the GC_thread_key from being cleared on thread exit until after the thread has been unregistered by GC_unregister_my_thread_inner. * include/private/thread_local_alloc.h (GC_remove_specific): Call pthread_setspecific(key, NULL) if USE_PTHREAD_SPECIFIC; update comment. * thread_local_alloc.c (reset_thread_key): New static function if USE_PTHREAD_SPECIFIC); define (as macro) to 0 otherwise. * thread_local_alloc.c (GC_init_thread_local): Pass reset_thread_key (instead of 0) to GC_key_create.
* Fix 'visibility attribute not supported' GCC warning (IBM AIX)Ivan Maidanski2015-09-024-7/+8
| | | | | | | | | * configure.ac (enable_shared): Add -D GC_NO_VISIBILITY to CFLAGS if not ac_cv_fvisibility_hidden. * include/cord.h (CORD_API): Do not use visibility attribute if GC_NO_VISIBILITY. * include/gc_config_macros.h (GC_API): Likewise. * include/private/gc_priv.h (GC_INNER, GC_API_OSCALL): Likewise.