3287 Commits

Author SHA1 Message Date
Luke Street e9fd783df5 Linker fixes for libnx 2018-12-13 00:33:10 -05:00
Luke Street e9737dac70 Use thread suspension with libnx 2018-12-03 00:46:45 -05:00
Luke Street de325e14ac Exclude pthread_stop_world for libnx 2018-12-02 13:48:14 -05:00
Luke Street 4d813be83f Fixes for libnx 2018-11-30 16:28:09 -05:00
Luke Street 91a1b8b326 Merge remote-tracking branch 'ivmai/master' 2018-11-25 11:51:19 -05:00
Ivan Maidanski 950d21b6fc Travis CI: Test with -D TEST_WITH_SYSTEM_MALLOC passed to CFLAGS 2018-11-23 21:41:07 +03:00
Ivan Maidanski 63b237ea5f Eliminate 'function is never used' cppcheck warning for calloc/realloc
* tests/test.c [TEST_WITH_SYSTEM_MALLOC] (run_one_test): Call calloc(),
realloc() and free().
2018-11-23 21:36:20 +03:00
Ivan Maidanski 8fc1ebf6dd Add initial testing of GC_enable/disable, MALLOC[_ATOMIC]_IGNORE_OFF_PAGE
* tests/test.c (run_one_test): Call GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(),
GC_disable(), GC_MALLOC_IGNORE_OFF_PAGE(), GC_enable().
2018-11-23 14:42:57 +03:00
Ivan Maidanski 976fdc817e Workaround 'GC_dump function is never used' cppcheck warning
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK
&& !NO_DEBUGGING] (main): Add UNTESTED(GC_dump).
2018-11-23 11:57:29 +03:00
Ivan Maidanski a613b15ce4 Workaround '*_stubborn function is never used' cppcheck warnings
* dbg_mlc.c (GC_debug_malloc_stubborn, GC_debug_change_stubborn): Do
not define if CPPCHECK.
* mallocx.c (GC_malloc_stubborn, GC_end_stubborn_change): Likewise.
* include/gc.h (GC_debug_change_stubborn): Always mark as
GC_ATTR_DEPRECATED (regardless of CPPCHECK).
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK]
(main): Remove UNTESTED(GC_debug_change_stubborn).
2018-11-23 11:49:31 +03:00
Ivan Maidanski 20cfa75b7b Fix mutex_trylock failure in disclaim_weakmap_test in leak detection mode
* tests/disclaim_weakmap_test.c (weakmap.links): Add comment.
* tests/disclaim_weakmap_test.c (weakmap_disclaim): If wm->links is
null then return 0 (do not use wm).
* tests/disclaim_weakmap_test.c (weakmap_destroy): Set links to null.
2018-11-23 09:23:02 +03:00
Ivan Maidanski 83c4564291 Fix 'collecting from unknown thread' abort in leak-finding mode for Win32
(fix of commit 8e6460052)

* include/private/gc_priv.h [THREADS] (GC_in_thread_creation): Declare
not only for pthreads.
* misc.c [!DONT_USE_ATEXIT && THREADS] (GC_exit_check): Set
GC_in_thread_creation to true before calling GC_gcollect for windows
threads as well.
* win32_threads.c (GC_in_thread_creation): Change STATIC to GC_INNER.
2018-11-23 02:22:41 +03:00
Ivan Maidanski 64b623ef3c Turn off leak detection mode explicitly in cord/de
* cord/tests/de.c [!WIN32] (main): Call GC_set_find_leak(0) before
GC_INIT() to disable leak detection mode.
* cord/tests/de_win.c [WIN32] (WinMain): Likewise.
2018-11-23 02:10:10 +03:00
Ivan Maidanski 0592da8c47 Print relevant message in tests not appropriate for leak detection mode
* cord/tests/cordtest.c (main): If GC_get_find_leak() then print a
message that the test is not designed for leak detection mode (i.e.,
plenty of leaks could be reported).
* tests/disclaim_bench.c (main): Likewise.
* tests/disclaim_test.c (main): Likewise.
* tests/disclaim_weakmap_test.c (main): Likewise.
* tests/initsecondarythread.c (main): Likewise.
* tests/middle.c (main): Likewise.
* tests/realloc_test.c (main): Likewise.
* tests/staticrootstest.c (main): Likewise.
* tests/test_cpp.cc (main): Likewise.
* tests/threadkey_test.c (main): Likewise.
* tests/trace_test.c (main): Likewise.
2018-11-23 01:17:28 +03:00
Ivan Maidanski 1d7cf245be Travis CI: Pass -U GC_PRIVATE_H to cppcheck 2018-11-22 16:39:52 +03:00
Ivan Maidanski 1cac788521 Workaround 'nonlocal var will use ptr to local var' cppcheck false positive
* extra/msvc_dbg.c (sym_namebuf_u): New union type.
* extra/msvc_dbg.c (GetSymbolNameFromAddress): Use sym_namebuf_u
instead of anonymous union.
* os_dep.c [MPROTECT_VDB && DARWIN] (mp_reply_s, mp_msg_s): Move struct
type definition out of GC_mprotect_thread (adding mp_ prefix).
2018-11-22 14:34:03 +03:00
Ivan Maidanski 225f807047 Eliminate 'struct member is never used' cppcheck warnings in os_dep
* os_dep.c [SPARC && LINUX] (struct frame): Declare only if
SAVE_CALL_CHAIN.
2018-11-22 13:01:16 +03:00
Ivan Maidanski 38c35921ce Workaround 'value of _MAX_PATH is unknown' cppcheck warning
* include/private/gcconfig.h [CPPCHECK] (_MAX_PATH): Undefine.
2018-11-22 08:29:31 +03:00
Ivan Maidanski a81e116eeb Travis CI: Test with FIND_LEAK 2018-11-22 01:01:46 +03:00
Ivan Maidanski eb50313129 Fix test_cpp assertion violation in find-leak mode
* tests/test_cpp.cc (C.Test, D.Test, F.Test): Do not fail on
nFreed>=0.8*nAllocated[F] assertion violation if GC_get_find_leak() returns
non-zero; replace .8*nAllocated[F] to (nAllocated[F]/5)*4 to avoid
floating-point operations.
2018-11-22 00:53:33 +03:00
Ivan Maidanski 06019fb90d New macro to suppress printing of leaked objects
The macro (SKIP_LEAKED_OBJECTS_PRINTING) might be useful for running
GC general tests in the find-leak mode.

