]>
granicus.if.org Git - gc/log
Ivan Maidanski [Fri, 2 Mar 2018 09:03:01 +0000 (12:03 +0300)]
Change backtrace-specific code to comply with C++11 standard
Issue #206 (bdwgc).
* dbg_mlc.c (GC_get_back_ptr_info): Cast GC_REVEAL_POINTER() result
to ptr_t (when assigned to bp local variable).
* dbg_mlc.c (GC_generate_random_valid_address): Cast result of
GC_generate_random_heap_address() to ptr_t.
* dbg_mlc.c (GC_print_backtrace): Cast GC_print_heap_obj() argument
to ptr_t.
Ivan Maidanski [Fri, 2 Mar 2018 08:28:50 +0000 (11:28 +0300)]
Workaround missing extern 'C' for _DYNAMIC in link.h on some Linux hosts
Issue #206 (bdwgc).
* dyn_load.c [DYNAMIC_LOADING && (SCO_ELF || DGUX || HURD
|| __ELF__ && (LINUX || FREEBSD || NACL || NETBSD || OPENBSD))
&& !HOST_ANDROID]: Put EXTERN_C_BEGIN/END around include link.h; add
comment.
Ivan Maidanski [Thu, 1 Mar 2018 22:38:10 +0000 (01:38 +0300)]
Wrap remaining extern symbols in .c files into EXTERN_C_BEGIN/END
Issue #206 (bdwgc).
* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES] (_DYNAMIC):
Move the extern symbol declaration out of a function body.
* os_dep.c [!PCR && !MACOS && REDIRECT_MALLOC && GC_SOLARIS_THREADS]
(sbrk): Likewise.
* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES] (_DYNAMIC):
Wrap into EXTERN_C_BEGIN/END block.
* dyn_load.c [__ELF__ && LINUX && HOST_ANDROID || HAVE_DL_ITERATE_PHDR]
(dl_iterate_phdr): Likewise.
* dyn_load.c [!USE_PROC_FOR_LIBRARIES] (_DYNAMIC): Likewise.
* dyn_load.c [ALPHA && OSF1 || HPUX] (sys_errlist, sys_nerr, errno):
Likewise.
* os_dep.c [SEARCH_FOR_DATA_START && (LINUX || HURD)] (__data_start,
data_start): Likewise.
* os_dep.c [SEARCH_FOR_DATA_START && LINUX && HOST_ANDROID] (_etext,
__dso_handle): Likewise.
* os_dep.c [NETBSD && __ELF__] (environ): Likewise.
* os_dep.c [OPENBSD && THREADS] (__syscall): Likewise.
* os_dep.c [LINUX_STACKBOTTOM && USE_LIBC_PRIVATES] (__libc_stack_end):
Likewise.
* os_dep.c [LINUX_STACKBOTTOM && USE_LIBC_PRIVATES && IA64]
(__libc_ia64_register_backing_store_base): Likewise.
* os_dep.c [SYMBIAN] (GC_get_main_symbian_stack_base): Likewise.
* os_dep.c [!PCR && !MACOS && REDIRECT_MALLOC && GC_SOLARIS_THREADS]
(sbrk): Likewise.
* os_dep.c [MMAP_SUPPORTED && SYMBIAN]
(GC_get_private_path_and_zero_file): Likewise.
* pthread_stop_world.c [USE_TKILL_ON_ANDROID] (tkill): Likewise.
* pthread_stop_world.c [NACL] (nacl_interface_query): Likewise.
* pthread_support.c [PTHREAD_REGISTER_CANCEL_WEAK_STUBS]
(__pthread_register_cancel, __pthread_unregister_cancel): Likewise.
* pthread_support.c [PTHREAD_REGISTER_CANCEL_WEAK_STUBS]
(__pthread_register_cancel, __pthread_unregister_cancel): Use "void"
to denote empty arguments list.
Ivan Maidanski [Thu, 1 Mar 2018 20:06:54 +0000 (23:06 +0300)]
windows-untested: Add gc_alloc_ptrs.h source file
Ivan Maidanski [Thu, 1 Mar 2018 20:02:41 +0000 (23:02 +0300)]
Eliminate 'unused const variable' C++ warnings for [a][u]objfreelist_ptr
Issue #206 (bdwgc).
* Makefile.direct (SRCS): Add include/gc_alloc_ptrs.h.
* include/include.am (dist_noinst_HEADERS): Likewise.
* include/gc_alloc_ptrs.h: New file.
* include/new_gc_alloc.h (GC_objfreelist_ptr, GC_aobjfreelist_ptr,
GC_uobjfreelist_ptr, GC_auobjfreelist_ptr, GC_incr_bytes_allocd,
GC_incr_bytes_freed): Move to the declarations to gc_alloc_ptrs.h.
* include/new_gc_alloc.h: Include gc_alloc_ptrs.h; update comment.
* mallocx.c: Likewise.
Ivan Maidanski [Thu, 1 Mar 2018 19:47:22 +0000 (22:47 +0300)]
Fix missing GC_generic_malloc_words_small implementation in new_gc_alloc.h
* include/new_gc_alloc.h (GC_generic_malloc_words_small): Replace
prototype with a macro (that uses GC_generic_malloc); remove FIXME item.
Ivan Maidanski [Thu, 1 Mar 2018 08:58:48 +0000 (11:58 +0300)]
Fix missing explicit cast of si_addr to char* in write_fault_handler
Issue #206 (bdwgc).
* os_dep.c [!DARWIN && !MSWIN32 && !MSWINCE] (GC_write_fault_handler):
Cast si->si_addr to char* when assigned to addr local variable.
Ivan Maidanski [Thu, 1 Mar 2018 08:47:58 +0000 (11:47 +0300)]
Travis CI: Test javaxfc.h symbols linkage in case of a C++ compiler
Ivan Maidanski [Thu, 1 Mar 2018 08:44:07 +0000 (11:44 +0300)]
Eliminate 'unused const variable' Clang warning for copyright and version
Issue #206 (bdwgc).
* alloc.c (GC_copyright): Declare (inside EXTERN_C_BEGIN/END) before
the definition.
* alloc.c [!GC_NO_VERSION_VAR] (GC_version): Likewise.
Ivan Maidanski [Thu, 1 Mar 2018 08:35:41 +0000 (11:35 +0300)]
Fix linkage of javaxfc.h symbols for the case of compilation as C++ code
Issue #206 (bdwgc).
The functions should be declared (as extern "C") before the definition.
* finalize.c [!GC_NO_FINALIZATION]: Include javaxfc.h.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD]: Likewise.
Ivan Maidanski [Wed, 28 Feb 2018 20:45:12 +0000 (23:45 +0300)]
Move include gcconfig.h ouf of extern 'C' block
(fix of commit
f4fbef0 )
Issue #201 (bdwgc).
Extern "C" should be only around declarations, not includes.
* tests/test_cpp.cc: Move the beginning of extern "C" block
below #include gcconfig.h.
Ivan Maidanski [Wed, 28 Feb 2018 20:16:36 +0000 (23:16 +0300)]
Fix include gc_gcj.h in thread_local_alloc.c
The #include for the public GC headers should not contain "include/"
prefix.
* thread_local_alloc.c [GC_GCJ_SUPPORT]: Include "gc_gcj.h" instead of
"include/gc_gcj.h".
Ivan Maidanski [Wed, 28 Feb 2018 18:39:04 +0000 (21:39 +0300)]
Replace conditional extern 'C' blocks begin/end with EXTERN_C_BEGIN/END
(code refactoring)
Issue #206 (bdwgc).
Note: EXTERN_C_BEGIN and EXTERN_C_END are not available in the GC
public headers.
* include/private/darwin_stop_world.h: Replace the conditional
extern "C" block begin/end with EXTERN_C_BEGIN and EXTERN_C_END,
respectively.
* include/private/dbg_mlc.h: Likewise.
* include/private/gc_hdrs.h: Likewise.
* include/private/gc_locks.h: Likewise.
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* include/private/gcconfig.h: Likewise.
* include/private/pthread_stop_world.h: Likewise.
* include/private/pthread_support.h: Likewise.
* include/private/specific.h: Likewise.
* include/private/thread_local_alloc.h: Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN]: Likewise.
* tests/test.c [GC_AMIGA_FASTALLOC && AMIGA]: Likewise.
* include/private/gcconfig.h (EXTERN_C_BEGIN, EXTERN_C_END): Define
macro.
Ivan Maidanski [Wed, 28 Feb 2018 06:40:27 +0000 (09:40 +0300)]
Remove a redundant check of __cplusplus in Symbian-specific .cpp files
(code refactoring)
* extra/symbian.cpp: Remove "#ifdef __cplusplus" as the latter should
be defined (by default) in case of .cpp file.
* extra/symbian/global_end.cpp: Likewise.
* extra/symbian/global_start.cpp: Likewise.
* extra/symbian/init_global_static_roots.cpp: Likewise.
* extra/symbian/init_global_static_roots.cpp
(GC_init_global_static_roots): Adjust indentation.
Ivan Maidanski [Wed, 28 Feb 2018 06:27:26 +0000 (09:27 +0300)]
Remove API symbols renaming in WCC_MAKEFILE
GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed are now
declared as GC_API, the so symbols renaming by the linker is not needed.
GC_generic_malloc_words_small does not exist anymore.
* WCC_MAKEFILE [MAKE_AS_DLL] (gc.dll): Remove "append $*.lnk export"
for GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.
* WCC_MAKEFILE (gc.lib): Adjust indentation.
* WCC_MAKEFILE [MAKE_AS_DLL] (gctest.exe): Remove "append $*.lnk import"
for GC_is_marked.
* WCC_MAKEFILE [MAKE_AS_DLL] (test_cpp.exe): Remove
"append $*.lnk import" for GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.
Ivan Maidanski [Wed, 28 Feb 2018 06:21:18 +0000 (09:21 +0300)]
Travis CI: Output content of threadkey_test.log
Ivan Maidanski [Wed, 28 Feb 2018 06:12:54 +0000 (09:12 +0300)]
Declare all internal functions in private headers instead of .c files
(code refactoring)
Issue #206 (bdwgc).
* include/private/darwin_stop_world.h [MPROTECT_VDB
&& !GC_NO_THREADS_DISCOVERY] (GC_darwin_register_mach_handler_thread):
Declare function.
* include/private/gc_priv.h [WRAP_MARK_SOME && PARALLEL_MARK]
(GC_push_conditional_eager): Likewise.
* include/private/gc_priv.h [!THREADS && TRACE_BUF]
(GC_add_trace_entry): Likewise.
* include/private/gc_priv.h (GC_collect_or_expand): Likewise.
* include/private/gc_priv.h [MPROTECT_VDB && USE_MUNMAP]
(GC_mprotect_dirty_init, GC_has_unmapped_memory): Likewise.
* include/private/gc_priv.h [CHECKSUMS && MPROTECT_VDB && !DARWIN]
(GC_record_fault): Likewise.
* include/private/gc_priv.h [CHECKSUMS] (GC_check_dirty): Likewise.
* include/private/gc_priv.h [GC_WIN32_THREADS && WRAP_MARK_SOME
&& !GC_PTHREADS] (GC_started_thread_while_stopped): Likewise.
* include/private/gc_priv.h [SEARCH_FOR_DATA_START
|| NETBSD && __ELF__] (GC_find_limit): Likewise.
* include/private/gc_priv.h [NEED_PROC_MAPS && (IA64
|| INCLUDE_LINUX_THREAD_DESCR)] (GC_enclosing_mapping): Likewise.
* include/private/pthread_support.h (GC_inner_start_routine): Likewise.
* include/private/thread_local_alloc.h [GC_ASSERTIONS]
(GC_is_thread_tsd_valid, GC_check_tls_for): Likewise.
* include/private/thread_local_alloc.h [GC_ASSERTIONS
&& USE_CUSTOM_SPECIFIC] (GC_check_tsd_marks): Likewise.
* include/private/gc_priv.h [HEURISTIC2 || SEARCH_FOR_DATA_START
|| !STACKBOTTOM && HEURISTIC2 || (SVR4 || AIX || DGUX
|| LINUX && SPARC) && !PCR] (NEED_FIND_LIMIT): Collapse multiple
definitions.
* malloc.c (GC_collect_or_expand): Remove prototype.
* mark.c [CHECKSUMS] (GC_check_dirty): Likewise.
* mark.c [GC_WIN32_THREADS && !GC_PTHREADS]
(GC_started_thread_while_stopped): Likewise.
* mark_rts.c [WRAP_MARK_SOME && PARALLEL_MARK]
(GC_push_conditional_eager): Likewise.
* mark_rts.c [!THREADS && TRACE_BUF] (GC_add_trace_entry): Likewise.
* os_dep.c [SEARCH_FOR_DATA_START || NETBSD && __ELF__]
(GC_find_limit): Likewise.
* os_dep.c [CHECKSUMS && MPROTECT_VDB && !DARWIN] (GC_record_fault):
Likewise.
* os_dep.c [MPROTECT_VDB && USE_MUNMAP] (GC_has_unmapped_memory,
GC_mprotect_dirty_init): Likewise.
* os_dep.c [MPROTECT_VDB && !GC_NO_THREADS_DISCOVERY]
(GC_darwin_register_mach_handler_thread): Likewise.
* pthread_support.c [GC_ASSERTIONS] (GC_check_tls_for): Likewise.
* pthread_support.c [GC_ASSERTIONS && USE_CUSTOM_SPECIFIC]
(GC_check_tsd_marks): Likewise.
* pthread_support.c [INCLUDE_LINUX_THREAD_DESCR]
(GC_enclosing_mapping): Likewise.
* pthread_support.c [!SN_TARGET_ORBIS && !SN_TARGET_PSP2]
(GC_inner_start_routine): Likewise.
* thread_local_alloc.c [GC_ASSERTIONS] (GC_is_thread_tsd_valid):
Likewise.
* win32_threads.c [GC_ASSERTIONS] (GC_check_tls_for): Likewise.
* win32_threads.c [GC_ASSERTIONS && USE_CUSTOM_SPECIFIC]
(GC_check_tsd_marks): Likewise.
Ivan Maidanski [Wed, 28 Feb 2018 05:26:27 +0000 (08:26 +0300)]
Fix typo in AIX macro name
* include/private/gc_priv.h [AIX] (NEED_FIND_LIMIT): Define macro
(rename AUX to AIX).
* os_dep.c [AIX && !PCR] (GC_SysVGetDataStart): Define function.
Ivan Maidanski [Wed, 28 Feb 2018 02:55:59 +0000 (05:55 +0300)]
Eliminate warning about unused start_routine for Orbis and PSP2
(fix of commits
d5dad58 ,
cd63cf1 )
Issue #173 (bdwgc).
* pthread_support.c (GC_inner_start_routine, GC_start_routine): Do not
define if SN_TARGET_ORBIS or SN_TARGET_PSP2.
Ivan Maidanski [Tue, 27 Feb 2018 21:46:23 +0000 (00:46 +0300)]
Fix GC_free_bytes[] linkage for the case of compilation as C++ code
Issue #206 (bdwgc).
* include/private/gc_priv.h [GC_GCJ_SUPPORT] (GC_free_bytes): Declare;
update comment.
Ivan Maidanski [Tue, 27 Feb 2018 21:35:19 +0000 (00:35 +0300)]
Fix dbg_mlc.c/o file name in documentation
* README.md (Debugging Facilities): Fix file name ("dbg_mlc.c").
* misc.c (GC_debugging_started): Fix file name ("dbg_mlc.o") in
comment.
Hans Boehm [Mon, 26 Feb 2018 20:45:24 +0000 (23:45 +0300)]
Avoid potential race when accessing size_map table
There is again a data race between GC_extend_size_map and GC_size_map[]
readers, though it is again not likely to fail in practice.
It is feasible to just move all of the GC_size_map accesses under the
lock, and this does not look to incur a substantial penalty.
* gcj_mlc.c (GC_gcj_malloc, GC_gcj_malloc_ignore_off_page): Move
lg=GC_size_map[lb] to be right after LOCK() instead of preceding it.
* malloc.c (GC_malloc_kind_global, GC_generic_malloc_uncollectable):
Likewise.
* typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page): Likewise.
* include/gc.h (GC_get_size_map_at): Update comment to note that the
client should use synchronization when calling the function.
* include/private/gc_priv.h (_GC_arrays._size_map): Add comment about
synchronization.
Ivan Maidanski [Mon, 26 Feb 2018 20:27:21 +0000 (23:27 +0300)]
Revert 'Workaround TSan false positives in extend_size_map'
This reverts commit
e522d6d791680b55825b5f11a4c082eb4770ecf5 .
Because there is again a data race here, not a false positive,
though it is again not likely to fail in practice.
Ivan Maidanski [Mon, 26 Feb 2018 19:03:30 +0000 (22:03 +0300)]
Always include gc_atomic_ops.h unless threads are disabled
(code refactoring)
* include/private/gc_atomic_ops.h [!GC_BUILTIN_ATOMIC]: Issue #error
if AO_HAVE_load or AO_HAVE_store is not defined after include
atomic_ops.h.
* include/private/gc_locks.h: Do not include gc_atomic_ops.h.
* include/private/specific.h: Likewise.
* pthread_stop_world.c: Likewise.
* tests/test.c [THREADS && (GC_BUILTIN_ATOMIC || PARALLEL_MARK
|| !GC_WIN32_THREADS)]: Likewise.
* thread_local_alloc.c: Likewise.
* typd_mlc.c [GC_FORCE_INCLUDE_ATOMIC_OPS || GC_BUILTIN_ATOMIC]:
Likewise.
* win32_threads.c [(GC_DLL || GC_INSIDE_DLL) && !THREAD_LOCAL_ALLOC
&& !GC_NO_THREADS_DISCOVERY && !MSWINCE && !GC_PTHREADS]: Likewise.
* include/private/gc_priv.h [THREADS && !SN_TARGET_ORBIS
&& !SN_TARGET_PSP2]: Include gc_atomic_ops.h (after GC_INLINE
definition).
* include/private/gc_priv.h (counter_t): Do not define.
* include/private/gc_priv.h (hblkhdr): Change type of hb_n_marks
to either volatile AO_t (if PARALLEL_MARK) or size_t
* mark.c (GC_noop6): Check AO_CLEAR macro presence instead of
GC_PTHREADS and !GC_WIN32_THREADS or PARALLEL_MARK.
* tests/test_atomic_ops.c [_WIN32 || _MSC_VER || __CYGWIN__
|| __MINGW32__] (main): Do not skip the test.
Ivan Maidanski [Mon, 26 Feb 2018 06:33:23 +0000 (09:33 +0300)]
Fix Haiku/amd64 support
(fix of commit
847927f )
Issue #97 (bdwgc).
* include/gc_config_macros.h [__HAIKU__ && !GC_CAN_SAVE_CALL_STACKS]
(GC_ADD_CALLER): Define macro.
* include/private/gcconfig.h [__HAIKU__ && __x86_64__] (X86_64, HAIKU,
mach_type_known): Likewise.
* include/private/gcconfig.h [HAIKU && X86_64] (HEURISTIC2,
SEARCH_FOR_DATA_START): Likewise.
* include/private/gcconfig.h [UNIX_LIKE && HAIKU] (NO_GETCONTEXT):
Likewise.
* include/private/thread_local_alloc.h [GC_HAIKU_THREADS]
(USE_PTHREAD_SPECIFIC): Likewise.
* include/private/gcconfig.h [HAIKU && X86_64] (etext, DATASTART): Do
not define.
Jay Krell [Sun, 18 Feb 2018 05:23:34 +0000 (21:23 -0800)]
Fiddle with linkage to make extra/gc.c valid C++ code
Issue #206 (bdwgc).
Specifically: int i; int i = 0; is not valid, but:
extern int i; int i = 0; is valid. Adding static would also be
desirable here but requires a larger change.
* extra/gc.c (GC_INNER, GC_EXTERN): Do not define if __cplusplus; add
comment and TODO item.
Jay Krell [Mon, 26 Feb 2018 04:53:37 +0000 (07:53 +0300)]
Change Darwin-specific code to comply with C++11 standard
Issue #206 (bdwgc).
* darwin_stop_world.c (GC_stack_range_for): Cast pointer which is
assinged to lo local variable to ptr_t (instead of void*).
* os_dep.c [GC_DARWIN_THREADS && MPROTECT_VDB]: Include
darwin_stop_world.h (so that GC_mprotect_stop and GC_mprotect_resume
to be declared and later defined as extern "C").
* os_dep.c [MPROTECT_VDB && DARWIN] (exc_server, exception_raise,
exception_raise_state): Wrap into extern "C" block; refine comment.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise_state,
catch_exception_raise_state_identity): Declare as extern "C" (before
the definition).
* os_dep.c [MPROTECT_VDB && DARWIN && THREADS] (GC_mprotect_state):
Initialize to GC_MP_NORMAL (instead of integer 0).
Ivan Maidanski [Thu, 22 Feb 2018 21:54:02 +0000 (00:54 +0300)]
Fix missing new-line in GC_INFOLOG_PRINTF call in ABORT_ARG<n>
* include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3):
Output "\n" after C_fmt by GC_INFOLOG_PRINTF.
Ivan Maidanski [Thu, 22 Feb 2018 21:34:39 +0000 (00:34 +0300)]
Report errno in case of sem_wait failure in GC_pthread_create
Issue #97 (bdwgc).
* pthread_support.c (WRAP_FUNC(pthread_create)): Change ABORT() for
"sem_wait failed" case to ABORT_ARG1() to report errno as well.
Ivan Maidanski [Thu, 22 Feb 2018 21:19:37 +0000 (00:19 +0300)]
Omit register keyword in performance-critical code if C++ compiler used
Issue #206 (bdwgc).
* headers.c (GC_next_used_block): Replace register keyword to REGISTER.
* include/private/gc_hdrs.h [HASH_TL] (GET_BI, GET_HDR_ADDR, GET_HDR,
SET_HDR): Likewise.
* mark.c (GC_push_all_eager): Likewise.
* mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager):
Likewise.
* include/private/gc_priv.h (REGISTER): New macro (defined before
include gc_hdrs.h); add comment.
Ivan Maidanski [Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)]
Fix type of local variables receiving result of PHT_HASH
The variables should be of word type, not int or size_t.
* os_dep.c (GC_write_fault_handler, GC_remove_protection): Change type
of index local variable from size_t to word.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Change
type of index local variable from int to word.
Jay Krell [Thu, 22 Feb 2018 20:23:48 +0000 (23:23 +0300)]
Eliminate C++ warnings about deprecated register keyword (GC source)
Issue #206 (bdwgc).
* blacklst.c (GC_number_stack_black_listed, total_stack_black_listed):
Remove register keyword for local variables.
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Likewise.
* extra/pcr_interface.c [PCR] (GC_enumerate_block): Likewise.
* finalize.c (GC_grow_table): Likewise.
* headers.c (alloc_hdr, GC_init_headers, GC_remove_counts,
GC_prev_block): Likewise.
* include/private/gc_pmark.h (PUSH_OBJ): Likewise.
* mach_dep.c [!HAVE_PUSH_REGS && !HAVE_BUILTIN_UNWIND_INIT]
(GC_with_callee_saves_pushed): Likewise.
* mark.c (clear_marks_for_block): Likewise.
* mark_rts.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_add_roots_inner):
Likewise.
* mark_rts.c [!NO_DEBUGGING] (GC_is_tmp_root): Likewise.
* os_dep.c [GWW_VDB || MPROTECT_VDB || PROC_VDB || MANUAL_VDB]
(GC_page_was_dirty): Likewise.
* os_dep.c [CHECKSUMS && GWW_VDB || PROC_VDB] (GC_or_pages,
GC_page_was_ever_dirty): Likewise.
* os_dep.c (GC_write_fault_handler): Likewise.
* os_dep.c [PROC_VDB] (GC_read_dirty): Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Likewise.
* os_dep.c [SAVE_CALL_CHAIN && NARGS>0] (GC_save_callers): Likewise.
* pthread_stop_world.c [!NACL] (GC_start_world): Likewise.
* pthread_support.c (GC_delete_thread, GC_delete_gc_thread): Likewise.
* typd_mlc.c (GC_push_complex_descriptor): Likewise.
* win32_threads.c (GC_delete_gc_thread_no_free, GC_delete_thread):
Likewise.
Jay Krell [Mon, 19 Feb 2018 11:42:25 +0000 (03:42 -0800)]
Eliminate C++ warning about deprecated register keyword (cord)
Issue #206 (bdwgc).
* cord/cordbscs.c (CORD_dump_inner, CORD_cat_char_star, CORD_cat,
CORD_from_fn_inner, CORD_index_access_fn, CORD_apply_access_fn,
CORD_substr_closure, CORD_substr_checked, CORD_substr, CORD_iter5,
CORD_riter4, CORD_init_min_len, CORD_init_forest, CORD_add_forest,
CORD_concat_forest, CORD_balance_insert, CORD_balance,
CORD__extend_path, CORD__pos_fetch, CORD__next, CORD__prev,
CORD_pos_fetch: Remove register keyword for local variables (and
function parameters).
* cord/cordprnt.c (extract_conv_spec, CORD_vsprintf): Likewise.
* cord/cordxtra.c (CORD_cat_char, CORD_catn, CORD_fill_proc,
CORD_batched_fill_proc, CORD_cmp, CORD_ncmp, CORD_to_char_star,
CORD_put_proc, CORD_batched_put_proc, CORD_chr_proc, CORD_rchr_proc,
CORD_batched_chr_proc, CORD_str, CORD_ec_flush_buf,
CORD_from_file_eager, refill_cache, CORD_lf_func,
CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file):
Likewise.
* cord/tests/cordtest.c (test_basics, test_extras): Likewise.
* cord/tests/de.c (retrieve_line, redisplay): Likewise.
* cord/tests/de_win.c (plain_chars, control_chars, WndProc): Likewise.
Jay Krell [Mon, 19 Feb 2018 11:43:37 +0000 (03:43 -0800)]
Fix 'invalid conversion from const char* to char*' in CORD_batched_chr_proc
Issue #206 (bdwgc).
Add const to the variable receiving strchr() result for C++ compatibility.
* cord/cordxtra.c (CORD_batched_chr_proc): Change type of occ local
variable from char* to const char*; remove register keyword for occ.
Ivan Maidanski [Tue, 20 Feb 2018 20:03:29 +0000 (23:03 +0300)]
Fix 'anonymous type with no linkage used to declare variable' in GC source
Issue #206 (bdwgc).
* dyn_load.c [DARWIN] (GC_dyld_sections): Provide some name to struct.
* finalize.c (GC_fnlz_roots): Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN] (GC_ports,
GC_mprotect_thread_notify, GC_mprotect_thread): Likewise.
Ivan Maidanski [Tue, 20 Feb 2018 08:48:57 +0000 (11:48 +0300)]
Update AUTHORS file
Aurelien Larcher [Tue, 20 Jun 2017 22:14:44 +0000 (22:14 +0000)]
Do not use alternate thread library on Solaris
* configure.ac [THREADS=posix && host=*-*-solaris*]
(multi_os_directory): Remove variable; remove comment.
* configure.ac [THREADS=posix && host=*-*-solaris*] (THREADDLLIBS):
Remove -L and -R options.
Shea Levy [Mon, 19 Feb 2018 15:38:26 +0000 (10:38 -0500)]
Merge RISCV 32/64-bit configurations definition
(code refactoring of commit
4f7f0ee )
Issue #208 (bdwgc).
* include/private/gcconfig.h [__riscv && LINUX] (RISCV32, RISCV64):
Replace with RISCV.
* include/private/gcconfig.h [RISCV] (MACH_TYPE): Change to "RISC-V".
* include/private/gcconfig.h [RISCV] (CPP_WORDSZ, ALIGNMENT): Define
using __riscv_xlen.
Ivan Maidanski [Tue, 20 Feb 2018 08:13:20 +0000 (11:13 +0300)]
Travis CI: Test compilation of GC/cord C files as C++ (Makefile.direct)
Ivan Maidanski [Tue, 20 Feb 2018 07:55:45 +0000 (10:55 +0300)]
Update AUTHORS file
Kimura Wataru [Mon, 19 Feb 2018 20:21:17 +0000 (23:21 +0300)]
Workaround Clang optimizer bug crashing clear_stack_inner on OS X 10.8
* misc.c [!ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED
&& !ASM_CLEAR_CODE && __APPLE_CC__ && !GC_CLANG_PREREQ(6,0)]
(GC_clear_stack_inner): Add volatile to limit argument.
Ivan Maidanski [Mon, 19 Feb 2018 08:02:12 +0000 (11:02 +0300)]
Fix man section number (3)
Library calls should use section 3 (unlike Programs that use section 1).
* doc/gc.man (TH GC_MALLOC): Change section number from 1L to 3.
Ivan Maidanski [Mon, 19 Feb 2018 07:52:02 +0000 (10:52 +0300)]
Update AUTHORS file (add Shea Levy)
Shea Levy [Sun, 18 Feb 2018 06:37:12 +0000 (01:37 -0500)]
Add initial RISC-V support
Issue #208 (bdwgc).
* include/private/gcconfig.h [__riscv && LINUX && __riscv_xlen==32]
(RISCV32, mach_type_known): Define macro.
* include/private/gcconfig.h [__riscv && LINUX && __riscv_xlen==64]
(RISCV64, mach_type_known): Define macro.
* include/private/gcconfig.h [RISCV32 || RISCV64] (CPP_WORDSZ,
MACH_TYPE, ALIGNMENT): Likewise.
* include/private/gcconfig.h [(RISCV32 || RISCV64) && LINUX] (OS_TYPE,
DATASTART, LINUX_STACKBOTTOM, DYNAMIC_LOADING): Likewise.
* include/private/gcconfig.h [(RISCV32 || RISCV64) && LINUX]
(__data_start): Declare external variable.
Ivan Maidanski [Fri, 16 Feb 2018 18:05:21 +0000 (21:05 +0300)]
Convert GC source files to valid C++ code
Issue #206 (bdwgc).
* alloc.c (GC_copyright): Change type from char* const to
const char* const.
* alloc.c (GC_set_fl_marks, GC_clear_fl_marks, GC_finish_collection,
GC_allocobj): Add missing explicit casts from void* to ptr_t.
* backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Likewise.
* blacklst.c (GC_default_print_heap_obj_proc,
GC_print_blacklisted_ptr): Likewise.
* dbg_mlc.c (GC_get_back_ptr_info, GC_store_debug_info_inner,
GC_store_debug_info, GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_generic_malloc,
GC_debug_malloc_stubborn, GC_debug_malloc_atomic,
GC_debug_malloc_uncollectable, GC_debug_malloc_atomic_uncollectable,
GC_debug_free, GC_debug_free_inner, GC_debug_register_finalizer,
GC_debug_register_finalizer_no_order,
GC_debug_register_finalizer_unreachable,
GC_debug_register_finalizer_ignore_self): Likewise.
* finalize.c (GC_grow_table, push_and_mark_object,
ensure_toggleref_capacity, GC_dump_finalization_links,
GC_dump_finalization, GC_make_disappearing_links_disappear,
GC_remove_dangling_disappearing_links, GC_finalize): Likewise.
* gcj_mlc.c (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Likewise.
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* mallocx.c (GC_memalign): Likewise.
* mark.c (GC_mark_from, GC_mark_and_push, GC_push_all_eager,
GC_push_all_stack, GC_push_marked1, GC_push_marked2, GC_push_marked4):
Likewise.
* mark_rts.c (GC_exclude_static_roots_inner): Likewise.
* misc.c (GC_base): Likewise.
* new_hblk.c (GC_new_hblk): Likewise.
* pthread_support.c (GC_register_altstack, GC_thr_init,
GC_record_stack_base): Likewise.
* ptr_chck.c (GC_is_visible): Likewise.
* reclaim.c (GC_reclaim_small_nonempty_block,
GC_disclaim_and_reclaim_or_free_small_block): Likewise.
* thread_local_alloc.c (GC_mark_thread_local_fls_for): Likewise.
* typd_mlc.c (GC_typed_mark_proc,
GC_malloc_explicitly_typed_ignore_off_page): Likewise.
* win32_threads.c (GC_record_stack_base, GC_get_stack_min,
GC_push_stack_for): Likewise.
* blacklst.c (GC_copy_bl): Rename "new" argument to "dest".
* dbg_mlc.c (GC_store_debug_info_inner, GC_print_smashed_obj): Change
type of p argument from ptr_t to void*.
* include/private/gc_priv.h (GC_is_heap_base, GC_is_static_root):
Likewise.
* mark_rts.c [!THREADS] (GC_is_static_root): Likewise.
* os_dep.c (GC_is_malloc_heap_base, GC_is_heap_base): Likewise.
* ptr_chck.c (GC_on_stack): Likewise.
* dbg_mlc.c (GC_print_obj): Change type of kind_str local variable
from char* to const char*.
* dbg_mlc.c (GC_debug_strdup, GC_debug_strndup): Cast result of
GC_debug_malloc_atomic() to char*.
* mallocx.c (GC_strdup, GC_strndup): Likewise.
* dbg_mlc.c (GC_debug_wcsdup): Cast result of GC_debug_malloc_atomic()
to wchar_t*.
* mallocx.c (GC_wcsdup): Likewise.
* dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32]
(GC_register_dynamic_libraries): Cast p local variable to char*.
* os_dep.c (GC_register_data_segments): Likewise.
* fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_disclaim): Cast masked
fc_word to struct GC_finalizer_closure* (instead of void*).
* fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_malloc): Cast result of
GC_malloc_kind() to word*.
* typd_mlc.c (GC_malloc_explicitly_typed, GC_calloc_explicitly_typed):
Likewise.
* include/private/gc_priv.h (WARN): Cast away const qualifier for msg
(and the string literal).
* misc.c (GC_default_on_abort): Remove cast to void* for WRITE()
buf argument.
* misc.c (GC_new_free_list_inner): Cast result local variable to void**.
* misc.c (GC_new_free_list): Change type of result local variable from
void* to void**.
* pthread_support.c (GC_start_rtn_prepare_thread): Cast arg to
struct start_info*.
* win32_threads.c [GC_PTHREADS] (GC_pthread_start_inner): Likewise.
* reclaim.c (GC_print_free_list): Replace ptr_t flh to void *flh_next
local variable; remove redundant casts.
* tools/if_mach.c (EXECV_ARGV_T): New macro; add comment.
* tools/if_not_there.c (EXECV_ARGV_T): Likewise.
* tools/if_mach.c (main): Use EXECV_ARGV_T instead of void* for
execvp() argument.
* tools/if_not_there.c (main): Likewise.
* typd_mlc.c (LeafDescriptor, ComplexArrayDescriptor,
SequenceDescriptor): Move struct definition out of union
ComplexDescriptor.
* typd_mlc.c (GC_add_ext_descriptor): Rename "new" local variable to
newExtD.
* win32_threads.c (GC_CreateThread, GC_beginthreadex): Cast result
of GC_malloc_uncollectable() to thread_args*.
* win32_threads.c [PARALLEL_MARK && !MSWINCE && __cplusplus]
(GC_thr_init): Do not cast GetProcessAffinityMask() arguments to void*.
Ivan Maidanski [Wed, 14 Feb 2018 08:58:07 +0000 (11:58 +0300)]
Fix 'implicit conversion from size_t to int changes value' clang warning
(fix of commit
9468065 )
* misc.c (GC_get_size_map_at): Replace (size_t)(signed_word)-1 to
GC_SIZE_MAX.
* tests/test.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (check_heap_stats):
Replace (size_t)(GC_signed_word)-1 to -1.
Ivan Maidanski [Wed, 14 Feb 2018 08:48:57 +0000 (11:48 +0300)]
New API function (get_size_map_at) to get content of size_map table
* include/gc.h (GC_get_size_map_at): Declare public function.
* misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (GC_get_size_map_at):
Implement function
* tests/test.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (check_heap_stats):
Add dummy testing of GC_get_size_map_at.
Ivan Maidanski [Wed, 14 Feb 2018 08:26:45 +0000 (11:26 +0300)]
Convert cord source files to valid C++ code
Issue #206 (bdwgc).
* cord/cordbscs.c (Concatenation, Function, Generic): Define struct
outside union (i.e. the union just uses them).
* cord/cordbscs.c (CORD_cat_char_star, CORD_from_fn_inner,
CORD_substr_checked): Cast GC_MALLOC_ATOMIC() result to char*.
* cord/cordprnt.c (CORD_vsprintf): Likewise.
* cord/cordxtra.c (CORD_cat_char, CORD_to_char_star,
CORD_from_char_star, CORD_ec_flush_buf): Likewise.
* cord/cordbscs.c (CORD_substr_checked): Remove register keyword for
"result" local variable.
Jay Krell [Mon, 12 Feb 2018 21:34:21 +0000 (00:34 +0300)]
Change pointer arguments of push_all[_eager]/conditional API to void* type
Receiving void* instead of char* is easier to use, as it requires
no casting.
A small downside of this change is that anyone using decltype(GC_push)
in C++ function signatures would get a different name mangling.
* include/gc_mark.h (GC_push_all, GC_push_all_eager,
GC_push_conditional): Change type of bottom and top arguments from
char* to void*.
* mark.c (GC_push_all, GC_push_conditional, GC_push_all_eager):
Likewise.
* include/private/gc_priv.h (GC_PUSH_ALL_SYM): Cast away volatile
qualifier for &sym.
* mark.c (GC_push_all): Remove "register" keyword for length local
variable.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_selected): Remove unneeded
casts for GC_push_all arguments.
* mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager):
Change type of bottom and top arguments from ptr_t to void*.
* mark_rts.c [WRAP_MARK_SOME && PARALLEL_MARK]
(GC_push_conditional_eager): Likewise.
* mark_rts.c (GC_PUSH_CONDITIONAL): Remove unneeded casts for
GC_push_all and GC_push_conditional arguments.
Hans Boehm [Mon, 12 Feb 2018 08:24:54 +0000 (11:24 +0300)]
Avoid potential race between realloc and clear_hdr_marks/reclaim_generic
GC_realloc might be changing the block size while GC_reclaim_block
or GC_clear_hdr_marks is examining it. The change to the size field
is benign, in that GC_reclaim (and GC_clear_hdr_marks) would work
correctly with either value, since we are not changing the number
of objects in the block. But seeing a half-updated value (though
unlikely to occur in practice) could be probably bad.
Using unordered atomic accesses on the size and hb_descr fields would
solve the issue.
* mallocx.c [AO_HAVE_store] (GC_realloc): Use AO_store() to update
hhdr->hb_sz and hhdr->hb_descr; add static assert that size of
hhdr->hb_sz matches that of AO_t; add comment.
* mallocx.c [!AO_HAVE_store] (GC_realloc): Add LOCK/UNLOCK around
hb_sz and hb_descr fields assignment.
* mark.c [AO_HAVE_load] (GC_clear_hdr_marks): Use AO_load() to get
hhdr->hb_sz value; add comment.
* reclaim.c (IS_PTRFREE_SAFE): New macro (uses AO_load() if available).
* reclaim.c (GC_reclaim_generic, GC_reclaim_block): Replace
(hhdr)->hb_descr==0 with IS_PTRFREE_SAFE(hhdr).
Ivan Maidanski [Fri, 9 Feb 2018 15:40:20 +0000 (18:40 +0300)]
Revert 'Workaround TSan false positive about clear_hdr_marks/realloc race'
This reverts commit
20468dd131d82be7422aea3c7383ec9201452fce .
Because it is not a false positive. And we are lying to the compiler
about the value not changing asynchronously, which is never good.
The proper solution could be use of atomic accesses (even unordered)
on the size field.
Ivan Maidanski [Fri, 9 Feb 2018 08:27:36 +0000 (11:27 +0300)]
Travis CI: Test compiling GC/cord tests as C++ ones by Makefile.direct
Ivan Maidanski [Fri, 9 Feb 2018 08:17:29 +0000 (11:17 +0300)]
Fix build of cord tests as C++ files (Makefile.direct)
* Makefile.direct (cords): Do not depend on cord/cordtest.
* Makefile.direct (cord): Remove.
* Makefile.direct (cord/cordbscs.o, cord/cordxtra.o, cord/cordprnt.o):
Do not depend on cord target (folder); add "mkdir cord" (ignoring
errors) before moving .o file to "cord" folder.
Ivan Maidanski [Fri, 9 Feb 2018 08:07:03 +0000 (11:07 +0300)]
Fix 'anonymous type with no linkage used to declare variable' C++ error
(fix of commit
8086c72 )
Issue #201 (bdwgc).
* tests/test.c (A): Give some name to struct.
* tools/setjmp_t.c (a): Likewise.
Ivan Maidanski [Fri, 9 Feb 2018 07:55:32 +0000 (10:55 +0300)]
Replace GC_MALLOC(sizeof T) with GC_NEW(T) in tests
(code refactoring)
* tests/realloc_test.c (main): Replace (T*)GC_MALLOC(sizeof(T)) with
GC_NEW(T).
* tests/test.c (small_cons, mktree, run_one_test): Likewise.
Ivan Maidanski [Thu, 8 Feb 2018 08:56:44 +0000 (11:56 +0300)]
Convert remaining GC tests to valid C++ code
(fix of commit
8086c72 )
Issue #201 (bdwgc).
* tests/disclaim_bench.c (testobj_new): Replace GC_MALLOC(sizeof T)
with GC_NEW(T).
* tests/staticrootslib.c (libsrl_mktree): Likewise.
* tests/trace_test.c (mktree): Likewise.
* tests/disclaim_bench.c (testobj_new): Cast GC_finalized_malloc()
result to testobj_t.
* tests/disclaim_bench.c (main): Cast GC_MALLOC() result to testobj_t*.
* tests/disclaim_test.c (pair_dct): Cast obj to pair_t.
* tests/disclaim_test.c (pair_dct): Cast cd to pair_t.
* tests/disclaim_test.c (GC_finalized_malloc): Cast
GC_finalized_malloc() result to pair_t.
* tests/staticrootslib.c (root_nz): Cast element to struct treenode*.
* tests/staticrootstest.c (root_nz): Likewise.
* tests/staticrootslib.c (libsrl_mktree): Cast GC_MALLOC_ATOMIC()
result to struct treenode*.
* tests/trace_test.c (mktree): Likewise.
* tests/staticrootstest.c (init_staticroot): Cast libsrl_init() result
to char*.
* tests/thread_leak_test.c (main): Cast malloc() result to int*.
Ivan Maidanski [Thu, 8 Feb 2018 08:51:00 +0000 (11:51 +0300)]
Fix arg type of continue_reclaim prototype after the definition update
(fix of commit
e794f1e )
* include/private/gc_priv.h (GC_continue_reclaim): Change type of sz
argument from size_t to word (matching the function definition).
Ivan Maidanski [Thu, 8 Feb 2018 08:45:57 +0000 (11:45 +0300)]
Fix arguments delimiter in pcr_interface.c (PCR)
* extra/pcr_interface.c (GC_enumerate_block): Replace ';' with ',' in
the arguments list.
Ivan Maidanski [Thu, 8 Feb 2018 08:41:45 +0000 (11:41 +0300)]
Change type of hb_sz field (of hblkhdr) from size_t to word
This is needed to make the size of hb_sz to be the same as of AO_t.
* allchblk.c [USE_MUNMAP] (GC_unmap_old): Cast hhdr->hb_sz to size_t
when passed to GC_unmap().
* allchblk.c (GC_allochblk_nth): Cast hhdr->hb_sz to signed_word when
assigned to size_avail.
* allchblk.c [USE_MUNMAP] (GC_allochblk_nth): Cast hhdr->hb_sz to
size_t when passed to GC_remap().
* alloc.c (GC_set_fl_marks, GC_clear_fl_marks): Change type of sz and
bit_no local variables from size_t/unsigned to word.
* dbg_mlc.c (GC_check_heap_block): Likewise.
* backgraph.c [MAKE_BACK_GRAPH] (per_object_helper): Cast hhdr->hb_sz
to size_t; change type of i local variables from int to size_t.
* checksums.c [CHECKSUMS] (GC_on_free_list): Change type of sz local
variable from size_t to word.
* mark.c (GC_push_marked, GC_push_unconditionally, GC_block_was_dirty):
Likewise.
* reclaim.c (GC_reclaim_small_nonempty_block,
GC_disclaim_and_reclaim_or_free_small_block, GC_reclaim_block,
GC_n_set_marks): Likewise.
* checksums.c [CHECKSUMS] (GC_add_block): Remove bytes local variable
(to avoid casting of hhdr->hb_sz).
* dbg_mlc.c (GC_debug_free): Change type of i and obj_sz local
variables from size_t to word.
* dbg_mlc.c (GC_check_leaked): Likewise.
* extra/pcr_interface.c (GC_enumerate_block): Change type of sz local
variable from int to size_t.
* extra/pcr_interface.c (GC_enumerate_block): Cast hhdr->hb_sz to
size_t when assigned to sz.
* mallocx.c (GC_realloc): Likewise.
* mark.c (GC_set_hdr_marks): Likewise.
* reclaim.c (GC_do_enumerate_reachable_objects): Likewise.
* include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR):
Cast hhdr->hb_sz to size_t in assignment of obj_displ.
* include/private/gc_priv.h (struct hblkhdr): Change type of hb_sz from
size_t to word.
* include/private/gc_priv.h (MARK_BIT_NO): Cast offset argument to word
instead of unsigned.
* malloc.c (GC_free): Cast hhdr->hb_sz to size_t.
* mallocx.c (GC_get_kind_and_size): Likewise.
* mark.c (GC_clear_hdr_marks): Likewise.
* misc.c (GC_size): Likewise.
* misc.c (GC_do_blocking): Remove redundant cast of hhdr->hb_sz.
* reclaim.c (GC_reclaim_clear, GC_reclaim_uninit,
GC_disclaim_and_reclaim, GC_continue_reclaim): Change type of sz
argument from size_t to word.
* typd_mlc.c (GC_array_mark_proc): Change type of sz and nwords local
variables from size_t to word.
Ivan Maidanski [Thu, 8 Feb 2018 07:02:19 +0000 (10:02 +0300)]
Travis CI: Test compilation of C tests as C++ ones
Issue #201 (bdwgc).
Ivan Maidanski [Thu, 8 Feb 2018 06:57:23 +0000 (09:57 +0300)]
Convert cord tests to valid C++ code
Issue #201 (bdwgc).
* cord/tests/de.c (main): Cast buf to char* when passed to setvbuf().
* cord/tests/de_win.c (de_error): Change "char*" to "const char*" for
the argument (because ISO C++ forbids converting a string constant to
char*).
* cord/tests/de_win.h (de_error): Likewise.
* cord/tests/de_win.c (WinMain): Change type of hAccel local variable
from HANDLE to HACCEL; cast GetStockObject(WHITE_BRUSH) result to
HBRUSH type.
* cord/tests/de_win.c (plain_chars, control_chars): Cast
GC_MALLOC_ATOMIC() result to char*.
* cord/tests/de_win.c (WndProc): Change type of hInstance static
variable from HANDLE to HINSTANCE.
Jay Krell [Thu, 8 Feb 2018 06:26:03 +0000 (09:26 +0300)]
Compile some GC tests as C++ to test extern 'C' in header files
Issue #201 (bdwgc).
* tests/CMakeLists.txt (SET_SOURCE_FILES_PROPERTIES): Add to treat
leak_test.c and test.c as C++ files.
Ivan Maidanski [Thu, 8 Feb 2018 06:02:14 +0000 (09:02 +0300)]
Put GC internal function prototypes in tests into extern 'C' block
Issue #201 (bdwgc).
* tests/disclaim_test.c [__cplusplus] (GC_random): Wrap the function
declaration into extern "C".
* tests/test.c [__cplusplus] [GC_AMIGA_FASTALLOC && AMIGA]
(GC_amiga_free_all_mem): Likewise.
Ivan Maidanski [Wed, 7 Feb 2018 22:53:46 +0000 (01:53 +0300)]
Put variable/function declarations into extern 'C' in cord headers
Issue #201 (bdwgc).
* include/cord.h: Wrap variable and function declarations (but not
included headers).
* include/cord_pos.h: Likewise.
* include/ec.h: Likewise.
Ivan Maidanski [Wed, 7 Feb 2018 22:46:14 +0000 (01:46 +0300)]
Make uniform the comment for the end of extern 'C' block
(code refactoring)
* include/gc_backptr.h [__cplusplus]: Adjust (make uniform) comment
for the end of extern "C" block.
* include/gc_gcj.h [__cplusplus]: Likewise.
* include/gc_mark.h [__cplusplus]: Likewise.
* include/gc_typed.h [__cplusplus]: Likewise.
* include/javaxfc.h [__cplusplus]: Likewise.
Jay Krell [Wed, 7 Feb 2018 22:36:49 +0000 (01:36 +0300)]
Put variable/function declarations into extern 'C' in headers
Issue #201 (bdwgc).
Extern "C" should be only around declarations, not includes.
In particular, do not include 3rd-party headers (as well as our own
files as they could include others).
* include/gc.h [GC_PTHREADS]: Do not wrap include gc_pthread_redirects.h
into extern "C" block.
* include/gc_disclaim.h: Wrap variable and function declarations (but
not included headers).
* include/gc_inline.h: Likewise.
* include/gc_pthread_redirects.h [!GC_PTHREAD_REDIRECTS_ONLY]: Likewise.
* include/private/darwin_semaphore.h: Likewise.
* include/private/darwin_stop_world.h: Likewise.
* include/private/dbg_mlc.h: Likewise.
* include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC]: Likewise.
* include/private/gc_hdrs.h: Likewise.
* include/private/gc_locks.h [THREADS]: Likewise.
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* include/private/gcconfig.h: Likewise.
* include/private/pthread_stop_world.h: Likewise.
* include/private/pthread_support.h [GC_PTHREADS && !GC_WIN32_THREADS]:
Likewise.
* include/private/specific.h: Likewise.
* include/private/thread_local_alloc.h [THREAD_LOCAL_ALLOC]: Likewise.
Ivan Maidanski [Wed, 7 Feb 2018 08:52:11 +0000 (11:52 +0300)]
Collapse multiple BCOPY_EXISTS macro definitions
(code refactoring)
* include/private/gc_priv.h (BCOPY_EXISTS): Collapse multiple
definitions (and use "#elif").
Ivan Maidanski [Wed, 7 Feb 2018 08:25:09 +0000 (11:25 +0300)]
Add GC prefix to _MSVC_DBG_H macro
(code refactoring)
* include/private/msvc_dbg.h (_MSVC_DBG_H): Rename to GC_MSVC_DBG_H.
* include/private/msvc_dbg.h [__cplusplus]: Adjust indentation.
Jonathan Chambers [Tue, 6 Feb 2018 08:59:25 +0000 (11:59 +0300)]
Initial support of WinRT
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* include/private/gc_priv.h [MSWIN32] (GET_TIME): Use GetTickCount64
if MSWINRT_FLAVOR (instead of GetTickCount).
* include/private/gcconfig.h [_MSC_VER && _M_IX86>=300
|| _WIN32 && !__CYGWIN__ && !SYMBIAN && _M_ARM] (ARM32): Define macro.
* include/private/gcconfig.h [(_MSC_VER && _M_IX86>=300
|| _WIN32 && !__CYGWIN__ && !SYMBIAN) && !_XBOX_ONE
&& WINAPI_FAMILY==WINAPI_FAMILY_APP] (MSWINRT_FLAVOR): Likewise.
* include/private/gcconfig.h [MSWINRT_FLAVOR] (NO_GETENV): Likewise.
* include/private/gcconfig.h [X86_64 && MSWIN32] (DATAEND): Do not
define if already defined.
* misc.c [MSWIN32] (GC_win32_MessageBoxA): Do not define if
MSWINRT_FLAVOR.
* misc.c [MSWIN32] (GC_init): Call
InitializeCriticalSectionAndSpinCount() directly if MSWINRT_FLAVOR
(instead of using GetProcAddress).
* misc.c [MSWIN32 && MSWINRT_FLAVOR]: Include windows.storage.h.
* misc.c [MSWIN32 && MSWINRT_FLAVOR] (RoGetActivationFactory): Declare.
* misc.c [MSWIN32 && MSWINRT_FLAVOR] (getWinRTLogPath): New static
function.
* misc.c [MSWIN32 && MSWINRT_FLAVOR] (GC_CreateLogFile): Use
getWinRTLogPath().
* os_dep.c [GWW_VDB && MSWINRT_FLAVOR] (detect_GetWriteWatch): Use
memInfo.AllocationBase to get hK32.
* os_dep.c [USE_WINALLOC && !MSWIN_XBOX1] (GC_win32_get_mem,
GC_win32_free_heap): Do not use GlobalAlloc and GlobalFree if
MSWINRT_FLAVOR.
Jay Krell [Sun, 4 Feb 2018 08:35:26 +0000 (03:35 -0500)]
Convert tests to valid C++ code
Issue #201 (bdwgc).
* tests/leak_test.c (main): Add explicit casts of void* pointer
(returned by malloc) to the types of the variables the relevant
pointers are assigned to.
* tests/realloc_test.c (main): Likewise.
* tests/smash_test.c (main): Likewise.
* tests/test.c (run_one_test): Likewise.
* tests/test.c (typed_test): Rename "new" local variable to "newP".
Ivan Maidanski [Mon, 5 Feb 2018 07:14:09 +0000 (10:14 +0300)]
Update AUTHORS file (add Jay Krell)
Jay Krell [Mon, 5 Feb 2018 07:06:59 +0000 (10:06 +0300)]
Fix typo in comment in specific.h
* include/private/specific.h (tse): Fix a typo ("thread") in comment.
Ivan Maidanski [Fri, 2 Feb 2018 17:37:30 +0000 (20:37 +0300)]
Do not push 'cpsr' register on Darwin/arm
ARM cpsr stands for Control Program State Register.
It cannot contain a pointer.
* darwin_stop_world.c [ARM32] (GC_stack_range_for): Ignore cpsr
register; update comment.
Jonathan Chambers [Fri, 2 Feb 2018 17:29:20 +0000 (20:29 +0300)]
Do not push frame pointer on Darwin/arm and Darwin/arm64
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && ARM32]
(GC_stack_range_for): Pass r[7] (instead of sp register) to
GC_FindTopOfStack().
* darwin_stop_world.c [ARM32] (GC_stack_range_for): Do not push r[7]
register (as it holds frame pointer on iOS); add comment.
* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && AARCH64]
(GC_stack_range_for): Pass fp (instead of sp) register to
GC_FindTopOfStack().
* darwin_stop_world.c [AARCH64] (GC_stack_range_for): Do not push fp
register.
Jonathan Chambers [Fri, 2 Feb 2018 08:46:19 +0000 (11:46 +0300)]
Implement FindTopOfStack(0) for ARM and AArch64 (Darwin)
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && (ARM32 || AARCH64)]
(GC_FindTopOfStack): Set proper frame value (using asm instruction)
if stack_start is zero (instead of ABORT).
Ivan Maidanski [Fri, 2 Feb 2018 08:32:10 +0000 (11:32 +0300)]
Always fail if FindTopOfStack(0) is not implemented but called (Darwin)
* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK] (GC_FindTopOfStack):
Initialize frame local variable first (to stack_start).
* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && !POWERPC]
(GC_FindTopOfStack): Call ABORT with the appropriate message (instead
of GC_ASSERT) if stack_start iz zero.
Ivan Maidanski [Fri, 2 Feb 2018 08:07:52 +0000 (11:07 +0300)]
Define macro to specify the environment file name extension (Win32/WinCE)
(code refactoring)
* misc.c [GC_READ_ENV_FILE] (GC_ENV_FILE_EXT): New macro.
* misc.c [GC_READ_ENV_FILE && (MSWIN32 || MSWINCE || CYGWIN32)]
(GC_envfile_init): Use GC_ENV_FILE_EXT instead of ".gc.env".
Ivan Maidanski [Thu, 1 Feb 2018 22:21:57 +0000 (01:21 +0300)]
Define ABORT() using _CrtDbgBreak (if available) on Windows host
Issue #173 (bdwgc).
* include/private/gc_priv.h [!CPPCHECK && !PCR && !NO_DEBUGGING
&& (MSWIN32 || MSWINCE)] (ABORT): Use _CrtDbgBreak() instead of
DebugBreak() if _CrtDbgBreak, _DEBUG and _MSC_VER macros are defined.
Jonathan Chambers [Thu, 1 Feb 2018 21:35:49 +0000 (00:35 +0300)]
Fix 'undefined reference to __builtin_unwind_init' linker error (ArmCC)
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Do not define
if __ARMCC_VERSION.
Jonathan Chambers [Thu, 1 Feb 2018 08:53:34 +0000 (11:53 +0300)]
Avoid SIGSEGV during GC_INIT on some Android devices
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* include/gc.h [(HOST_ANDROID || __ANDROID__) && !GC_NOT_DLL]
(GC_INIT_CONF_ROOTS): Define to empty unless IGNORE_DYNAMIC_LOADING;
add comment.
Jonathan Chambers [Thu, 1 Feb 2018 08:17:24 +0000 (11:17 +0300)]
Initial support of Sony PlayStation Portable 2
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* alloc.c [!MACOS && !MSWINCE && !SN_TARGET_ORBIS && !__CC_ARM]:
Do not include sys/types.h if SN_TARGET_PSP2.
* dyn_load.c [!MACOS && !_WIN32_WCE && !SN_TARGET_ORBIS && !__CC_ARM]:
Likewise.
* os_dep.c [!OS2 && !PCR && !AMIGA && !MACOS && !MSWINCE
&& !SN_TARGET_ORBIS && !__CC_ARM]: Likewise.
* include/gc_config_macros.h [SN_TARGET_PSP2] (GC_THREADS): Define
macro.
* include/private/gcconfig.h [SN_TARGET_PSP2] (mach_type_known):
Likewise.
* include/private/gcconfig.h [ARM32 && SN_TARGET_PSP2] (NO_HANDLE_FORK,
DATASTART, DATAEND, STACKBOTTOM): Likewise.
* include/private/gcconfig.h [SN_TARGET_PSP2] (THREADS, GET_MEM):
Likewise.
* include/private/gc_locks.h [GC_PTHREADS && !GC_WIN32_THREADS
&& !SN_TARGET_ORBIS]: Do not include gc_atomic_ops.h if SN_TARGET_PSP2.
* include/private/gc_locks.h [SN_TARGET_PSP2]: Include psp2-support.h.
* include/private/gc_locks.h [SN_TARGET_PSP2] (GC_allocate_ml_PSP2):
Declare GC_EXTERN variable.
* include/private/gc_locks.h [SN_TARGET_PSP2] (UNCOND_LOCK,
UNCOND_UNLOCK): Define (using GC_allocate_ml_PSP2 instead of
GC_allocate_ml).
* include/private/gc_priv.h [!HBLKSIZE && (LARGE_CONFIG
|| !SMALL_CONFIG) && SN_TARGET_PSP2] (CPP_LOG_HBLKSIZE): Define to 16
(instead of 12).
* include/private/gcconfig.h [ARM32] (NOSYS): Do not define if
SN_TARGET_PSP2.
* os_dep.c (SBRK_ARG_T, OPT_MAP_ANON, GC_unix_mmap_get_mem,
GC_unix_sbrk_get_mem, GC_unix_get_mem): Likewise.
* pthread_support.c (GC_pthread_join, GC_pthread_detach,
GC_pthread_create): Likewise.
* include/private/gcconfig.h [ARM32 && SN_TARGET_PSP2]
(psp2_get_stack_bottom): Declare external function.
* include/private/gcconfig.h [SN_TARGET_PSP2] (psp2_get_mem): Likewise.
* include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD
&& SN_TARGET_PSP2] (MUNMAP_THRESHOLD): Define to 2.
* mach_dep.c: Skip everything in this file if SN_TARGET_PSP2.
* pthread_stop_world.c: Likewise.
* misc.c [SN_TARGET_PSP2] (GC_allocate_ml_PSP2): Define global varible
(instead of GC_allocate_ml).
* misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG
&& !NN_PLATFORM_CTR && !NINTENDO_SWITCH && !AMIGA && !SN_TARGET_ORBIS
&& !__CC_ARM]: Do not include unistd.h if SN_TARGET_PSP2.
* misc.c [SN_TARGET_PSP2] (GC_write): Define to no-op.
* pthread_support.c: Do not include sys/mman.h if SN_TARGET_PSP2.
Ivan Maidanski [Wed, 31 Jan 2018 21:39:25 +0000 (00:39 +0300)]
Remove ARM32 macro duplicate definition for Nintendo in gcconfig.h
(fix of commit
9718229 )
Issue #173 (bdwgc).
* include/private/gcconfig.h [NN_PLATFORM_CTR] (ARM32): Remove macro
duplicate definition.
Jonathan Chambers [Wed, 31 Jan 2018 08:45:26 +0000 (11:45 +0300)]
New macro ALWAYS_SMALL_CLEAR_STACK to avoid clearing large stack sections
(a cherry-pick of commit
95f5767 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
Avoid clearing large sections of the stack. It was clearing
up to 16k which may not be available in cases of small stacks or stack
overflow situations (for some targets).
* misc.c [ALWAYS_SMALL_CLEAR_STACK] (GC_clear_stack): Do only BZERO for
dummy where dummy is a local array of length SMALL_CLEAR_SIZE.
Ivan Maidanski [Wed, 31 Jan 2018 08:11:31 +0000 (11:11 +0300)]
Do not define clear_stack_inner and next_random_no if not used
(code refactoring of commits
4eaea0afa ,
b850e1c9b )
* misc.c (SMALL_CLEAR_SIZE): Do not define if already defined; define
even if THREADS is not defined.
* misc.c [STACK_NOT_SCANNED] (GC_clear_stack): Standalone definition
(just return arg).
* misc.c (BIG_CLEAR_SIZE, GC_stack_last_cleared, GC_min_sp,
GC_high_water, GC_bytes_allocd_at_reset, DEGRADE_RATE,
GC_clear_stack_inner, next_random_no): Do not define if
STACK_NOT_SCANNED.
* misc.c [!STACK_NOT_SCANNED] (CLEAR_SIZE): Do not define if
ASM_CLEAR_CODE.
* misc.c (GC_stack_last_cleared, GC_min_sp, GC_high_water,
GC_bytes_allocd_at_reset, GC_clear_stack_inner, next_random_no,
GC_clear_stack): Adjust indentation.
Ivan Maidanski [Tue, 30 Jan 2018 08:11:45 +0000 (11:11 +0300)]
Workaround 'address of auto-variable returned' cppcheck error
* mark_rts.c [CPPCHECK] (GC_approx_sp): Use __builtin_frame_address.
* mark_rts.c (GC_approx_sp): Replace GC_GNUC_PREREQ(4,0) with
__GNUC__>=4; add TODO item.
Jonathan Chambers [Tue, 30 Jan 2018 07:32:38 +0000 (10:32 +0300)]
Initial support of Xbox One (DURANGO) target
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* include/private/gc_priv.h [THREADS && MSWIN_XBOX1] (GC_write_cs):
Declare.
* include/private/gcconfig.h [(_MSC_VER && _M_IX86 >= 300 || _WIN32)
&& _XBOX_ONE] (MSWIN_XBOX1): Define (instead of MSWIN32).
* include/private/gcconfig.h [X86_64 && MSWIN_XBOX1] (NO_GETENV,
DATASTART, DATAEND, STACKBOTTOM, GETPAGESIZE, USE_MMAP, PROT_NONE,
PROT_READ, PROT_WRITE, PROT_EXEC, MAP_PRIVATE, MAP_FIXED, MAP_FAILED):
Define.
* include/private/gcconfig.h [X86_64 && MSWIN_XBOX1]
(durango_get_stack_bottom): Declare external function.
* include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD
&& MSWIN_XBOX1] (MUNMAP_THRESHOLD): Define to 2; update comment.
* include/private/gcconfig.h [GC_WIN32_THREADS && !CYGWIN32
&& !MSWIN32 && !MSWINCE]: Do not issue #error if MSWIN_XBOX1.
* include/private/gcconfig.h [MSWIN_XBOX1] (durango_get_mem): Declare
function.
* include/private/gcconfig.h [MSWIN_XBOX1] (GET_MEM): Define.
* mark_rts.c [DYNAMIC_LOADING] (GC_cond_register_dynamic_libraries):
Do not call GC_remove_tmp_roots and GC_register_dynamic_libraries
if MSWIN_XBOX1 (set GC_no_dls to true instead).
* misc.c [MSWIN_XBOX1 && THREADS] (GC_write_cs): Define variable.
* misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG
&& !NN_PLATFORM_CTR && !NINTENDO_SWITCH && !AMIGA && !SN_TARGET_ORBIS
&& !__CC_ARM]: Do not include unistd.h if MSWIN_XBOX1.
* os_dep.c [!OS2 && !PCR && !AMIGA && !MACOS && !MSWINCE
&& !SN_TARGET_ORBIS && !__CC_ARM && !MSWIN32]: Likewise.
* os_dep.c [MMAP_SUPPORTED && MSWIN_XBOX1] (durango_get_mem): Define
new internal function.
* os_dep.c [!MSWINCE && USE_WINALLOC] (GLOBAL_ALLOC_TEST,
GC_mem_top_down, GC_win32_get_mem, GC_win32_free_heap): Do not define
if MSWIN_XBOX1.
* win32_threads.c [!CYGWIN32 && !MSWINCE] (GC_beginthreadex): Likewise.
* os_dep.c [USE_MUNMAP && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE]:
Do not include unistd.h, sys/mman.h, sys/stat.h, sys/types.h if
MSWIN_XBOX1.
* win32_threads.c [GC_ASSERTIONS] (GC_write_disabled): Define only if
MSWIN32 or MSWINCE.
* win32_threads.c [GC_ASSERTIONS] (GC_stop_world): Do not use
GC_write_disabled if MSWIN_XBOX1.
* win32_threads.c [PARALLEL_MARK && !GC_PTHREADS_PARAMARK
&& MSWIN_XBOX1] (GC_start_mark_threads_inner): Use CreateThread()
instead of _beginthreadex().
Jonathan Chambers [Sun, 28 Jan 2018 07:13:10 +0000 (10:13 +0300)]
Initial support of Orbis target
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* alloc.c [!MACOS && !MSWINCE && !__CC_ARM]: Do not include
sys/types.h if SN_TARGET_ORBIS.
* dyn_load.c [!MACOS && !_WIN32_WCE && !__CC_ARM]: Likewise.
* include/gc_config_macros.h [SN_TARGET_ORBIS] (GC_THREADS): Define.
* include/gc_config_macros.h [__FreeBSD__] (GC_FREEBSD_THREADS): Do
not define if SN_TARGET_ORBIS.
* include/private/gcconfig.h [__FreeBSD__ || __DragonFly__
|| __FreeBSD_kernel__] (FREEBSD): Likewise.
* include/private/gcconfig.h [!LINUX && !NETBSD && !FREEBSD
&& !OPENBSD && !DARWIN && !_WIN32 && !__CEGCC__ && !NN_PLATFORM_CTR
!NN_BUILD_TARGET_PLATFORM_NX && !SYMBIAN] (NOSYS): Likewise.
* include/private/gc_locks.h [THREADS && GC_PTHREADS
&& !GC_WIN32_THREADS]: Do not include gc_atomic_ops.h if
SN_TARGET_ORBIS.
* include/private/gc_locks.h [SN_TARGET_ORBIS && GC_PTHREADS]
(USE_PTHREAD_LOCKS): Define.
* include/private/gc_priv.h [SN_TARGET_ORBIS] (CPP_LOG_HBLKSIZE):
Define to 16 (instead of 12).
* include/private/gcconfig.h [SN_TARGET_ORBIS && (__amd64__
|| __x86_64__)] (X86_64): Define.
* include/private/gcconfig.h [X86_64] (CACHE_LINE_SIZE): Do not define
if already defined.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS] (DATASTART,
DATAEND, STACKBOTTOM): Define.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS]: Include
pthread.h.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS]
(ps4_get_stack_bottom): Declare.
* include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD
&& SN_TARGET_ORBIS] (MUNMAP_THRESHOLD): Define to 2.
* include/private/gcconfig.h [SN_TARGET_ORBIS] (THREADS): Define.
* pthread_support.c: Do not include sys/mman.h, sys/time.h,
sys/types.h, fcntl.h if SN_TARGET_ORBIS.
* pthread_support.c (GC_pthread_join, GC_pthread_detach,
GC_pthread_create): Do not define if SN_TARGET_ORBIS.
Ivan Maidanski [Sat, 27 Jan 2018 07:38:44 +0000 (10:38 +0300)]
Remove duplicate definition of ALIGNMENT macro for OpenBSD/arm
(code refactoring)
* include/private/gcconfig.h [ARM32 && OPENBSD] (ALIGNMENT): Remove
(as it is already defined for ARM32).
Jonathan Chambers [Sat, 27 Jan 2018 07:24:12 +0000 (10:24 +0300)]
Initial support of Nintendo platform
(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* include/gc_config_macros.h [(!GC_WIN32_THREADS || GC_WIN32_PTHREADS
|| __CYGWIN32__ || __CYGWIN__) && GC_THREADS] (GC_PTHREADS): Do not
define if NN_PLATFORM_CTR or NN_BUILD_TARGET_PLATFORM_NX.
* include/private/gc_priv.h [NN_PLATFORM_CTR] (CLOCK_TYPE, GET_TIME,
MS_TIME_DIFF): Define macro.
* include/private/gc_priv.h [!PCR && (NN_PLATFORM_CTR
|| NINTENDO_SWITCH)] (STOP_WORLD, START_WORLD): Likewise.
* include/private/gcconfig.h [NN_PLATFORM_CTR] (ARM32,
mach_type_known): Likewise.
* include/private/gcconfig.h [NN_BUILD_TARGET_PLATFORM_NX]
(NINTENDO_SWITCH, mach_type_known): Likewise.
* include/private/gcconfig.h [NN_PLATFORM_CTR] (DATASTART, DATAEND,
STACKBOTTOM): Likewise.
* include/private/gcconfig.h [NINTENDO_SWITCH] (NO_HANDLE_FORK,
DATASTART, DATAEND, STACKBOTTOM): Likewise.
* include/private/gcconfig.h [NN_PLATFORM_CTR || NINTENDO_SWITCH]
(THREADS): Likewise.
* include/private/gcconfig.h [NINTENDO_SWITCH] (GET_MEM):
Likewise.
* misc.c [NN_PLATFORM_CTR || NINTENDO_SWITCH] (WRITE): Likewise.
* include/private/gc_priv.h [NN_PLATFORM_CTR] (n3ds_get_system_tick
n3ds_convert_tick_to_ms): Declare external function.
* include/private/gc_priv.h [!PCR && (NN_PLATFORM_CTR
|| NINTENDO_SWITCH)] (GC_stop_world, GC_start_world): Declare.
* include/private/gcconfig.h [NN_PLATFORM_CTR] (Image$$ZI$$ZI$$Base,
Image$$ZI$$ZI$$Limit, n3ds_get_stack_bottom): Likewise.
* include/private/gcconfig.h [NINTENDO_SWITCH] (__bss_end,
switch_get_stack_bottom): Likewise.
* include/private/gcconfig.h [NINTENDO_SWITCH] (switch_get_mem):
Likewise.
* misc.c [NN_PLATFORM_CTR] (n3ds_log_write): Likewise.
* misc.c [NINTENDO_SWITCH] (switch_log_write): Likewise.
* include/private/gcconfig.h [__aarch64__ && !LINUX && !DARWIN
&& !FREEBSD] (NOSYS): Do not define if NN_BUILD_TARGET_PLATFORM_NX.
* include/private/gcconfig.h [(__arm || __arm__ || __thumb__)
&& !NACL && !LINUX && !NETBSD && !FREEBSD && !OPENBSD && !DARWIN
&& !_WIN32 && !__CEGCC__ && !SYMBIAN] (NOSYS): Do not define
if NN_PLATFORM_CTR or NN_BUILD_TARGET_PLATFORM_NX.
* misc.c [!OS2 && !MACOS && !GC_ANDROID_LOG && !MSWIN32 && !MSWINCE]
(GC_stdout, GC_stderr, GC_log, GC_set_log_fd): Do not define if
NN_PLATFORM_CTR or NINTENDO_SWITCH.
* misc.c [NN_PLATFORM_CTR] (GC_init): Call GC_get_main_stack_base()
to set GC_stackbottom.
* os_dep.c (SBRK_ARG_T, OPT_MAP_ANON, GC_unix_mmap_get_mem,
GC_unix_sbrk_get_mem, GC_unix_get_mem): Do not define if
NINTENDO_SWITCH.
* os_dep.c [USE_MUNMAP]: Do not include unistd.h, sys/mman.h,
sys/stat.h, sys/types.h if NN_PLATFORM_CTR.
* os_dep.c [NN_PLATFORM_CTR || NINTENDO_SWITCH]
(GC_default_push_other_roots): Redirect to GC_push_all_stacks.
Ivan Maidanski [Fri, 26 Jan 2018 13:36:06 +0000 (16:36 +0300)]
Update ChangeLog file
Ivan Maidanski [Fri, 26 Jan 2018 11:30:43 +0000 (14:30 +0300)]
Update ChangeLog file (v7.6 changes only)
(a cherry-pick of commit
62d9d038 from 'release-7_6')
Peter Wang [Thu, 25 Jan 2018 22:35:20 +0000 (01:35 +0300)]
Define HEURISTIC2 when STACKBOTTOM is not defined for OpenBSD
(fix of commit
ef879a9 )
Issue #198 (bdwgc).
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS && !USRSTACK] (HEURISTIC2): Define.
* include/private/gcconfig.h [SH && !SH4 && OPENBSD]: Reformat code.
Ivan Maidanski [Wed, 24 Jan 2018 16:19:30 +0000 (19:19 +0300)]
Run command passed to if_not_there directly from Makefile.direct
Issue #199 (bdwgc).
if_not_there tool is modified to accept a single argument (file name).
* Makefile.direct (base_lib, cords, test_cpp, c++, mach_dep.o, mark_rts.o,
cord/cordtest, cord/de, gctest): Replace "if_not_there <file> <command>"
with "if_not_there <file> || <command>".
* Makefile.direct (c++): Add dependency on $(UTILS).
* Makefile.direct (gctest): Remove double spaces.
* tools/if_not_there.c: Update header comment.
* tools/if_not_there.c (main): Allow both 2 and 3 command-line arguments;
return 2 if the file does not exist and argc is 2; update the printed
usage message.
Peter Wang [Wed, 24 Jan 2018 14:37:23 +0000 (17:37 +0300)]
Fix 'undeclared identifier USRSTACK' compiler error on OpenBSD-6.2
Issue #198 (bdwgc).
USRSTACK macro is defined in <machine/vmparam.h> but that is protected
by "ifdef _KERNEL" in <uvm/uvm_param.h>.
* include/private/gcconfig.h [POWERPC && OPENBSD && !GC_OPENBSD_THREADS]
(STACKBOTTOM): Add comment.
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS] (STACKBOTTOM): Define only if USRSTACK is
defined.
* include/private/gcconfig.h [MIPS && OPENBSD]: Reformat code.
Ivan Maidanski [Wed, 24 Jan 2018 14:10:55 +0000 (17:10 +0300)]
Update ChangeLog file
Ivan Maidanski [Tue, 23 Jan 2018 15:01:37 +0000 (18:01 +0300)]
Update AUTHORS file
Calvin Buckley [Tue, 23 Jan 2018 14:54:59 +0000 (17:54 +0300)]
Initial support of Haiku/amd64
(port of commit
e52f300 from 'mono_libgc')
* configure.ac [THREADS=posix && host=*-*-haiku*] (GC_THREADS,
_REENTRANT, PARALLEL_MARK, THREAD_LOCAL_ALLOC): Define macro.
* include/gc_config_macros.h [GC_THREADS && __HAIKU__]
(GC_HAIKU_THREADS): Likewise.
* include/private/gcconfig.h [__HAIKU__ && _X86_] (I386, HAIKU,
mach_type_known): Likewise.
* include/private/gcconfig.h [__HAIKU__ && __amd64__] (X86_64, HAIKU,
mach_type_known): Likewise.
* include/private/gcconfig.h [I386 && HAIKU] (DYNAMIC_LOADING,
MPROTECT_VDB): Likewise.
* include/private/gcconfig.h [X86_64 && HAIKU] (OS_TYPE, GETPAGESIZE,
DATASTART, DYNAMIC_LOADING, MPROTECT_VDB): Likewise.
* include/private/gcconfig.h [HAIKU] (UNIX_LIKE, GET_MEM): Likewise.
* os_dep.c [MPROTECT_VDB && !DARWIN && !MSWIN32 && !MSWINCE
&& HAIKU] (CODE_OK): Likewise.
* dyn_load.c [HAIKU] (GC_register_dynamic_libraries): Implement.
* os_dep.c [HAIKU] (GC_haiku_get_mem): Likewise.
* include/private/gcconfig.h (BEOS): Rename to HAIKU.
* os_dep.c (BEOS): Likewise.
* include/private/gcconfig.h [I386 && HAIKU] (OS_TYPE): Change value
to "HAIKU".
* include/private/gcconfig.h [X86_64 && HAIKU]: Include OS.h; declare
etext symbol.
* include/private/gcconfig.h [HAIKU] (GC_haiku_get_mem): Declare
prototype.
* os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE) && HAIKU] (old_segv_act):
Define static variable.
* os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE) && HAIKU]
(GC_set_and_save_fault_handler): Use old_segv_act; call
sigaction(SIGSEGV).
* os_dep.c [NEED_FIND_LIMIT || (USE_PROC_FOR_LIBRARIES && THREADS)]
(GC_reset_fault_handler): Likewise.
* os_dep.c [MPROTECT_VDB && !DARWIN && !USE_WINALLOC && HAIKU]: Do not
include sys/syscall.h.
* pthread_support.c [GC_HAIKU_THREADS] (GC_get_nprocs): Define function.
Zoltan Varga [Tue, 23 Jan 2018 02:38:02 +0000 (05:38 +0300)]
Use HOST_ANDROID define instead of PLATFORM_ANDROID
(a cherry-pick of commit
5d819c8 from 'mono_libgc')
* doc/README.macros (PLATFORM_ANDROID): Rename to HOST_ANDROID.
* dyn_load.c: Rename PLATFORM_ANDROID to HOST_ANDROID.
* include/gc.h: Likewise.
* include/gc_config_macros.h: Likewise.
* include/private/gcconfig.h: Likewise.
* include/private/thread_local_alloc.h: Likewise.
* os_dep.c: Likewise.
* pthread_support.c: Likewise.
* tests/initsecondarythread.c: Likewise.
* tests/test.c: Likewise.
* tools/threadlibs.c: Likewise.
Ivan Maidanski [Tue, 23 Jan 2018 02:22:22 +0000 (05:22 +0300)]
Rename PLATFORM_TIZEN macro to HOST_TIZEN
(code refactoring of commit
a3a5949 )
* include/private/gcconfig.h (PLATFORM_TIZEN): Rename to HOST_TIZEN.
Ivan Maidanski [Wed, 24 Jan 2018 13:29:26 +0000 (16:29 +0300)]
Update ChangeLog file (v7.6 changes only)
(a cherry-pick of commit
82a81eed from 'release-7_6')