Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/bdwgc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-02-16Convert GC source files to valid C++ codeIvan Maidanski
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*.
2018-02-12Avoid potential race between realloc and clear_hdr_marks/reclaim_genericHans Boehm
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).
2018-02-08Change type of hb_sz field (of hblkhdr) from size_t to wordIvan Maidanski
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.
2017-10-25Do not use system clock consistently if NO_CLOCKIvan Maidanski
Issue #139 (bdwgc). * alloc.c (GC_try_to_collect_inner, world_stopped_total_time, world_stopped_total_divisor, MAX_TOTAL_TIME_DIVISOR, GC_stopped_mark): Replace "ifndef SMALL_CONFIG" with "ifndef NO_CLOCK". * reclaim.c (GC_reclaim_all): Likewise. * alloc.c (GC_finish_collection): Replace "ifndef SMALL_CONFIG" with "ifndef NO_CLOCK" except for GC_print_finalization_stats invocation. * doc/README.macros (NO_CLOCK): Document. * include/private/gc_priv.h (CLOCK_TYPE, GET_TIME, MS_TIME_DIFF): Do not define if NO_CLOCK. * include/private/gc_priv.h (GC_print_stats): Define as a macro (to 0) only if both NO_CLOCK and SMALL_CONFIG are defined. * misc.c (GC_print_stats): Do not define if both NO_CLOCK and SMALL_CONFIG are defined. * misc.c (GC_init): Do not set GC_print_stats only if both NO_CLOCK and SMALL_CONFIG are defined. * tests/test.c (run_one_test): Do not define start_time, reverse_time, time_diff local variables (and do not use GET_TIME, MS_TIME_DIFF) if NO_CLOCK is defined.
2017-08-22Eliminate unsigned fl_builder_count underflow in mark_threadIvan Maidanski
(refactor commit 0ca6d3f) * include/private/gc_priv.h [PARALLEL_MARK] (GC_fl_builder_count): Change type from word to signed_word. * reclaim.c [PARALLEL_MARK] (GC_fl_builder_count): Likewise. * mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Change type of count local variable to signed_word; add assertion that count is non-negative. * pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Add comment that GC_fl_builder_count can be negative here. * win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise. * reclaim.c [PARALLEL_MARK] (GC_fl_builder_count): Refine comment.
2017-08-09Do not call BCOPY and BZERO if size is zeroIvan Maidanski
* dbg_mlc.c (GC_debug_strndup): Do not call BCOPY() if elements count is zero. * dbg_mlc.c (GC_debug_realloc): Likewise. * finalize.c [!GC_TOGGLE_REFS_NOT_NEEDED] (ensure_toggleref_capacity): Likewise. * malloc.c [REDIRECT_MALLOC && !strndup] (strndup): Likewise. * mallocx.c (GC_strndup): Likewise. * misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (GC_get_prof_stats): Likewise. * os_dep.c [SAVE_CALL_CHAIN && GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers): Likewise. * reclaim.c (GC_print_all_errors): Likewise. * malloc.c (GC_free): Do not call BZERO() if elements count is zero. * malloc.c [THREADS] (GC_free_inner): Likewise. * reclaim.c (GC_print_all_errors): Likewise. * misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED && THREADS] (GC_get_prof_stats_unsafe): Do not call fill_prof_stats() and BCOPY() if stats_sz is zero.
2017-07-21Eliminate CSA warning about incorrect cast applied to HBLK_OBJSIvan Maidanski
HBLK_OBJS() expects the argument value and has the result value of size_t type. * reclaim.c (GC_print_block_descr): Cast result of HBLK_OBJS() to unsigned int instead of casting its argument.
2017-06-20Fix null dereference in reclaim_block if DONT_ADD_BYTE_AT_ENDHamayama
Issue #167 (bdwgc). * reclaim.c (GC_reclaim_block): If ok->ok_reclaim_list is null then do not update hhdr->hb_next (and *rlh).
2017-04-22Eliminate 'possible loss of data' MS VC warning in disclaim_and_reclaimIvan Maidanski
* reclaim.c [ENABLE_DISCLAIM] (GC_disclaim_and_reclaim): Change type of bit_no local variable from int to word (matching that in other GC_reclaim_* functions).
2016-10-31Export GC_print_free_list()Ivan Maidanski
Note: this function is not used by GC itself. * include/gc_inline.h (GC_print_free_list): New public API prototype. * reclaim.c [!NO_DEBUGGING]: Include gc_inline.h (to check that GC_print_free_list prototype matches the definition). * reclaim.c [!NO_DEBUGGING] (GC_print_free_list): Define as public (GC_API+GC_CALL); remove "ok" local variable; add assertions about kind and sz_in_granules maximum values.
2016-10-21Eliminate 'printf format specifies type void*' GCC pedantic warningsIvan Maidanski
Explicitly cast pointer arguments (passed to printf and ABORT_ARGn) to void* to match %p format specifier. * allchblk.c [!NO_DEBUGGING] (GC_dump_regions): Cast arguments to void* those printf format specifier is %p. * alloc.c [!NO_DEBUGGING] (GC_print_heap_sects): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (backwards_height): Likewise. * blacklst.c (GC_default_print_heap_obj_proc): Likewise. * blacklst.c [PRINT_BLACK_LIST] (GC_print_blacklisted_ptr): Likewise. * cord/cordbscs.c (CORD_dump_inner): Likewise. * darwin_stop_world.c [DEBUG_THREADS_EXTRA] (GC_FindTopOfStack): Likewise. * darwin_stop_world.c [DEBUG_THREADS] (GC_stack_range_for): Likewise. * dbg_mlc.c (GC_print_obj): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_print_smashed_obj): Likewise. * dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_register_dynamic_libraries_dl_iterate_phdr): Likewise. * dyn_load.c [IRIX5] (GC_register_dynamic_libraries): Likewise. * finalize.c [!NO_DEBUGGING] (GC_dump_finalization_links, GC_dump_finalization): Likewise. * include/private/gc_pmark.h [MARK_BIT_PER_GRANULE || MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Likewise. * mark.c [ENABLE_TRACE] (GC_mark_from): Likewise. * mark_rts.c [!NO_DEBUGGING] (GC_print_static_roots): Likewise. * mark_rts.c [DEBUG_ADD_DEL_ROOTS] (GC_add_roots_inner, GC_remove_root_at_pos): Likewise. * misc.c [ENABLE_TRACE] (GC_init): Likewise. * os_dep.c [LINUX || HURD] (GC_init_linux_data_start): Likewise. * os_dep.c [!OS2 && !MSWIN32] (GC_register_data_segments): Likewise. * os_dep.c [USE_MUNMAP && !USE_WINALLOC && !NACL] (GC_remap): Likewise. * os_dep.c [!DARWIN && !MSWIN32 && !MSWINCE] (GC_write_fault_handler): Likewise. * os_dep.c [PROC_VDB && DEBUG_DIRTY_BITS] (GC_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (catch_exception_raise): Likewise. * pthread_stop_world.c [DEBUG_THREADS] (GC_push_all_stacks): Likewise. * pthread_support.c [DEBUG_THREADS] (GC_unregister_my_thread_inner, GC_unregister_my_thread, GC_start_rtn_prepare_thread): Likewise. * reclaim.c [!NO_DEBUGGING] (GC_print_free_list): Likewise. * specific.c [USE_CUSTOM_SPECIFIC && GC_ASSERTIONS] (GC_check_tsd_marks): Likewise. * win32_threads.c [DEBUG_THREADS] (GC_push_stack_for): Likewise. * win32_threads.c [GC_PTHREADS && DEBUG_THREADS] (GC_pthread_join, GC_pthread_create, GC_pthread_start_inner, GC_thread_exit_proc): Likewise. * dbg_mlc.c: Remove duplicate check of SHORT_DBG_HDRS. * include/private/gc_pmark.h [MARK_BIT_PER_GRANULE || MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Add missing parentheses around "source" argument when casting it to ptr_t.
2016-10-17Workaround more 'void pointers in calculations' cppcheck warningsIvan Maidanski
* include/new_gc_alloc.h (single_client_gc_alloc_template::allocate, single_client_gc_alloc_template::ptr_free_allocate, single_client_gc_alloc_template::deallocate, single_client_gc_alloc_template::ptr_free_deallocate, single_client_traceable_alloc_template::allocate, single_client_traceable_alloc_template::ptr_free_allocate, single_client_traceable_alloc_template::deallocate, single_client_traceable_alloc_template::ptr_free_deallocate): Replace GC_Xobjfreelist_ptr+nwords with &GC_Xobjfreelist_ptr[nwords]. * reclaim.c (GC_start_reclaim): Replace fop++ with (*(word**)&fop)++. * thread_local_alloc.c (return_freelists): Replace gfl+i with &gfl[i].
2016-10-14Eliminate more 'scope of variable can be reduced' cppcheck style warningsIvan Maidanski
* allchblk.c [MARK_BIT_PER_GRANULE] (setup_header): Move local variable declarations to the inner scope where the variables are actually used. * alloc.c [!SMALL_CONFIG] (GC_try_to_collect_inner, GC_finish_collection): Likewise. * alloc.c (GC_stopped_mark): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (add_edge): Likewise. * darwin_stop_world.c [GC_DARWIN_THREADS] (GC_push_all_stacks, GC_stop_world, GC_thread_resume): Likewise. * dyn_load.c [USE_PROC_FOR_LIBRARIES] (sort_heap_sects): Likewise. * dyn_load.c [ALPHA && OSF1 || HPUX] (GC_register_dynamic_libraries): Likewise. * dyn_load.c [DARWIN] (GC_dyld_image_add, GC_dyld_image_remove): Likewise. * extra/AmigaOS.c (GC_amiga_free_all_mem, GC_amiga_allocwrapper_any): Likewise. * extra/msvc_dbg.c (GetDescriptionFromAddress): Likewise. * gcj_mlc.c [GC_GCJ_SUPPORT] (GC_core_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * include/new_gc_alloc.h (single_client_gc_alloc_template::deallocate, single_client_gc_alloc_template::ptr_free_deallocate, single_client_traceable_alloc_template::deallocate, single_client_traceable_alloc_template::ptr_free_deallocate): Likewise. * malloc.c [THREADS] (GC_free_inner): Likewise. * mark_rts.c (GC_add_roots_inner): Likewise. * misc.c (GC_clear_stack): Likewise. * os_dep.c [GWW_VDB] (GC_gww_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB] (GC_protect_heap): Likewise. * os_dep.c [PROC_VDB] (GC_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Likewise. * pthread_stop_world.c [GC_NETBSD_THREADS_WORKAROUND] (GC_start_world): Likewise. * pthread_support.c [!GC_NO_PTHREAD_SIGMASK] (pthread_sigmask): Likewise. * reclaim.c [!SMALL_CONFIG] (GC_reclaim_all): Likewise. * tests/test.c (run_one_test): Likewise. * tests/test.c [MACOS] (SetMinimumStack): Likewise. * thread_local_alloc.c [THREAD_LOCAL_ALLOC] (return_single_freelist): Likewise. * typd_mlc.c (GC_make_descriptor): Likewise. * win32_threads.c (GC_start_world, GC_CreateThread): Likewise. * win32_threads.c [!GC_PTHREADS_PARAMARK] (GC_start_mark_threads_inner): Likewise. * win32_threads.c [!MSWINCE && !CYGWIN32] (GC_beginthreadex): Likewise.
2016-10-04Eliminate more 'scope of variable can be reduced' cppcheck style warningsIvan Maidanski
* allchblk.c (GC_compute_large_free_bytes, GC_print_hblkfreelist, free_list_index_of, GC_dump_regions, GC_add_to_fl, GC_unmap_old, GC_allochblk_nth): Move local variable declaration to the inner scope where the variable is actually used. * alloc.c (GC_maybe_gc, GC_collect_a_little_inner, GC_set_fl_marks, GC_clear_fl_marks): Likewise. * dyn_load.c (GC_register_dynamic_libraries): Likewise. * finalize.c (GC_ignore_self_finalize_mark_proc, GC_register_finalizer_inner, GC_dump_finalization_links, GC_dump_finalization, GC_make_disappearing_links_disappear, GC_remove_dangling_disappearing_links, GC_invoke_finalizers): Likewise. * headers.c (GC_install_counts): Likewise. * malloc.c (GC_malloc_kind_global, GC_generic_malloc_uncollectable, GC_free): Likewise. * mark.c (GC_push_all_eager, GC_push_marked1, GC_push_marked2, GC_push_marked4): Likewise. * mark_rts.c (GC_next_exclusion, GC_exclude_static_roots_inner, GC_push_conditional_with_exclusions): Likewise. * misc.c (GC_base, GC_parse_mem_size_arg, GC_write): Likewise. * os_dep.c (GC_repeat_read, GC_get_maps, GC_least_described_address, GC_register_root_section, GC_register_data_segments): Likewise. * reclaim.c (GC_reclaim_block, GC_start_reclaim): Likewise. * finalize.c (ITERATE_DL_HASHTBL_BEGIN): Declare prev_dl local variable.
2016-06-10Dump the block information in CSV formatPaul Bone
This makes it easy to copy this information into a new file and process it with tools that understand CSV, e.g. to create histograms of block utilization. * reclaim.c (GC_print_block_descr): add n_objs local variable; separate printed values with a comma; print also size of block in object units; refactor code for computing total_bytes field. * reclaim.c (GC_print_block_list): Separate columns in printed table header with a comma; append "#objs" column to the table.
2015-08-05Make heap walker accept callbackIvan Maidanski
* alloc.c (GC_mercury_callback_reachable_object): Remove. * include/gc.h (GC_mercury_callback_reachable_object): Likewise. * include/private/gc_priv.h (GC_mercury_enumerate_reachable_objects): Likewise. * alloc.c (GC_finish_collection): Do not call GC_mercury_enumerate_reachable_objects. * include/gc_mark.h (GC_reachable_object_proc): New public typedef. * include/gc_mark.h (GC_enumerate_reachable_objects_inner): New API function declaration. * reclaim.c (enumerate_reachable_s): New struct type. * reclaim.c (GC_mercury_do_enumerate_reachable_objects): Rename to GC_do_enumerate_reachable_objects; replace while() with for(); use 2nd argument to pass client callback and custom data; call client callback (passed via the argument) instead of GC_mercury_callback_reachable_object; pass object size in bytes instead of words to client callback. * reclaim.c (GC_mercury_enumerate_reachable_objects): Rename to GC_enumerate_reachable_objects_inner; decorate with GC_API/GC_CALL; add 2 arguments (client callback and custom data); remove assertion for GC_mercury_callback_reachable_object; add assertion for acquired lock. * tests/test.c: Include gc_mark.h unconditionally. * tests/test.c (reachable_objs_counter, reachable_objs_count_enumerator): New function. * tests/test.c (check_heap_stats): New local variable "obj_count"; invoke GC_call_with_alloc_lock(reachable_objs_count_enumerator); print final number of reachable objects.
2015-07-31Add support for enumerating the reachable objects in the heapPeter Wang
(Apply part of commit dbf2db8 from 'paulbone/mercury7_4_pbone' branch.) This can be used to do heap profiling, helping the developer work out which objects are live or what kinds of objects account for a lot of their heap space. * alloc.c: * include/gc.h: * include/private/gc_priv.h: * reclaim.c: As above.
2013-09-17Fix race in GC_print_all_errors regarding GC_leakedIvan Maidanski
* reclaim.c (GC_add_leaked): Remove FIXME. * reclaim.c (GC_print_all_errors): Declare n_leaked, leaked[] local variables initialized from GC_[n_]leaked while holding the allocation lock (reset GC_n_leaked and GC_leaked[] as well); add GC_ASSERT for n_leaked; use [n_]leaked while printing leaked objects count and pointers. * reclaim.c (GC_print_all_errors): Acquire lock to reset printing_errors.
2012-11-15Call GC_stats/verbose_log_printf instead of GC_log_printf if print_statsIvan Maidanski
(code refactoring) * alloc.c (GC_try_to_collect_inner, GC_stopped_mark, GC_finish_collection): Use GC_stats_log_printf instead of GC_log_printf inside "if (GC_print_stats)" blocks. * include/private/gc_priv.h (GC_COND_LOG_PRINTF): Likewise. * finalize.c (GC_print_finalization_stats): Use GC_stats_log_printf instead of GC_log_printf (since the function is invoked only inside "if (GC_print_stats)" blocks). * include/private/gc_priv.h (GC_printf, GC_log_printf): Refine comment. * include/private/gc_priv.h (GC_stats_log_printf, GC_verbose_log_printf): New macro (redirected to GC_log_printf). * reclaim.c (GC_reclaim_all): Use GC_verbose_log_printf instead of GC_log_printf inside "if (GC_print_stats==VERBOSE)" blocks. * include/private/gc_priv.h (GC_COND_LOG_PRINTF): Likewise. * misc.c (GC_LOG_PRINTF_IMPL): New macro (only if GC_ANDROID_LOG, copy most code from GC_log_printf). * misc.c (GC_log_printf): Define separately for Android using GC_LOG_PRINTF_IMPL macro (only if GC_ANDROID_LOG).
2012-11-11Improve GC output atomicity in GC_print_obj, GC_print_all_errorsIvan Maidanski
(as well as in GC_print_backtrace, GC_print_all_smashed_proc) * blacklst.c (GC_default_print_heap_obj_proc): Refine printed message; output object kind; output trailing "\n". * reclaim.c (GC_print_all_errors): Do not print object kind (before GC_print_heap_obj call). * dbg_mlc.c (GC_print_backtrace): Remove redundant printed "\n" after GC_print_heap_obj call. * reclaim.c (GC_print_all_errors): Likewise. * dbg_mlc.c (GC_print_type): Remove (move code to GC_print_obj replacing "p" local variable with "q"). * dbg_mlc.c (GC_print_obj): Merge adjacent GC_err_printf and GC_err_puts invocation into a single GC_err_printf one (for output atomicity). * dbg_mlc.c (GC_print_all_smashed_proc): Print number of found objects first. * reclaim.c (GC_print_all_errors): Likewise. * dbg_mlc.c (GC_print_all_smashed_proc): Remove printed "\n" at list end. * include/private/gc_priv.h (GC_print_heap_obj, GC_printf): Refine comments.
2012-11-10Improve GC error printing atomicity in GC_add_to_black_list_normal/stackIvan Maidanski
(as well as in GC_print_sig_mask, GC_print_block_list, GC_print_free_list) * blacklst.c (GC_print_source_ptr): Replace with 3-argument GC_print_blacklisted_ptr(); rename "p" to "source" argument; move GC_err_printf calls surrounding GC_print_source_ptr invocation from GC_add_to_black_list_normal and GC_add_to_black_list_stack; replace GC_default_print_heap_obj_proc call with the corresponding GC_err_printf call; merge adjacent GC_err_printf calls into single one (for output in-line atomicity). * blacklst.c (GC_add_to_black_list_normal, GC_add_to_black_list_stack): Replace GC_print_source_ptr (and surrounding GC_err_printf) call with GC_print_blacklisted_ptr one. * pthread_stop_world.c (GC_print_sig_mask): Print each blocked signal on a separate line (replace multiple GC_printf calls with a single one ending with "\n"). * reclaim.c (GC_print_block_descr): Terminate GC_printf message with "\n" (for output in-line atomicity). * reclaim.c (GC_print_block_list): Remove redundant "\n" at the beginning of GC_printf message (since GC_print_block_descr prints new-line at the end of the message). * reclaim.c (GC_print_free_list): Enumerate printed objects starting from 0 (instead of 1); print information about each free object on a separate line (replace multiple GC_printf calls with a single one ending with "\n"); remove "lastBlock" local variable.
2012-03-25Fix visibility of some GC internal symbols used by GCJIvan Maidanski
(Includes reverting part of commits 68b9f27, 91d5df5, b2345fb) * allchblk.c (GC_hblkfreelist, GC_free_bytes): Do not define array as STATIC again but only if GC_GCJ_SUPPORT (for GNU GCJ client). * blacklst.c (GC_is_black_listed): Do not define as GC_INNER again (for GNU GCJ client). * include/private/gc_priv.h (GC_is_black_listed): Likewise. * include/private/gc_priv.h (GC_hblkfreelist): Restore removed declaration (but only if GC_GCJ_SUPPORT). * reclaim.c (GC_n_set_marks): Do not define as STATIC again (for GCJ); update the comment.
2012-03-05Replace pointer relational comparisons with non-pointer onesIvan Maidanski
* allchblk.c (GC_dump_regions, GC_allochblk_nth): Cast pointers to word type in relational (less-greater) comparisons. * alloc.c (GC_add_to_heap, GC_print_heap_sects, GC_expand_hp_inner): Likewise. * backgraph.c (ensure_struct, add_back_edges): Likewise. * blacklst.c (GC_number_stack_black_listed): Likewise. * checksums.c (GC_checksum, GC_check_dirty): Likewise. * darwin_stop_world.c (GC_push_all_stacks): Likewise. * dbg_mlc.c (GC_get_back_ptr_info, GC_print_smashed_obj, GC_check_heap_block): Likewise. * dyn_load.c (sort_heap_sects, GC_register_map_entries, GC_register_dynlib_callback, GC_register_dynamic_libraries_dl_iterate_phdr, GC_register_dynamic_libraries, GC_cond_add_roots): Likewise. * finalize.c (GC_ignore_self_finalize_mark_proc): Likewise. * headers.c (GC_scratch_alloc, GC_install_counts, GC_remove_counts): Likewise. * include/private/gc_pmark.h (PUSH_OBJ, PUsH_CONTENTS_HDR, GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP, GC_mark_stack_empty): Likewise. * include/private/gc_priv.h (MAKE_COOLER, COOLER_THAN): Likewise. * mach_dep.c (GC_with_callee_saves_pushed): Likewise. * malloc.c (calloc, free): Likewise. * mark.c (GC_mark_some_inner, GC_mark_from, GC_steal_mark_stack, GC_return_mark_stack, GC_do_local_mark, GC_mark_local, GC_push_all, GC_push_selected, GC_push_all_eager, GC_push_marked1, GC_push_marked2, GC_push_marked4, GC_push_marked, GC_push_unconditionally): Likewise. * mark_rts.c (GC_is_static_root, GC_add_roots_inner, GC_remove_roots_inner, GC_is_tmp_root, GC_exclude_static_roots_inner, GC_push_conditional_with_exclusions, GC_push_all_register_sections, GC_push_all_stack_sections, GC_push_all_stack_partially_eager, GC_push_all_stack_part_eager_sections, GC_push_current_stack): Likewise. * misc.c (GC_clear_stack_inner, GC_clear_stack, GC_base, GC_call_with_gc_active): Likewise. * new_hblk.c (GC_build_fl_clear2, GC_build_fl_clear4, GC_build_fl2, GC_build_fl4, GC_build_fl): Likewise. * os_dep.c (GC_enclosing_mapping, GC_text_mapping, tiny_sbrk, GC_find_limit_openbsd, GC_skip_hole_openbsd, GC_find_limit_with_bound, GC_get_main_stack_base, GC_get_stack_base, GC_least_described_address, GC_register_root_section, GC_register_data_segments, GC_unmap_start, GC_gww_read_dirty, GC_remove_protection, GC_protect_heap, GC_unprotect_range, GC_read_dirty, GC_page_was_dirty, GC_save_callers, GC_print_callers): Likewise. * pcr_interface.c (GC_enumerate_block): Likewise. * pthread_support.c (GC_is_thread_tsd_valid, GC_segment_is_thread_stack, GC_greatest_stack_base_below, GC_call_with_gc_active): Likewise. * ptr_chck.c (GC_same_obj, GC_is_valid_displacement, GC_on_stack, GC_is_visible): Likewise. * reclaim.c (GC_reclaim_clear, GC_reclaim_uninit, GC_disclaim_and_reclaim, GC_reclaim_check, GC_start_reclaim): Likewise. * tests/test.c (cons): Likewise. * tools/setjmp_t.c (main): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * win32_threads.c (GC_is_thread_tsd_valid, GC_call_with_gc_active, GC_push_stack_for, GC_get_next_stack): Likewise. * extra/msvc_dbg.c (GetDescriptionFromAddress, GetDescriptionFromStack): Cast pointers to GC_ULONG_PTR in relational comparisons. * include/gc.h (GC_DATASTART, GC_DATAEND): Cast pointers to GC_word in relational comparisons. * misc.c (GC_init): Remove static assertion on ((ptr_t)-1 > 0) since no longer required; add the comment. * pcr_interface.c: Expand tabs to spaces.
2012-01-26Remove closure data from GC_register_disclaim_proc.Petter Urkedal
* include/gc_disclaim.h, fnlz_mlc.c (GC_disclaim_proc, GC_register_disclaim_proc): Remove CD from typedef and function. * reclaim.c (GC_reclaim_uninit, GC_reclaim_block): Adjust calls. * include/private/gc_priv.h, misc.c: Remove CD from object kind struct and initializers.
2011-09-30Review 'disclaim' add-on partially; fix code in some places againIvan Maidanski
2011-09-30Review 'disclaim' add-on partially; fix code in some placesIvan Maidanski
2011-09-30Fix issues proposed in Ivan's previous commit, etc.Petter Urkedal
* disclaim.c -> {finalized_mlc.c, misc.c}: Move low-level code to misc.c and the finalized object-kind to finalized_mlc.c. * Makefile.am: Update accordingly. * reclaim.c: Condition #include "gc_disclaim.h" and remove "register". * include/gc_disclaim.h, include/private/gc_priv.h, finalized_mlc.c, misc.c: Add GC_API, GC_CALL, and GC_CALLBACK. Use typedefs for function pointers. * tests/disclaim_test.c, tests/disclaim_bench.c: Fix portability and other issues. * include/gc_disclaim.h: Forward declare ... * finalized_mlc.c: ... and export GC_finalized_objfreelist. * thread_local_alloc.c (GC_destroy_thread_local): Return finalized freelists though the same global. * include/private/thread_local_alloc.h: Tweak (move array above comment). * Makefile.dj, NT_MAKEFILE, NT_STATIC_THREADS_MAKEFILE, NT_X64_STATIC_THREADS_MAKEFILE, NT_X64_THREADS_MAKEFILE, gc.mak, windows-untested/vc60/gc.dsp, windows-untested/vc70/gc.vcproj, windows-untested/vc71/gc.vcproj: Add include/gc_disclaim.h to various build systems. (Untested.)
2011-09-30ENABLE_DISCLAIM: Make stylistic fixes in many places and add many FIXME.Ivan Maidanski
2011-09-30Fix some issues and avoid warnings in disclaim-related code.Petter Urkedal
* disclaim.c, include/gc_disclaim.h: Fix prototype. * include/private/gc_priv.h, mark.c: Avoid missing initializer warning. * mark.c: Fix type of a size_t variable in GC_reclaim_block. * misc.c: Initialize ok_mark_unconditionally. * reclaim.c: Tweak and avoid unused label warning. * tests/disclaim_bench.c, tests/disclaim_test.c: Remove or conditionalize unused variables.
2011-09-30Implement freeing of blocks with disclaim callbacks.Petter Urkedal
2011-09-30Adjust comments and whitespace.Petter Urkedal
2011-09-30Fixed compilation errors, also tests passes.Petter Urkedal
reclaim.c: Removed obsolete argument to GC_reclaim_small_nonempty_block.
2011-09-30Fixed memory leak issue with unconditional marking.Petter Urkedal
2011-09-30Add disclaim callbacks for efficient finalization.Petter Urkedal
Importing gc-20070403-disclaim-1.0.patch. * configure.ac: Add --disable-disclaim option and set ENABLE_DISCLAIM macro and conditional accordingly. * include/include.am, Makefile.am Add sources disclaim.c and include/gc_disclaim.h. * Makefile.direct: Ditto and define ENABLE_DISCLAIM. * include/private/gc_priv.h (obj_kind): Add ok_mark_unconditionally, ok_disclaim_proc and ok_disclaim_cd. * misc.c (GC_new_kind_inner): Initialize them. * include/private/gc_priv.h (hblkhdr): Add HAS_DISCLAIM and MARK_UNCONDITIONALLY flags. * allchblk.c (setup_header): Set HAS_DISCLAIM and MARK_UNCONDITIONALLY flags as indicated by the object kind. * reclaim.c: Main adjustments to support the disclaim callbacks. * mark.c (GC_push_unconditionally, GC_push_next_marked_uncollecable): Unconditionally mark from objects in blocks flagged MARK_UNCONDITIONALLY. This preserves links reachable from the finalizer when using the the finalized object kind. * disclaim.c: Add file with support functions for disclaim callbacks and implementation of the "finalized" object kind. * include/gc_disclaim.h: Add file providing the corresponding API. * include/private/thread_local_alloc.h (thread_local_freelists): Add finalized_freelists. * thread_local_alloc.c: Initialize them. * tests/tests.am, tests/disclaim_test.c, tests/disclaim_bench.c: Add disclaim-related tests.
2011-09-30Resolve some minor warnings reported by GCC with '-pedantic' optionIvan Maidanski
* allchblk.c (GC_print_hblkfreelist, GC_dump_regions, GC_freehblk): Explicitly cast a pointer argument of GC_printf to void* to match %p format specifier. * reclaim.c (GC_print_free_list): Likewise.
2011-07-262011-05-31 Ivan Maidanski <ivmai@mail.ru>ivmai
* alloc.c (GC_add_current_malloc_heap, GC_build_back_graph, GC_traverse_back_graph): Move prototype to gc_priv.h. * checksums.c (GC_page_was_ever_dirty): Ditto. * dbg_mlc.c (GC_default_print_heap_obj_proc): Ditto. * dyn_load.c (GC_parse_map_entry, GC_get_maps, GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base, GC_get_next_stack): Ditto. * finalize.c (GC_reset_finalizer_nested, GC_check_finalizer_nested): Ditto. * gcj_mlc.c (GC_start_debugging, GC_store_debug_info): Ditto. * malloc.c (GC_extend_size_map, GC_text_mapping): Ditto. * mark_rts.c (GC_mark_thread_local_free_lists): Ditto. * misc.c (GC_register_main_static_data, GC_init_win32, GC_setpagesize, GC_init_linux_data_start, GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf, GC_initialize_offsets, GC_bl_init, GC_do_blocking_inner, GC_bl_init_no_interiors): Ditto. * os_dep.c (GC_greatest_stack_base_below, GC_push_all_stacks): Ditto. * reclaim.c (GC_check_leaked): Ditto. * win32_threads.c (GC_gww_dirty_init): Ditto. * darwin_stop_world.c (GC_is_mach_marker, GC_mprotect_stop, GC_mprotect_resume): Move prototype to darwin_stop_world.h. * pthread_support.c (GC_FindTopOfStack): Ditto. * dyn_load.c (GC_cond_add_roots): Merge adjacent definitions. * mark.c (GC_page_was_ever_dirty): Remove (as already declared). * mark_rts.c (GC_roots_present): Change return type to void pointer (to match the prototype); return NULL instead of FALSE. * mark_rts.c (GC_add_roots_inner): Cast GC_roots_present() result. * os_dep.c (NEED_PROC_MAPS): Move definition to gcconfig.h. * os_dep.c (GC_write_fault_handler): Make STATIC. * os_dep.c (GC_set_write_fault_handler): New function (only if GC_WIN32_THREADS). * pthread_start.c (GC_start_rtn_prepare_thread, GC_thread_exit_proc): Move prototype to pthread_support.h. * pthread_support.c (GC_nacl_initialize_gc_thread, GC_nacl_shutdown_gc_thread, GC_unblock_gc_signals): Ditto. * pthread_support.c (GC_stop_init): Move prototype to pthread_stop_world.h. * thread_local_alloc.c (GC_check_tls_for): Reformat comment. * win32_threads.c (GC_write_fault_handler): Remove prototype. * win32_threads.c (GC_register_my_thread_inner): Call GC_set_write_fault_handler instead of SetUnhandledExceptionFilter (only if MPROTECT_VDB). * doc/README.win32: Add information about DMC. * include/private/gc_priv.h (GC_set_write_fault_handler): New prototype (only if GC_WIN32_THREADS and MPROTECT_VDB).
2011-07-262011-05-07 Ivan Maidanski <ivmai@mail.ru>ivmai
* alloc.c (GC_clear_a_few_frames): Use BZERO(). * mark_rts.c (GC_clear_roots, GC_rebuild_root_index): Ditto. * reclaim.c (GC_start_reclaim): Ditto. * blacklst.c (total_stack_black_listed): Remove "len" local variable. * dbg_mlc.c (GC_generate_random_valid_address): Replace "for" statement with "do-while" one. * dyn_load.c (GC_register_dynamic_libraries, GC_register_dynlib_callback): Remove redundant parentheses.
2011-07-262011-05-06 Ivan Maidanski <ivmai@mail.ru>ivmai
* dbg_mlc.c (GC_has_other_debug_info): Change return type to int; return -1 if the object has (or had) debugging info but was marked deallocated. * include/private/dbg_mlc.h (GC_has_other_debug_info): Ditto. * dbg_mlc.c (GC_has_other_debug_info): Update documentation; remove "ohdr" local variable. * dbg_mlc.c (GC_debug_free): Don't call GC_free if the object has probably been deallocated. * dbg_mlc.c (GC_debug_free): Don't actually free the object even in the leak-finding mode if GC_findleak_delay_free. * dbg_mlc.c (GC_print_all_smashed_proc): Print a trailing blank line. * dbg_mlc.c (GC_check_leaked): New function (only unless SHORT_DBG_HDRS). * doc/README.environment (GC_FINDLEAK_DELAY_FREE): Document. * doc/README.macros (GC_FINDLEAK_DELAY_FREE): Ditto. * include/private/dbg_mlc.h (START_FLAG, END_FLAG): Use GC_WORD_C on 64-bit architectures. * include/private/dbg_mlc.h (NOT_MARKED): Remove redundant parentheses. * include/private/dbg_mlc.h (GC_HAS_DEBUG_INFO): Update (due to GC_has_other_debug_info change). * include/private/gc_priv.h (GC_findleak_delay_free): New global variable declaration (unless SHORT_DBG_HDRS). * misc.c (GC_findleak_delay_free): New global variable; recognize GC_FINDLEAK_DELAY_FREE. * misc.c (GC_init): Recognize GC_FINDLEAK_DELAY_FREE environment variable (unless SHORT_DBG_HDRS). * reclaim.c (GC_check_leaked): Declare (unless SHORT_DBG_HDRS). * reclaim.c (GC_add_leaked): Don't add the object to leaked list if marked as deallocated.
2011-07-262011-05-05 Ivan Maidanski <ivmai@mail.ru>ivmai
* dbg_mlc.c (GC_has_other_debug_info): Fix punctuation in the comment. * dbg_mlc.c (GC_FREED_MEM_MARKER): New macro. * dbg_mlc.c (GC_debug_free): Use GC_FREED_MEM_MARKER. * dbg_mlc.c (GC_smashed): Refine documentation. * mark.c (GC_push_selected): Change dirty_fn return type to GC_bool. * os_dep.c (GC_page_was_ever_dirty): Make GC_INNER. * reclaim.c (GC_reclaim_small_nonempty_block): Remove "kind" local variable. * reclaim.c (GC_reclaim_block): Pass true constant to GC_reclaim_small_nonempty_block (instead of report_if_found). * doc/README.autoconf: Update; fix a typo. * include/private/gcconfig.h (GC_WORD_C): New macro.
2011-07-262011-04-18 Ivan Maidanski <ivmai@mail.ru>ivmai
* dbg_mlc.c (GC_store_debug_info_inner): Always define; add "const" to its string argument. * dbg_mlc.c (GC_store_debug_info): Call GC_store_debug_info_inner. * dbg_mlc.c (GC_debug_free): Set GC_have_errors in case of smashed or previously deallocated found. * dbg_mlc.c (GC_check_heap_block): Replace while loop with a for one. * reclaim.c (GC_reclaim_check): Ditto. * dbg_mlc.c (GC_check_heap_proc): Remove redundant cast to word. * os_dep.c (GC_get_stack_base): Don't initialize stackbase_main_self/ss_sp on Solaris if thr_main() is zero (thus calling GC_INIT() from a non-primordial thread is possible now). * reclaim.c (GC_add_leaked): Turn into an inline one. * reclaim.c (GC_reclaim_small_nonempty_block): Change report_if_found type from int/word to boolean. * include/private/gc_priv.h (GC_start_reclaim): Ditto. * include/private/gc_priv.h (set_mark_bit_from_hdr, clear_mark_bit_from_hdr): Place closing parenthesis properly; reformat the code.
2011-07-262011-04-09 Ivan Maidanski <ivmai@mail.ru>ivmai
* reclaim.c (GC_print_all_errors): Recognize new GC_ABORT_ON_LEAK macro and environment variable; abort if any error has been printed provided the environment variable (or macro) is set. * doc/README.environment (GC_ABORT_ON_LEAK): Document. * doc/README.macros (GC_ABORT_ON_LEAK): Ditto. * doc/README.macros (FIND_LEAK, SUNOS5SIGS, PCR, USE_COMPILER_TLS): Reformat the text.
2011-07-262011-04-07 Ivan Maidanski <ivmai@mail.ru>ivmai
* alloc.c (GC_check_heap, GC_print_all_smashed): Move the definition from misc.c. * dbg_mlc.c (GC_debug_malloc_atomic_uncollectable): Define as public. * include/gc.h (GC_debug_malloc_atomic_uncollectable): Declare. * include/gc.h (GC_MALLOC_ATOMIC_UNCOLLECTABLE): Define new public macro. * dbg_mlc.c (MAX_SMASHED): Don't define if already set. * reclaim.c (MAX_LEAKED): Ditto. * dbg_mlc.c (GC_add_smashed): Add FIXME about the concurrent access to the global array. * reclaim.c (GC_add_leaked): Ditto. * misc.c (GC_print_back_height): Set on if GC_PRINT_BACK_HEIGHT (new macro) is defined. * doc/README.macros (GC_PRINT_BACK_HEIGHT): Document. * misc.c (GC_dump_regularly, GC_init): Replace 0/1 for GC_dump_regularly and GC_print_back_height variables with FALSE/TRUE. * reclaim.c (GC_print_all_errors): Refine the comment.
2011-07-262011-04-03 Ivan Maidanski <ivmai@mail.ru>ivmai
* allchblk.c (GC_freehblk): Use GC_log_printf instead of GC_printf inside "if (GC_print_stats)" branch. * alloc.c (GC_collect_or_expand): Ditto. * dyn_load.c (GC_register_dynamic_libraries): Ditto. * headers.c (GC_scratch_alloc): Ditto. * os_dep.c (GC_get_maps, GC_remap, PROTECT, GC_write_fault_handler, GC_dirty_init, GC_mprotect_thread): Ditto. * alloc.c (min_bytes_allocd): Use GC_log_printf instead of GC_printf for DEBUG_THREADS output. * darwin_stop_world.c (GC_stack_range_for, GC_suspend_thread_list, GC_stop_world, GC_thread_resume, GC_start_world): Ditto. * pthread_start.c (GC_inner_start_routine): Ditto. * pthread_stop_world.c (GC_suspend_handler, GC_restart_handler, GC_push_all_stacks, GC_suspend_all, GC_stop_world, GC_start_world): Ditto. * pthread_support.c (GC_mark_thread, GC_get_nprocs, GC_start_rtn_prepare_thread, pthread_create): Ditto. * alloc.c (GC_adj_bytes_allocd, GC_maybe_gc, GC_stopped_mark, GC_finish_collection): Reformat code. * pthread_stop_world.c (GC_print_sig_mask): Ditto. * pthread_support.c (GC_thr_init): Ditto. * checksums.c (GC_update_check_page): Use GC_printf() instead of GC_err_printf() for error printing. * checksums.c (GC_check_blocks, GC_check_dirty): Use GC_log_printf instead of GC_printf for logging purposes. * dyn_load.c (sys_errlist, sys_nerr, errno): Move declaration of external variable outside from GC_register_dynamic_libraries. * dyn_load.c (GC_register_dynamic_libraries): Don't use sys_errlist value if errno equals to sys_nerr. * dyn_load.c (GC_register_dynamic_libraries): Use GC_log_printf instead of GC_printf for DL_VERBOSE output. * dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove, GC_init_dyld): Use GC_log_printf instead of GC_printf for DARWIN_DEBUG output. * os_dep.c (catch_exception_raise): Use GC_log_printf instead of GC_printf for DEBUG_EXCEPTION_HANDLING output. * reclaim.c (GC_print_free_list): Move "n" increment out of GC_printf() call.
2011-07-262010-03-05 Ivan Maidanski <ivmai@mail.ru>ivmai
* alloc.c (GC_set_stop_func, GC_get_stop_func): Add DCL_LOCK_STATE. * finalize.c (GC_notify_or_invoke_finalizers): Ditto. * gc_dlopen.c (disable_gc_for_dlopen): Ditto. * gcj_mlc.c (maybe_finalize, GC_debug_gcj_malloc): Ditto. * mark.c (GC_print_trace): Ditto. * misc.c (GC_set_warn_proc, GC_get_warn_proc, GC_enable, GC_disable, GC_new_free_list, GC_new_kind, GC_new_proc, GC_set_oom_fn, GC_get_oom_fn, GC_set_finalizer_notifier, GC_get_finalizer_notifier): Ditto. * os_dep.c (GC_get_stack_base, GC_print_callers): Ditto. * pthread_support.c (GC_is_thread_tsd_valid, GC_wait_for_gc_completion, GC_init_parallel, GC_do_blocking_inner, GC_call_with_gc_active, GC_unregister_my_thread, pthread_join, pthread_detach, GC_register_my_thread, GC_inner_start_routine, pthread_create): Ditto. * reclaim.c (GC_print_all_errors): Ditto. * win32_threads.c (GC_is_thread_tsd_valid, GC_register_my_thread, GC_unregister_my_thread, GC_do_blocking_inner, GC_call_with_gc_active, GC_lookup_pthread, GC_pthread_join, GC_pthread_start_inner, GC_thread_exit_proc, GC_pthread_detach, GC_init_parallel): Ditto.
2011-07-262009-12-08 Ivan Maidanski <ivmai@mail.ru>ivmai
* allchblk.c (GC_allochblk_nth): Don't call GC_remove_protection() if GC_DISABLE_INCREMENTAL. * reclaim.c (GC_reclaim_generic): Ditto. * checksums.c (GC_page_was_ever_dirty): Add prototype. * include/private/gc_locks.h (GC_mark_lock_holder): Don't declare unless PARALLEL_MARK. * include/private/gc_priv.h (GC_dirty_maintained, GC_page_was_dirty, GC_remove_protection, GC_dirty_init): Don't declare if GC_DISABLE_INCREMENTAL. * include/private/gc_priv.h (GC_print_finalization_stats): Don't declare if SMALL_CONFIG. * include/private/gcconfig.h (CHECKSUMS): Explicitly undefine if GC_DISABLE_INCREMENTAL (since nothing to check). * include/private/gcconfig.h (DEFAULT_VDB): Don't define if GC_DISABLE_INCREMENTAL. * os_dep.c (GC_dirty_maintained): Ditto. * mark.c (GC_initiate_gc): Don't call GC_read_dirty() if GC_DISABLE_INCREMENTAL. * os_dep.c (GC_gww_page_was_ever_dirty, GC_page_was_ever_dirty): Uncomment; define only if CHECKSUMS.
2011-07-262009-10-22 Ivan Maidanski <ivmai@mail.ru>ivmai
* allchblk.c (GC_unmap_old, GC_merge_unmapped, GC_allochblk, GC_freehblk): Use GC_INNER for the function definition. * alloc.c (GC_never_stop_func, GC_should_collect, GC_try_to_collect_inner, GC_collect_a_little_inner, GC_set_fl_marks, GC_add_to_our_memory, GC_add_to_heap, GC_expand_hp_inner, GC_collect_or_expand, GC_allocobj): Ditto. * backgraph.c (GC_build_back_graph, GC_traverse_back_graph): Ditto. * blacklst.c (GC_default_print_heap_obj_proc, GC_bl_init, GC_promote_black_lists, GC_unpromote_black_lists, GC_add_to_black_list_normal, GC_add_to_black_list_stack, GC_is_black_listed): Ditto. * darwin_stop_world.c (GC_push_all_stacks, GC_push_all_stacks, GC_stop_init, GC_stop_world, GC_start_world): Ditto. * dbg_mlc.c (GC_has_other_debug_info, GC_store_back_pointer, GC_marked_for_finalization, GC_generate_random_backtrace_no_gc, GC_store_debug_info, GC_start_debugging, GC_debug_generic_malloc_inner, GC_debug_generic_malloc_inner_ignore_off_page, GC_debug_malloc_uncollectable, GC_debug_free_inner): Ditto. * dyn_load.c (GC_register_dynamic_libraries, GC_register_main_static_data, GC_init_dyld): Ditto. * finalize.c (GC_push_finalizer_structures, GC_finalize, GC_notify_or_invoke_finalizers, GC_print_finalization_stats): Ditto. * gcj_mlc.c (GC_core_gcj_malloc): Ditto. * headers.c (GC_find_header, GC_header_cache_miss, GC_scratch_alloc, GC_init_headers, GC_install_header, GC_install_counts, GC_remove_header, GC_remove_counts, GC_next_used_block, GC_prev_block): Ditto. * mach_dep.c (GC_with_callee_saves_pushed): Ditto. * malloc.c (GC_collect_or_expand, GC_alloc_large, GC_generic_malloc_inner, GC_generic_malloc_inner_ignore_off_page, GC_core_malloc_atomic, GC_core_malloc, GC_free_inner): Ditto. * mallocx.c (GC_generic_malloc_ignore_off_page): Ditto. * mark.c (GC_collection_in_progress, GC_clear_hdr_marks, GC_set_hdr_marks, GC_set_mark_bit, GC_clear_mark_bit, GC_clear_marks, GC_initiate_gc, GC_mark_some, GC_mark_stack_empty, GC_invalidate_mark_state, GC_signal_mark_stack_overflow, GC_mark_from, GC_help_marker, GC_mark_init, GC_push_all, GC_push_conditional, GC_mark_and_push_stack, GC_push_all_eager, GC_push_all_stack): Ditto. * mark_rts.c (GC_is_static_root, GC_roots_present, GC_approx_sp, GC_exclude_static_roots_inner, GC_push_all_register_frames, GC_push_all_stack_frames, GC_cond_register_dynamic_libraries, GC_push_roots): Ditto. * misc.c (GC_extend_size_map, GC_clear_stack, GC_err_write): Ditto. * new_hblk.c (GC_build_fl, GC_new_hblk): Ditto. * obj_map.c (GC_register_displacement_inner, GC_add_map_entry, GC_initialize_offsets): Ditto. * os_dep.c (GC_get_maps, GC_parse_map_entry, GC_text_mapping, GC_init_linux_data_start, GC_init_netbsd_elf, GC_setpagesize, GC_set_and_save_fault_handler, GC_setup_temporary_fault_handler, GC_reset_fault_handler, GC_get_register_stack_base, GC_init_win32, GC_add_current_malloc_heap, GC_is_heap_base, GC_unmap, GC_remap, GC_unmap_gap, GC_push_all_stacks, GC_gww_dirty_init, GC_dirty_init, GC_read_dirty, GC_page_was_dirty, GC_page_was_ever_dirty, GC_remove_protection, GC_write_fault_handler, GC_mprotect_stop, GC_mprotect_resume, GC_save_callers, GC_print_callers): Ditto. * pthread_stop_world.c (GC_push_all_stacks, GC_stop_world, GC_start_world, GC_stop_init): Ditto. * pthread_support.c (GC_mark_thread_local_free_lists, GC_lookup_thread, GC_reset_finalizer_nested, GC_check_finalizer_nested, GC_segment_is_thread_stack, GC_greatest_stack_base_below, GC_thr_init, GC_init_parallel, GC_do_blocking_inner, GC_lock, GC_acquire_mark_lock, GC_release_mark_lock, GC_wait_for_reclaim, GC_notify_all_builder, GC_wait_marker, GC_notify_all_marker): Ditto. * reclaim.c (GC_print_all_errors, GC_block_empty, GC_reclaim_generic, GC_start_reclaim, GC_continue_reclaim, GC_reclaim_all): Ditto. * thread_local_alloc.c (GC_init_thread_local, GC_destroy_thread_local, GC_mark_thread_local_fls_for): Ditto. * win32_threads.c (GC_reset_finalizer_nested, GC_check_finalizer_nested, GC_do_blocking_inner, GC_stop_world, GC_start_world, GC_push_all_stacks, GC_get_next_stack, GC_acquire_mark_lock, GC_release_mark_lock, GC_wait_for_reclaim, GC_notify_all_builder, GC_wait_marker, GC_notify_all_marker, GC_thr_init, GC_init_parallel, GC_lock, GC_mark_thread_local_free_lists): Ditto. * alloc.c (GC_add_current_malloc_heap, GC_build_back_graph, GC_traverse_back_graph): Use GC_INNER for the function prototype. * darwin_stop_world.c (GC_mprotect_stop, GC_mprotect_resume): Ditto. * dbg_mlc.c (GC_default_print_heap_obj_proc): Ditto. * dyn_load.c (GC_parse_map_entry, GC_get_maps, GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base, GC_get_next_stack): Ditto. * finalize.c (GC_reset_finalizer_nested, GC_check_finalizer_nested): Ditto. * gcj_mlc.c (GC_start_debugging): Ditto. * include/private/dbg_mlc.h (GC_save_callers, GC_print_callers, GC_has_other_debug_info, GC_store_debug_info): Ditto. * include/private/gc_hdrs.h (GC_header_cache_miss): Ditto. * include/private/gc_locks.h (GC_lock): Ditto. * include/private/gc_pmark.h (GC_signal_mark_stack_overflow, GC_mark_from): Ditto. * include/private/pthread_support.h (GC_lookup_thread, GC_stop_init): Ditto. * include/private/thread_local_alloc.h (GC_init_thread_local, GC_destroy_thread_local, GC_mark_thread_local_fls_for): Ditto. * malloc.c (GC_extend_size_map, GC_text_mapping): Ditto. * mark.c (GC_page_was_ever_dirty): Ditto. * mark_rts.c (GC_mark_thread_local_free_lists): Ditto. * misc.c (GC_register_main_static_data, GC_init_win32, GC_setpagesize, GC_init_linux_data_start, GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf, GC_do_blocking_inner): Ditto. * os_dep.c (GC_greatest_stack_base_below): Ditto. * win32_threads.c (GC_write_fault_handler, GC_gww_dirty_init): Ditto. * include/private/gc_priv.h: Ditto (for most prototypes). * include/private/gc_priv.h (GC_INNER): Update the comment. * doc/README.macros (GC_DLL): Update.
2011-07-262009-10-21 Ivan Maidanski <ivmai@mail.ru>ivmai
* allchblk.c (DEBUG): Remove macro (since unused). * allchblk.c: Include private/gc_priv.h before other includes and definitions. * alloc.c: Ditto. * gc_dlopen.c: Ditto. * headers.c: Ditto. * mallocx.c: Ditto. * mark_rts.c: Ditto. * new_hblk.c: Ditto. * reclaim.c: Ditto. * mark.c: Include private/gc_pmark.h before other includes. * misc.c: Ditto. * dyn_load.c (_GNU_SOURCE): Move the definition to gc_priv.h. * pthread_support.c (_USING_POSIX4A_DRAFT10): Ditto. * pthread_support.c (_POSIX4A_DRAFT10_SOURCE): Remove (since already defined in gc_config_macros.h). * dyn_load.c (GC_init_dyld): Remove parameter cast for _dyld_register_func_for_add_image() and _dyld_register_func_for_remove_image(); add the comment about possible warnings; add FIXME for the deprecated _dyld_bind_fully_image_containing_address(). * include/private/gc_priv.h: Include gc.h before the standard headers inclusion. * tests/test.c: Ditto. * include/private/gcconfig.h (DebugBreak): Update the comment. * typd_mlc.c (ED_INITIAL_SIZE): Remove ';'. * alloc.c: Reformat the code (partly adjust indentation). * backgraph.c: Ditto. * blacklst.c: Ditto. * checksums.c: Ditto. * finalize.c: Ditto. * gcj_mlc.c: Ditto. * mach_dep.c: Ditto. * mark_rts.c: Ditto. * obj_map.c: Ditto. * os_dep.c: Ditto. * ptr_chck.c: Ditto. * stubborn.c: Ditto. * thread_local_alloc.c: Ditto. * typd_mlc.c: Ditto.
2011-07-262009-10-19 Ivan Maidanski <ivmai@mail.ru>ivmai
* include/private/gc_priv.h (GC_INNER): New macro (for GC-scope variable definitions). * include/private/gc_priv.h (GC_EXTERN): Update the comment. * allchblk.c (GC_unmap_threshold): Define as GC_INNER. * alloc.c (GC_incremental, GC_world_stopped, GC_n_heap_sects, GC_n_memory, GC_fail_count): Ditto. * blacklst.c (GC_black_list_spacing, GC_print_heap_obj): Ditto. * gcj_mlc.c (GC_gcj_malloc_initialized, GC_gcjobjfreelist): Ditto. * mach_dep.c (GC_save_regs_ret_val): Ditto. * mark.c (GC_n_mark_procs, GC_obj_kinds, GC_n_kinds, GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_size, GC_mark_stack_top, GC_mark_state, GC_mark_stack_too_small, GC_mark_no, GC_markers): Ditto. * mark_rts.c (GC_root_size, GC_push_typed_structures): Ditto. * misc.c (GC_allocate_ml, GC_debugging_started, GC_check_heap, GC_print_all_smashed, GC_print_back_height, GC_dump_regularly, GC_backtraces, GC_force_unmap_on_gcollect, GC_large_alloc_warn_interval, GC_is_initialized, GC_write_cs, GC_current_warn_proc, GC_blocked_sp, GC_activation_frame): Ditto. * os_dep.c (GC_page_size, GC_dont_query_stack_min, GC_no_win32_dlls, GC_wnt, GC_sysinfo, GC_push_other_roots, GC_dirty_maintained, GC_fault_handler_lock): Ditto. * pthread_support.c (GC_allocate_ml, GC_lock_holder, GC_need_to_lock, GC_thr_initialized, GC_threads, GC_in_thread_creation, GC_collecting, GC_allocate_lock, GC_mark_lock_holder): Ditto. * reclaim.c (GC_bytes_found, GC_fl_builder_count, GC_have_errors): Ditto. * win32_threads.c (GC_allocate_ml, GC_lock_holder, GC_need_to_lock, GC_mark_lock_holder, GC_collecting): Ditto. * extra/gc.c (GC_INNER, GC_EXTERN): Define as STATIC. * mach_dep.c (GC_with_callee_saves_pushed): Remove redundant {}. * os_dep.c (GC_init_win32): Reformat the comment.
2011-07-262009-10-17 Ivan Maidanski <ivmai@mail.ru>ivmai
* alloc.c (GC_never_stop_func, GC_check_fl_marks, GC_finish_collection): Reformat the code (make opening bracket style uniform across the file). * allchblk.c (GC_allochblk): Ditto. * backgraph.c (add_edge): Ditto. * dbg_mlc.c (GC_marked_for_finalization): Ditto. * dyn_load.c (GC_register_dynamic_libraries, GC_init_dyld): Ditto. * finalize.c (GC_null_finalize_mark_proc): Ditto. * gc_dlopen.c (GC_dlopen): Ditto. * mark.c (GC_push_marked1, GC_push_marked2, GC_push_marked4): Ditto. * misc.c (looping_handler, GC_call_with_gc_active, GC_do_blocking_inner, GC_do_blocking): Ditto. * os_dep.c (GC_get_main_stack_base, GC_read_dirty): Ditto. * pthread_support.c (GC_pthread_create, GC_pthread_sigmask, GC_pthread_join, GC_pthread_detach, GC_check_tls, GC_do_blocking_inner, GC_call_with_gc_active): Ditto. * reclaim.c (GC_reclaim_clear, GC_reclaim_block, GC_print_free_list): Ditto. * os_dep.c (GC_page_was_dirty, GC_page_was_ever_dirty, GC_remove_protection): Reformat the code (wrap long lines).
2011-07-262009-09-30 Ivan Maidanski <ivmai@mail.ru>ivmai
* allchblk.c (GC_large_alloc_warn_interval): Move declaration from gc_priv.h. * allchblk.c (GC_large_alloc_warn_suppressed): Move definition from misc.c; define as STATIC. * include/private/gc_priv.h (GC_large_alloc_warn_interval, GC_large_alloc_warn_suppressed): Remove declaration. * alloc.c (GC_bytes_found): Add "defined in" comment. * mallocx.c (GC_bytes_found): Ditto. * misc.c (GC_unmap_threshold): Ditto. * os_dep.c (GC_old_allocator): Ditto. * pthread_support.c (GC_markers): Ditto. * thread_local_alloc.c (GC_gcjobjfreelist, GC_gcj_malloc_initialized, GC_gcj_kind): Ditto. * win32_threads.c (GC_markers): Ditto. * alloc.c (GC_start_time): Explicitly initialize to 0 or NULL (to be distinctive from a variable declaration). * backgraph.c (GC_max_height, GC_deepest_obj): Ditto. * blacklst.c (GC_old_normal_bl, GC_incomplete_normal_bl, GC_old_stack_bl, GC_incomplete_stack_bl): Ditto. * checksums.c (GC_faulted, GC_n_dirty_errors, GC_n_faulted_dirty_errors, GC_n_changed_errors, GC_n_clean, GC_n_dirty, GC_bytes_in_used_blocks): Ditto. * dbg_mlc.c (GC_smashed): Ditto. * finalize.c (GC_old_dl_entries): Ditto. * gcj_mlc.c (GC_gcj_kind, GC_gcj_debug_kind, GC_gcjobjfreelist, GC_gcjdebugobjfreelist): Ditto. * mach_dep.c (GC_save_regs_ret_val): Ditto. * mark.c (GC_n_rescuing_pages, GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_top): Ditto. * misc.c (GC_min_sp, GC_high_water, GC_bytes_allocd_at_reset): Ditto. * os_dep.c (GC_data_start, GC_page_size, GC_sysinfo, GC_old_segv_handler, GC_old_bus_handler, GC_old_bus_handler_used_si, GC_old_segv_handler_used_si, GC_proc_buf, GC_proc_fd, GC_vd_base): Ditto. * pthread_stop_world.c (GC_stop_count, GC_stopping_pid): Ditto. * reclaim.c (GC_leaked): Ditto. * typd_mlc.c (GC_explicit_kind, GC_array_kind, GC_ext_descriptors, GC_typed_mark_proc_index, GC_array_mark_proc_index, GC_eobjfreelist, GC_arobjfreelist): Ditto. * win32_threads.c (GC_pthread_map_cache, GC_marker_cv, GC_marker_Id): Ditto. * dbg_mlc.c (GC_smashed, GC_n_smashed): Define as STATIC. * gcj_mlc.c (GC_gcjdebugobjfreelist): Ditto. * os_dep.c (GC_vd_base): Ditto. * pthread_support.c (GC_mark_threads): Ditto. * reclaim.c (GC_leaked): Ditto. * typd_mlc.c (GC_bm_table): Ditto. * mark_rts.c (GC_save_regs_ret_val): Change declaration type to that of definition; add "defined in" comment. * mark_rts.c (GC_push_current_stack): Remove unnecessary cast for GC_save_regs_ret_val. * misc.c (GC_check_heap, GC_print_all_smashed, GC_start_call_back): Remove unnecessary cast (of 0). * misc.c (GC_LARGE_ALLOC_WARN_INTERVAL): New tuning macro. * misc.c (GC_large_alloc_warn_interval): Initialize to GC_LARGE_ALLOC_WARN_INTERVAL value. * misc.c (GC_tmp): Change to "static". * os_dep.c (GC_setpagesize): Reformat the code (collapse multiple function definitions). * os_dep.c (GC_mprotect_state): Define as static. * pthread_support.c (dummy_thread_local): Prefix with "GC_". * win32_threads.c (WinMain): Remove FIXME for WinCE.