* reclaim.c (GC_print_all_errors): Do not call GC_print_heap_obj
if SKIP_LEAKED_OBJECTS_PRINTING is defined.
2018-11-22 00:19:43 +03:00
Ivan Maidanski 1ae6762a1a Travis CI: Test with AO_USE_PTHREAD_DEFS passed in CFLAGS to configure 2018-11-21 12:47:03 +03:00
Ivan Maidanski 792268aea3 Turn off parallel marker, thread-local allocation if used AO ops emulated
* configure.ac (use_parallel_mark, use_thread_local_alloc): New
variable (set to enable_parallel_mark and enable_thread_local_alloc,
respectively, if threads are enabled).
* configure.ac (PARALLEL_MARK, THREAD_LOCAL_ALLOC): Group and move
AC_DEFINE down (the definition depends on the final value of
use_parallel_mark or use_thread_local_alloc, respectively).
* configure.ac (THREAD_LOCAL_ALLOC): Move AM_CONDITIONAL down to use
the final value of use_thread_local_alloc; do not check THREADS.
* configure.ac (handle-fork): Move AC_ARG_ENABLE and its processing
down to use the final value of use_parallel_mark (the latter is used
instead of enable_parallel_mark).
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true]
(use_thread_local_alloc): Set explicitly to "no" if
BASE_ATOMIC_OPS_EMULATED is defined.
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true
&& $use_parallel_mark!=no] (use_parallel_mark): Set explicitly to "no"
in case of a failure of AC_TRY_LINK of a code snippet calling
AO_fetch_and_add and AO_compare_and_swap (provided AO_REQUIRE_CAS is
defined).
* include/private/gc_pmark.h [USE_MARK_BYTES && PARALLEL_MARK
&& AO_HAVE_char_store] (SET_MARK_BIT_EXIT_IF_SET): Do not use
AO_char_load() and AO_char_store() if BASE_ATOMIC_OPS_EMULATED.
2018-11-21 12:44:46 +03:00
Ivan Maidanski 016f30060f Fix a deadlock in write_fault_handler if AO_or is emulated
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true]
(HAVE_LOCKFREE_AO_OR): New AC_DEFINE (defined in case of success of
AC_TRY_LINK of a code snippet calling AO_or).
* include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC
&& !NO_LOCKFREE_AO_OR] (HAVE_LOCKFREE_AO_OR): Define (to 1).
* include/private/gc_priv.h [THREADS] (GC_acquire_dirty_lock,
GC_release_dirty_lock): Define to no-op only if HAVE_LOCKFREE_AO_OR
or GC_DISABLE_INCREMENTAL.
* os_dep.c [!GC_DISABLE_INCREMENTAL] (async_set_pht_entry_from_index):
Use set_pht_entry_from_index_concurrent() only if HAVE_LOCKFREE_AO_OR
(or not THREADS).
2018-11-21 00:19:20 +03:00
Ivan Maidanski 70283bbb45 Do not use spin locks if AO test-and-set is emulated (pthreads)
* include/private/gc_locks.h [BASE_ATOMIC_OPS_EMULATED && GC_PTHREADS]
(USE_PTHREAD_LOCKS): Define.
* include/private/gc_locks.h [BASE_ATOMIC_OPS_EMULATED && GC_PTHREADS]
(USE_SPIN_LOCK): Undefine.
* pthread_support.c [(USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)
&& AO_CLEAR] (GC_pause): Do not use AO_compiler_barrier() if
BASE_ATOMIC_OPS_EMULATED.
* pthread_support.c [AO_HAVE_char_load] (is_collecting): Do not use
AO_char_load() if BASE_ATOMIC_OPS_EMULATED.
2018-11-20 23:47:08 +03:00