-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CHERI extension #627
Comments
(refactoring) Issue #627 (bdwgc). * tests/huge.c (GC_WORD_MAX): Rename to SIZE_MAX; change its type from GC_word to size_t. * tests/huge.c (SIZE_MAX): Undefine it (before definition). * tests/huge.c (GC_SWORD_MAX): Rename to U_SSIZE_MAX; change type from GC_signed_word to size_t (unsigned). * tests/huge.c (main): Rename GC_WORD_MAX to SIZE_MAX; rename GC_SWORD_MAX to U_SSIZE_MAX.
(refactoring) Issue #627 (bdwgc). Also, change sizeof(word) to sizeof(ptr_t) where PTR_ALIGN_DOWN/UP macros are used. * allchblk.c (find_nonbl_hblk): Change type of search_end local variable from word to ptr_t. * allchblk.c (find_nonbl_hblk): Use PTR_ALIGN_DOWN(). * dyn_load.c [HAVE_DL_ITERATE_PHDR && PT_GNU_RELRO && CPP_WORDSZ==64] (GC_register_dynlib_callback): Likewise. * dyn_load.c [ANY_MSWIN && !THREADS] (GC_cond_add_roots): Likewise. * include/private/gc_priv.h (HBLKPTR, HBLK_PAGE_ALIGNED): Likewise. * mark.c (GC_push_all, GC_custom_push_range, GC_push_all_eager, GC_push_all_stack): Likewise. * mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_selected): Likewise. * mark_rts.c (GC_add_roots_inner, GC_remove_roots_inner, GC_exclude_static_roots): Likewise. * misc.c [!ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED] (GC_clear_stack): Likewise. * misc.c (GC_base): Likewise. * os_dep.c [OPENBSD] (GC_skip_hole_openbsd): Likewise. * os_dep.c [ANY_MSWIN && !CYGWIN32] (GC_get_stack_base): Likewise. * os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES && THREADS] (GC_find_limit_with_bound): Likewise. * os_dep.c [HPUX_STACK_BOTTOM] (GC_get_register_stack_base): Likewise. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && !EMSCRIPTEN && !AMIGA && !EMBOX && !HAIKU && !OS2 && !ANY_MSWIN && !GC_OPENBSD_THREADS && (!GC_SOLARIS_THREADS || _STRICT_STDC) && !STACKBOTTOM && HEURISTIC1 && STACK_GROWS_UP] (GC_get_main_stack_base): Likewise. * os_dep.c [MSWIN32] (GC_least_described_address): Likewise. * dyn_load.c [HAVE_DL_ITERATE_PHDR && PT_GNU_RELRO && CPP_WORDSZ==64] (GC_register_dynlib_callback): Change sizeof(word) to sizeof(ptr_t). * mark.c (GC_push_all_eager, GC_push_all_stack): Likewise. * mark_rts.c (GC_add_roots_inner, GC_remove_roots_inner, GC_exclude_static_roots): Likewise. * os_dep.c [!ANY_MSWIN && (SVR4 || AIX || DGUX) && !PCR] (GC_SysVGetDataStart): Likewise. * os_dep.c [DATASTART_USES_BSDGETDATASTART] (GC_FreeBSDGetDataStart): Likewise. * dyn_load.c [(SOLARISDL || LINUX) && !USE_PROC_FOR_LIBRARIES] (GC_register_dynamic_libraries): Remove redundant parentheses. * dyn_load.c [HAVE_DL_ITERATE_PHDR && PT_GNU_RELRO] (GC_register_dynlib_callback): Use PTR_ALIGN_UP() instead of PTRT_ROUNDUP_BY_MASK(). * include/private/gcconfig.h [M68K && LINUX && !__ELF__ || I386 && (SEQUENT || HAIKU || SCO || LINUX && !__ELF__ || DJGPP) || MIPS && EWS4800 && _MIPS_SZPTR!=64 || M88K && CX_UX] (DATASTART): Likewise. * include/private/gcconfig.h [MIPS && EWS4800 && _MIPS_SZPTR!=64] (DATASTART2): Likewise. * mark.c (GC_push_all, GC_custom_push_range, GC_push_all_eager, GC_push_all_stack): Likewise. * mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_selected): Likewise. * mark_rts.c (GC_add_roots_inner, GC_remove_roots_inner, GC_exclude_static_roots): Likewise. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && !EMSCRIPTEN && !AMIGA && !EMBOX && !HAIKU && !OS2 && !ANY_MSWIN && !GC_OPENBSD_THREADS && (!GC_SOLARIS_THREADS || _STRICT_STDC) && !STACKBOTTOM && HEURISTIC1 && !STACK_GROWS_UP] (GC_get_main_stack_base): Likewise. * os_dep.c [!ANY_MSWIN && (SVR4 || AIX || DGUX) && !PCR] (GC_SysVGetDataStart): Likewise. * os_dep.c [DATASTART_USES_BSDGETDATASTART] (GC_FreeBSDGetDataStart): Likewise. * os_dep.c [MMAP_SUPPORTED && !MSWIN_XBOX1] (GC_unix_mmap_get_mem): Likewise. * os_dep.c [!MSWIN_XBOX1 && !MSWINCE && USE_WINALLOC && MSWIN32 && !MSWINRT_FLAVOR] (GC_win32_get_mem): Likewise. * os_dep.c [USE_MUNMAP] (GC_unmap_start): Likewise. * os_dep.c [MPROTECT_VDB && DONT_PROTECT_PTRFREE] (GC_protect_heap): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB] (GC_remove_protection): Likewise. * dyn_load.c [ANY_MSWIN] (GC_cond_add_roots): Change type of base and limit arguments from char* to ptr_t. * dyn_load.c [ANY_MSWIN && !THREADS] (GC_cond_add_roots): Change type of stack_top local variable from char* to ptr_t. * dyn_load.c [ANY_MSWIN] (GC_register_dynamic_libraries): Change type of p local variable from PVOID to ptr_t; change type of base, limit, new_limit local variables from char* to ptr_t. * dyn_load.c [ANY_MSWIN && MSWINCE] (GC_register_dynamic_libraries): Use PTR_ALIGN_UP(). * include/private/gcconfig.h (PTR_ALIGN_DOWN): New macro. * include/private/gcconfig.h (PTRT_ROUNDUP_BY_MASK): Define PTR_ALIGN_UP() macro instead. * mark.c (GC_push_all_eager, GC_push_all_stack): Change type of lim local variable from word* to ptr_t. * misc.c (GC_base): Declare limit and sz local variables at the beginning of the function. * os_dep.c [OPENBSD] (GC_skip_hole_openbsd): Change type of pgsz local variable from word to size_t.
(refactoring) Issue #627 (bdwgc). * tests/gctest.c (small_cons_uncollectable): Use GC_HIDE_POINTER(). * tests/gctest.c (UNCOLLECTABLE_CDR): Use GC_REVEAL_POINTER().
(refactoring) Issue #627 (bdwgc). * include/private/gc_priv.h (COOLER_THAN): Remove. * include/private/gc_priv.h (HOTTER_THAN): Change macro to have two arguments; add comment. * include/private/gc_priv.h (MAKE_HOTTER): Rename x,y arguments to p,d. * include/private/gc_priv.h [!THREADS] (GC_is_static_root): Change type of argument from void* to ptr_t. * mark_rts.c [!THREADS] (GC_is_static_root): Likewise. * ptr_chck.c [!THREADS] (GC_on_stack): Likewise. * mark_rts.c [THREADS] (GC_push_all_stack_sections): Update condition according to MAKE_HOTTER defintion change. * mark_rts.c [!THREADS] (GC_push_all_stack_part_eager_sections): Likewise. * misc.c [!ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED && !ASM_CLEAR_CODE && !THREADS] (GC_clear_stack_inner): Likewise. * misc.c [!THREADS] (GC_init, GC_call_with_gc_active): Likewise. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN && !AMIGA && !EMBOX && !HAIKU && !OS2 && !ANY_MSWIN && !GC_OPENBSD_THREADS && (!GC_SOLARIS_THREADS || _STRICT_STDC) && !CPPCHECK] (GC_get_main_stack_base): Likewise. * os_dep.c [GC_DARWIN_THREADS && !NO_PTHREAD_GET_STACKADDR_NP || GC_SOLARIS_THREADS && !_STRICT_STDC || !GET_MAIN_STACKBASE_SPECIAL] (GC_get_stack_base): Likewise. * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && !(NARGS==0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE) && (I386 || SPARC)] (GC_save_callers): Likewise. * pthread_support.c (GC_call_with_gc_active): Likewise. * ptr_chck.c [!THREADS] (GC_on_stack): Likewise. * win32_threads.c [!WOW64_THREAD_CONTEXT_WORKAROUND] (GC_push_stack_for): Likewise.
…tr_t (refactoring) Issue #627 (bdwgc). * backgraph.c (add_back_edges): Rename current local variable to q. * mark.c (GC_mark_from): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * backgraph.c (add_back_edges): Change type of q local variable from word to ptr_t. * finalize.c (GC_ignore_self_finalize_mark_proc): Likewise. * mark.c (GC_mark_from): Likewise. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * include/private/gc_pmark.h (GC_mark_and_push_stack): Do not case p argument to ptr_t. * include/private/gc_pmark.h (GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Cast p argument to word. * include/private/gc_pmark.h [NEED_FIXUP_POINTER] (GC_PUSH_ONE_STACK): Change type of pp local variable from word to ptr_t. * include/private/gc_priv.h [E2K && __ptr64__] (LOAD_TAGGED_VALUE): Change type of val local variable from word to ptr_t. * include/private/gc_priv.h [!E2K] (LOAD_TAGGED_VALUE): Cast p argument to ptr_t* instead of word*. * include/private/gcconfig.h [!FIXUP_POINTER && (DYNAMIC_POINTER_MASK || POINTER_MASK)] (FIXUP_POINTER): Expect p argument is of ptr_t type (instead of word); add comment. * mark.c [!SMALL_CONFIG && !USE_PTR_HWTAG] (GC_mark_from): Change type of deferred local variable from word to ptr_t. * mark.c [AMIGA || MACOS || GC_DARWIN_THREADS] (GC_push_one): Cast p argument to ptr_t. * mark.c [GC_WIN32_THREADS] (GC_push_many_regs): Cast regs[i] to ptr_t. * mark.c [!SMALL_CONFIG && !USE_MARK_BYTES && !MARK_BIT_PER_OBJ] (PUSH_GRANULE): Change type of qcontents from word to ptr_t. * mark.c [USE_PUSH_MARKED_ACCELERATORS] (GC_push_marked1): Change type of p, plim, q from word* to ptr_t*; cast h to ptr_t instead of word; adjust code indentation (and reformat comment). * mark.c [USE_PUSH_MARKED_ACCELERATORS && !UNALIGNED_PTRS] (GC_push_marked2): Likewise. * mark.c [USE_PUSH_MARKED_ACCELERATORS && !UNALIGNED_PTRS && GC_GRANULE_WORDS<4] (GC_push_marked4): Likewise.
(refactoring) Issue #627 (bdwgc). Also, for gcc (and clang), do not cast pointers to words in relative comparisons. * allchblk.c (GC_dump_regions, find_nonbl_hblk, drop_hblk_in_chunks): Use ADDR_LT() and ADDR_GE(). * alloc.c (GC_add_to_heap, GC_print_heap_sects, GC_scratch_recycle_inner, 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_stack_range_for, 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 [USE_PROC_FOR_LIBRARIES] (sort_heap_sects): Likewise. * dyn_load.c (GC_register_map_entries, GC_register_dynlib_callback, GC_register_dynamic_libraries_dl_iterate_phdr): Likewise. * dyn_load.c [ANY_MSWIN] (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 (GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP, GC_mark_stack_empty): Likewise. * include/private/gc_priv.h (HOTTER_THAN): Likewise. * malloc.c (GC_malloc_kind_aligned_global): 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_custom_push_range, GC_custom_push_proc, GC_push_proc, GC_push_all_eager, GC_push_all_stack, GC_push_marked2, GC_push_marked4, GC_push_marked, GC_push_unconditionally, GC_block_was_dirty): Likewise. * mark_rts.c (GC_add_roots_inner, GC_add_roots_inner, GC_remove_roots, GC_remove_roots_inner, GC_next_exclusion, GC_exclude_static_roots_inner, GC_push_conditional_with_exclusions, GC_push_current_stack): Likewise. * misc.c (GC_base): 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_text_mapping, GC_init_linux_data_start, tiny_sbrk, GC_skip_hole_openbsd, GC_find_limit_with_bound, GC_least_described_address, GC_register_root_section, GC_FreeBSDGetDataStart, GC_register_data_segments, GC_unmap_start, GC_gww_read_dirty, GC_protect_heap, GC_proc_read_dirty, soft_set_grungy_pages, GC_remove_protection, GC_print_callers): Likewise. * pthread_stop_world.c (GC_push_all_stacks): Likewise. * pthread_support.c [USE_PROC_FOR_LIBRARIES] (GC_segment_is_thread_stack): Likewise. * pthread_support.c [(HAVE_PTHREAD_ATTR_GET_NP || HAVE_PTHREAD_GETATTR_NP) && IA64] (GC_greatest_stack_base_below): Likewise. * ptr_chck.c (GC_same_obj, GC_is_valid_displacement): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * win32_threads.c (GC_push_stack_for): Likewise. * alloc.c (GC_add_to_heap): Rename p argument to h; update comment; change type of endp, hs_start, hs_end local variables from word to ptr_t. * alloc.c [GC_ASSERTIONS] (GC_add_to_heap): Use ADDR_INSIDE(). * dyn_load.c (GC_register_dynlib_callback): Likewise. * malloc.c [REDIRECT_MALLOC && !REDIRECT_MALLOC_IN_HEADER] (malloc, free): Likewise. * mark.c (GC_mark_from): Likewise. * mark_rts.c (GC_is_static_root, GC_remove_roots_inner): Likewise. * os_dep.c (GC_enclosing_writable_mapping, GC_page_was_dirty, GC_remove_protection): Likewise. * pthread_support.c [USE_PROC_FOR_LIBRARIES && STACK_GROWS_UP] (GC_segment_is_thread_stack): Likewise. * ptr_chck.c (GC_same_obj): Likewise. * win32_threads.c (GC_push_stack_for): Likewise. * blacklst.c (GC_unpromote_black_lists, GC_add_to_black_list_stack, GC_is_black_listed, GC_number_stack_black_listed): Remove unneeded cast of PHT_HASH() argument. * checksums.c (GC_checksum): Change while() loop to for() one. * checksums.c (GC_check_dirty): Remove goto label. * ptr_chck.c (GC_same_obj, GC_is_valid_displacement): Likewise. * dbg_mlc.c (GC_check_heap_block): Change type of p, plim local variables from char* to ptr_t. * dyn_load.c [ANY_MSWIN] (GC_cond_add_roots): Change type of curr_base, next_stack_lo, next_stack_hi local variables from char* to ptr_t. * include/gc/gc.h (GC_ADDR_LT): New public macro. * include/gc/gc.h [__GNUC__] (GC_ADDR_LT): Do not cast arguments to GC_word. * include/gc/gc.h [__CYGWIN32__ || __CYGWIN__] (GC_DATASTART, GC_DATAEND): Use GC_ADDR_LT(). * include/gc/gc_mark.h (GC_MARK_AND_PUSH): Likewise. * tests/gctest.c [!VERY_SMALL_CONFIG] (cons): Likewise. * include/private/gc_priv.h (ADDR_LT, ADDR_GE, ADDR_INSIDE): New macro. * include/private/gc_priv.h (_GC_arrays._least_real_heap_addr, _GC_arrays._greatest_real_heap_addr): Change type from word to ptr_t. * include/private/gc_priv.h (endGC_arrays): Use beginGC_arrays. * include/private/gc_priv.h (GC_exclude_static_roots_inner): Use ptr_t instead of char* type for arguments. * include/private/gc_priv.h [GC_WIN32_THREADS] (GC_get_next_stack): Likewise. * win32_threads.c (GC_get_next_stack): Likewise. * include/private/gc_priv.h [GC_WIN32_THREADS] (GC_get_next_stack): Move comment from win32_threads.c. * mark.c [ENABLE_TRACE] (GC_mark_from): Declare base local variable to avoid computing GC_base() twice. * mark_rts.c (GC_exclude_static_roots_inner): Change type of arguments from void* to ptr_t. * mark_rts.c (GC_push_conditional_with_exclusions): Change code to avoid assignment inside a conditional expression. * os_dep.c [ECOS] (ecos_gc_brk): Change type from char* to ptr_t. * os_dep.c [MSWIN32] (GC_least_described_address): Change type of limit, q local variables from LPVOID to ptr_t. * os_dep.c [MSWIN32] (GC_register_root_section): Change type of p, base, limit local variables from LPVOID and char* to ptr_t. * os_dep.c [GWW_VDB] (GC_gww_read_dirty): Change type of h_end local variable from struct hblk* to ptr_t. * os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_remove_protection): Likewise. * os_dep.c [MPROTECT_VDB] (GC_protect_heap): Change type of limit local variable from struct hblk* to ptr_t. * os_dep.c [SOFT_VDB] (soft_set_grungy_pages): Change type of vaddr, limit_buf, next_vaddr local variables from word to ptr_t. * pthread_support.c (ADDR_INSIDE_OBJ): New macro. * pthread_support.c [GC_ASSERTIONS && THREAD_LOCAL_ALLOC] (GC_is_thread_tsd_valid): Use ADDR_INSIDE_OBJ(). * pthread_support.c [USE_PROC_FOR_LIBRARIES] (GC_segment_is_thread_stack): Replace crtn local variable to stack_end. * pthread_support.c [(HAVE_PTHREAD_ATTR_GET_NP || HAVE_PTHREAD_GETATTR_NP) && IA64] (GC_greatest_stack_base_below): Likewise. * win32_threads.c (GC_get_next_stack): Change type of current_min local variable from char* to ptr_t.
…ze_t Issue #627 (bdwgc). * include/gc/gc.h [GC_THREADS] (GC_register_altstack): Change type of normstack_size and altstack_size arguments from GC_word to size_t. * pthread_support.c [!GC_WIN32_THREADS] (GC_register_altstack): Likewise. * include/private/pthread_support.h [!GC_WIN32_THREADS] (GC_StackContext_Rep): Reorder normstack and altstack_size fields. * include/private/pthread_support.h [!GC_WIN32_THREADS] (GC_StackContext_Rep.altstack_size, GC_StackContext_Rep.normstack): Change type from word to size_t.
(refactoring) Issue #627 (bdwgc). * tests/gctest.c (live_indicators): Change type from GC_word[] to void*[]; do not define if GC_NO_FINALIZATION. * tests/gctest.c (MAX_FINALIZED_PER_THREAD, MAX_FINALIZED): Do not define if GC_NO_FINALIZATION. * tests/gctest.c [MACOS] (mktree): Do not set if GC_NO_FINALIZATION. * tests/gctest.c [!GC_NO_FINALIZATION] (mktree): Remove redundant casts to void** of &live_indicators[my_index].
(fix of commit e37ab2a) Issue #627 (bdwgc). * reclaim.c (GC_clear_block, GC_start_reclaim): Use ADDR_LT(). * win32_threads.c (GC_push_stack_for): Likewise. * reclaim.c (GC_reclaim_clear, GC_reclaim_uninit, GC_reclaim_check, GC_do_enumerate_reachable_objects): Use ADDR_GE(). * reclaim.c [ENABLE_DISCLAIM] (GC_disclaim_and_reclaim): Likewise. * reclaim.c [VALGRIND_TRACKING] (GC_reclaim_block): Likewise. * tests/gctest.c [!VERY_SMALL_CONFIG] (cons): Replace ptr_t to char* casts for GC_ADDR_LT() arguments.
(refactoring) Issue #627 (bdwgc). * allchblk.c (GC_split_block): Reformat comment; rename h argument to hbp; rename n argument to last_hbp; rename nhdr argument to last_hdr. * allchblk.c (GC_split_block): Change (word)p-(word)q to (word)((ptr_t)p-(ptr_t)q). * dbg_mlc.c (GC_debug_free, GC_debug_free_inner, GC_debug_realloc): Likewise. * mark.c (GC_set_mark_bit, GC_clear_mark_bit, GC_is_marked): Likewise. * mark.c (GC_push_all, GC_custom_push_range): Likewise. * ptr_chck.c (GC_is_visible): Likewise. * allchblk.c (GC_allochblk_nth): Rename n argument to index. * allchblk.c (ALIGN_PAD_SZ, GC_allochblk_nth): Use ADDR() instead of a direct cast to word. * alloc.c (GC_set_fl_marks, GC_add_to_heap, GC_scratch_recycle_inner, GC_expand_hp_inner): Likewise. * backgraph.c (ensure_struct, add_edge, reset_back_edge, backwards_height, update_max_height): Likewise. * checksums.c [MPROTECT_VDB] (GC_record_fault): Likewise. * checksums.c (GC_was_faulted): Likewise. * dbg_mlc.c (CROSSES_HBLK, GC_debug_print_heap_obj_proc): Likewise. * dyn_load.c [E2K && __ptr64__] (GC_register_map_entries): Likewise. * dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr, GC_register_dynamic_libraries): Likewise. * finalize.c (HASH3, GC_push_finalizer_structures, GC_register_disappearing_link_inner, GC_general_register_disappearing_link, GC_unregister_disappearing_link): Likewise. * finalize.c [!GC_TOGGLE_REFS_NOT_NEEDED] (GC_process_togglerefs, GC_mark_togglerefs, GC_clear_togglerefs, GC_toggleref_add): Likewise. * finalize.c [!GC_LONG_REFS_NOT_NEEDED] (GC_register_long_link, GC_unregister_long_link): Likewise. * finalize.c [!GC_MOVE_DISAPPEARING_LINK_NOT_NEEDED && GC_ASSERTIONS] (GC_move_disappearing_link_inner): Likewise. * finalize.c [!GC_MOVE_DISAPPEARING_LINK_NOT_NEEDED] (GC_move_disappearing_link): Likewise. * finalize.c [!GC_MOVE_DISAPPEARING_LINK_NOT_NEEDED && !GC_LONG_REFS_NOT_NEEDED] (GC_move_long_link): Likewise. * fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_malloc): Likewise. * headers.c (GC_header_cache_miss, GC_scratch_alloc, GC_install_header, GC_next_block, GC_prev_block): Likewise. * include/private/gc_hdrs.h (HCE, HCE_VALID_FOR, HDR_FROM_BI, IS_FORWARDING_ADDR_OR_NIL): Likewise. * include/private/gc_hdrs.h [!HASH_TL] (BI): Likewise. * include/private/gc_hdrs.h [HASH_TL] (GET_BI): Likewise. * include/private/gc_priv.h (MAKE_COOLER, PHT_HASH): Likewise. * include/private/specific.h (HASH, quick_thread_id): Likewise. * malloc.c (GC_alloc_large, GC_malloc_kind_aligned_global): Likewise. * mark.c (GC_mark_from): Likewise. * mark_rts.c (rt_hash, GC_remove_roots_inner, GC_exclude_static_roots_inner): Likewise. * misc.c [ENABLE_TRACE] (GC_init): Likewise. * os_dep.c (GC_skip_hole_openbsd, GC_find_limit_with_bound, GC_linux_main_stack_base, GC_SysVGetDataStart, GC_register_data_segments, GC_unix_sbrk_get_mem, PAGE_ALIGNED, GC_proc_read_dirty, soft_set_grungy_pages, GC_mprotect_thread, GC_print_callers): Likewise. * pthread_support.c (GC_record_stack_base, GC_thr_init, GC_set_stackbottom): Likewise. * ptr_chck.c (GC_same_obj, GC_is_visible): Likewise. * reclaim.c [USE_MARK_BYTES] (GC_clear_block): Likewise. * specific.c (GC_key_create_inner): Likewise. * thread_local_alloc.c (return_single_freelist, return_freelists, GC_init_thread_local, GC_mark_thread_local_fls_for): Likewise. * typd_mlc.c (GC_add_ext_descriptor): Likewise. * win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND] (GC_push_stack_for): Likewise. * win32_threads.c (GC_thr_init): Likewise. * alloc.c [SET_REAL_HEAP_BOUNDS] (GC_add_to_heap): Use ADDR() instead of ADDR_LT() and ADDR_GE() where one argument is of word type. * alloc.c (GC_expand_hp_inner): Likewise. * backgraph.c (add_back_edges): Likewise. * dbg_mlc.c [ALIGNMENT==1] (GC_get_back_ptr_info): Likewise. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Likewise. * headers.c (GC_scratch_alloc): Likewise. * malloc.c (GC_malloc_kind_aligned_global): Likewise. * mark.c (GC_mark_from, GC_steal_mark_stack): Likewise. * dbg_mlc.c (GC_debug_realloc): Change type of base local variable from void* to ptr_t. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Change type of heap_start, heap_end local variables from word to ptr_t; use ADDR() instead of ADDR_INSIDE() where some arguments of word type. * headers.c (get_index): Remove redundant cast of argument to word. * include/private/gc_pmark.h [ENABLE_TRACE] (TRACE, TRACE_TARGET): Use GC_trace_ptr instead of GC_trace_addr. * include/private/gc_priv.h (ADDR): New macro. * include/private/gc_priv.h (GC_scratch_end_ptr): Rename to GC_scratch_end_addr; update comment. * include/private/gc_priv.h (_GC_arrays._last_heap_addr, _GC_arrays._scratch_end_addr): Change type from ptr_t to word. * include/private/gc_priv.h [GC_ASSERTIONS || MAKE_BACK_GRAPH || INCLUDE_LINUX_THREAD_DESCR || KEEP_BACK_PTRS && ALIGNMENT==1] (_GC_arrays._least_real_heap_addr, _GC_arrays._greatest_real_heap_addr): Likewise. * include/private/gc_priv.h [ENABLE_TRACE] (GC_trace_addr): Rename to GC_trace_ptr. * include/private/specific.h (CACHE_HASH): Rename to TS_CACHE_HASH. * include/private/specific.h (HASH): Rename to TS_HASH. * include/private/specific.h (quick_thread_id): Rename to ts_quick_thread_id. * mark.c (GC_mark_from): Use GC_trace_ptr instead of GC_trace_addr. * mark_rts.c (GC_approx_sp): Change type of sp from volatile word to volatile ptr_t. * misc.c [ENABLE_TRACE] (GC_init): Rename addr local variable to p. * pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Define id_n local variable (of word type); use it instead of (word)id. * specific.c (GC_setspecific, GC_remove_specific_after_fork, GC_slow_getspecific): Use TS_HASH() instead of HASH(). * thread_local_alloc.c (return_single_freelist): Replace while loop to do-while one.
(refactoring) Issue #627 (bdwgc). * allchblk.c [VALGRIND_TRACKING] (GC_free_profiler_hook): Replace GC_noop1((word)p) to NOOP1_PTR(p). * alloc.c [!GC_DISABLE_INCREMENTAL && !NO_CLOCK && CPPCHECK] (GC_timeout_stop_func): Likewise. * alloc.c [GWW_VDB] (GC_add_to_heap): Likewise. * alloc.c [CPPCHECK] (GC_allocobj): Likewise. * backgraph.c [CPPCHECK] (push_in_progress, ensure_struct, add_edge, backwards_height, update_max_height): Likewise. * darwin_stop_world.c [!POWERPC && !ARM32 && !AARCH64 && CPPCHECK] (GC_FindTopOfStack): Likewise. * dyn_load.c [LINUX && !USE_PROC_FOR_LIBRARIES && CPPCHECK && HOST_ANDROID && !GC_DONT_DEFINE_LINK_MAP && !(__ANDROID_API__>=21)] (GC_register_dynamic_libraries): Likewise. * dyn_load.c [DARWIN && LINT2] (GC_init_dyld): Likewise. * include/private/gc_priv.h [E2K && CPPCHECK] (PS_ALLOCA_BUF): Likewise. * mach_dep.c [!HAVE_PUSH_REGS && !EMSCRIPTEN && UNIX_LIKE && !NO_GETCONTEXT && GETCONTEXT_FPU_EXCMASK_BUG && X86_64 && CPPCHECK] (GC_with_callee_saves_pushed): Likewise. * mark.c [CPPCHECK] (GC_signal_mark_stack_overflow, GC_steal_mark_stack): Likewise. * misc.c [CPPCHECK] (GC_default_warn_proc, GC_call_with_gc_active): Likewise. * misc.c [!THREAD && CPPCHECK] (GC_do_blocking_inner): Likewise. * os_dep.c [NEED_PROC_MAPS && LINT2] (GC_get_maps): Likewise. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME) && CPPCHECK && ADDRESS_SANITIZER] (GC_set_and_save_fault_handler): Likewise. * os_dep.c [CPPCHECK] (GC_get_register_stack_base, GC_linux_main_stack_base): Likewise. * os_dep.c [!ANY_MSWIN && (SVR4 || AIX || DGUX) && !PCR && !AO_HAVE_fetch_and_add && CPPCHECK] (GC_SysVGetDataStart): Likewise. * os_dep.c [USE_MUNMAP && (CPPCHECK || LINT2)] (block_unmap_inner, GC_remap): Likewise. * os_dep.c [MPROTECT_VDB && !DARWIN && CPPCHECK && ADDRESS_SANITIZER] (GC_dirty_init): Likewise. * pthread_support.c [CPPCHECK] (GC_call_with_gc_active): Likewise. * specific.c [LINT2] (GC_remove_specific_after_fork): Likewise. * tests/gctest.c [CPPCHECK] (reverse_test_inner, test_long_mult, warn_proc): Likewise. * tests/gctest.c [!NO_TYPED_TEST] (typed_test): Likewise. * tests/gctest.c (run_one_test): Likewise. * win32_threads.c [CPPCHECK] (copy_ptr_regs, GC_win32_start_inner): Likewise. * include/private/gc_priv.h (NOOP1_PTR): New macro.
(replacement of commit 0ca8be5) Issue #627 (bdwgc). GC_noop1_ptr() replaces NOOP1_PTR() and GC_noop1() where used for pointers. * allchblk.c [VALGRIND_TRACKING] (GC_free_profiler_hook): Replace NOOP1_PTR() usage to GC_noop1_ptr() call. * alloc.c [!GC_DISABLE_INCREMENTAL && !NO_CLOCK && CPPCHECK] (GC_timeout_stop_func): Likewise. * alloc.c [GWW_VDB] (GC_add_to_heap): Likewise. * alloc.c [CPPCHECK] (GC_allocobj): Likewise. * backgraph.c [CPPCHECK] (push_in_progress, ensure_struct, add_edge, backwards_height, update_max_height): Likewise. * darwin_stop_world.c [!POWERPC && !ARM32 && !AARCH64 && CPPCHECK] (GC_FindTopOfStack): Likewise. * dyn_load.c [LINUX && !USE_PROC_FOR_LIBRARIES && CPPCHECK && HOST_ANDROID && !GC_DONT_DEFINE_LINK_MAP && !(__ANDROID_API__>=21)] (GC_register_dynamic_libraries): Likewise. * dyn_load.c [DARWIN && LINT2] (GC_init_dyld): Likewise. * include/private/gc_priv.h [E2K && CPPCHECK] (PS_ALLOCA_BUF): Likewise. * mach_dep.c [!HAVE_PUSH_REGS && !EMSCRIPTEN && UNIX_LIKE && !NO_GETCONTEXT && GETCONTEXT_FPU_EXCMASK_BUG && X86_64 && CPPCHECK] (GC_with_callee_saves_pushed): Likewise. * mark.c [CPPCHECK] (GC_signal_mark_stack_overflow, GC_steal_mark_stack): Likewise. * misc.c [CPPCHECK] (GC_default_warn_proc, GC_call_with_gc_active): Likewise. * misc.c [!THREAD && CPPCHECK] (GC_do_blocking_inner): Likewise. * os_dep.c [NEED_PROC_MAPS && LINT2] (GC_get_maps): Likewise. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME) && CPPCHECK && ADDRESS_SANITIZER] (GC_set_and_save_fault_handler): Likewise. * os_dep.c [CPPCHECK] (GC_get_register_stack_base, GC_linux_main_stack_base): Likewise. * os_dep.c [!ANY_MSWIN && (SVR4 || AIX || DGUX) && !PCR && !AO_HAVE_fetch_and_add && CPPCHECK] (GC_SysVGetDataStart): Likewise. * os_dep.c [USE_MUNMAP && (CPPCHECK || LINT2)] (block_unmap_inner, GC_remap): Likewise. * os_dep.c [MPROTECT_VDB && !DARWIN && CPPCHECK && ADDRESS_SANITIZER] (GC_dirty_init): Likewise. * pthread_support.c [CPPCHECK] (GC_call_with_gc_active): Likewise. * specific.c [LINT2] (GC_remove_specific_after_fork): Likewise. * tests/gctest.c [CPPCHECK] (reverse_test_inner, test_long_mult, warn_proc): Likewise. * tests/gctest.c [!NO_TYPED_TEST] (typed_test): Likewise. * tests/gctest.c (run_one_test): Likewise. * win32_threads.c [CPPCHECK] (copy_ptr_regs, GC_win32_start_inner): Likewise. * cord/tests/cordtest.c [CPPCHECK] (test_fn, id_cord_fn): Replace GC_noop1() call to GC_noop1_ptr() one. * finalize.c [GC_ASSERTIONS] (GC_register_disappearing_link_inner, GC_move_disappearing_link_inner): Likewise. * include/gc/gc.h [(!__GNUC__ || __INTEL_COMPILER) && !LINT2] (GC_reachable_here): Likewise. * tests/disclaim.c [CPPCHECK] (misc_sizes_dct, pair_dct): Likewise. * tests/staticroots_lib.c [CPPCHECK] (libsrl_getpelem): Likewise. * tests/threadkey.c [CPPCHECK] (on_thread_exit_inner): Likewise. * tests/weakmap.c [CPPCHECK] (set_mark_bit): Likewise. * dyn_load.c [DARWIN && CPPCHECK] (GC_init_dyld): Call GC_noop1_ptr(dl_handle). * finalize.c (GC_unreachable_finalize_mark_proc): Mention GC_noop1_ptr instead of GC_noop1 in comment. * include/gc/gc.h [(!__GNUC__ || __INTEL_COMPILER) && LINT2] (GC_reachable_here): Refine comment. * include/gc/gc.h (GC_noop1): Improve comment. * include/gc/gc.h (GC_noop1_ptr): New API function declaration. * include/private/gc_priv.h (NOOP1_PTR): Remove macro. * mark.c (GC_noop1_ptr): Implement.
(refactoring) Issue #627 (bdwgc). * backgraph.c (add_edge): Use ADDR() for COVERT_DATAFLOW() argument. * dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES || HAVE_DL_ITERATE_PHDR] (GC_FirstDLOpenedLinkMap): Likewise. * dyn_load.c [!USE_PROC_FOR_LIBRARIES && HAVE_DL_ITERATE_PHDR] (GC_register_main_static_data): Likewise. * mach_dep.c (GC_with_callee_saves_pushed): Likewise. * misc.c [!ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED && !ASM_CLEAR_CODE && !CPPCHECK] (GC_clear_stack_inner): Likewise. * misc.c (GC_call_with_stack_base): Likewise. * misc.c [!THREADS] (GC_call_with_gc_active): Likewise. * os_dep.c [SEARCH_FOR_DATA_START] (GC_init_linux_data_start): Likewise. * os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG] (GC_print_callers): Likewise. * pthread_support.c (GC_call_with_gc_active): Likewise. * include/private/gc_priv.h (TRUSTED_STRING): Use COVERT_DATAFLOW_P(p) instead of COVERT_DATAFLOW(p); remove cast to char*. * misc.c [!THREADS] (GC_call_with_gc_active): Likewise. * pthread_support.c [GC_PTHREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2] (GC_pthread_join, GC_pthread_detach): Likewise. * include/private/gcconfig.h (COVERT_DATAFLOW): Move definition down (to be somewhere after CPP_WORDSZ definition). * include/private/gcconfig.h (COVERT_DATAFLOW_P): Define macro.
Issue #627 (bdwgc). * cord/cordprnt.c (CORD_vsprintf): Compare len (instead of res) to buf; cast len and buf values to GC_uintptr_t instead of casting res to word and then to char*. * cord/cordxtra.c (CORD_nul_func, CORD_chars, refill_cache, CORD_lf_func): Cast between pointer and char thru GC_uintptr_t instead of word. * include/private/dbg_mlc.h (MARKED_FOR_FINALIZATION, MARKED_FROM_REGISTER, NOT_MARKED): Likewise. * cord/tests/cordtest.c (test_fn, test_cord_x1, test_cord_x2): Likewise. * dbg_mlc.c (GC_has_other_debug_info, GC_store_debug_info_inner, GC_check_annotated_obj): Cast body, sz to GC_uintptr_t (instead of word); cast base/ohdr to GC_uintptr_t* instead of word*. * dbg_mlc.c (GC_print_backtrace): Remove out label; adjust indentation. * dbg_mlc.c (GET_OH_LINENUM): Add missing parentheses. * include/gc/gc.h (GC_PRE_INCR3, GC_POST_INCR3): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_print_smashed_obj): Rename clobbered_addr argument to clobbered; reformat comment. * dbg_mlc.c (GC_FREED_MEM_MARKER): Move definition to dbg_mlc.h. * dbg_mlc.c (GC_debug_free): Cast sz and GC_size(base) to GC_uintptr_t; cast p to GC_uintptr_t* instead of word*. * dbg_mlc.c (GC_check_leaked): Cast base to GC_uintptr_t* instead of word*. * include/private/dbg_mlc.h [(KEEP_BACK_PTRS || MAKE_BACK_GRAPH) && !(PARALLEL_MARK || KEEP_BACK_PTRS)] (GC_HAS_DEBUG_INFO): Likewise. * dbg_mlc.c (GC_debug_invoke_finalizer): Change "fns" to "function" in comment. * dbg_mlc.c (store_old, GC_debug_register_finalizer, GC_debug_register_finalizer_no_order, GC_debug_register_finalizer_unreachable, GC_debug_register_finalizer_ignore_self): Store NULL (instead of 0) to *ocd. * gc.man (.TH): Update date. * gc.man (GC_set_warn_proc): Change arg type from GC_word to GC_uintptr_t. * include/gc/gc.h (GC_warn_proc, GC_ignore_warn_proc): Likewise. * misc.c (GC_default_warn_proc, GC_ignore_warn_proc): Likewise. * tests/cpp.cc (warn_proc): Likewise. * gcj_mlc.c (GC_gcj_fake_mark_proc, GC_init_gcj_malloc): Rename FUNCPTR_IS_WORD to FUNCPTR_IS_DATAPTR. * include/private/gc_priv.h (FUNCPTR_IS_WORD): Likewise. * misc.c [!CPPCHECK] (GC_init): Likewise. * pthread_support.c [GC_PTHREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && DEBUG_THREADS] (GC_start_rtn_prepare_thread): Likewise. * include/gc/gc.h (GC_uintptr_t): Define unconditionally; move definition to the beginning of the file. * include/gc/gc.h (GC_general_register_disappearing_link, GC_malloc_many): Refine comment. * include/private/gc_priv.h (GC_PUSH_ALL_SYM): Likewise. * include/gc/gc.h (GC_hidden_pointer): Change type from GC_word to GC_uintptr_t. * include/private/gc_priv.h (GC_funcptr_uint): Likewise. * include/private/dbg_mlc.h (GC_FREED_MEM_MARKER, START_FLAG, END_FLAG): Cast to GC_uintptr_t instead of word. * include/private/dbg_mlc.h [ALIGNMENT==1] (HIDE_BACK_PTR): Likewise. * include/private/dbg_mlc.h (oh): Remove oh_dummy field; make oh_back_ptr and oh_bg_ptr field either present both or not; refine comment. * include/private/dbg_mlc.h [!SHORT_DBG_HDRS] (oh.oh_sz, oh.oh_sf): Change type from word to GC_uintptr_t. * include/private/gc_priv.h (GC_ASSERT): Move definition upper (to be right after include gc_locks.h). * include/private/gc_priv.h (WARN): Cast arg to GC_uintptr_t instead of word. * include/private/gc_priv.h (WARN_PRIdPTR): Change comment to TODO item. * mallocx.c [_FORTIFY_SOURCE && __GNUC__ && !__clang__] (GC_realloc): Change type of cleared_p local variable from word to GC_uintptr_t; reformat comment. * mallocx.c [!_FORTIFY_SOURCE || !__GNUC__ || __clang__] (GC_realloc): Define cleared_p as a macro (and undefine it at the end of function). * misc.c [!CPPCHECK] (GC_init): Change ptr_t to ptrdiff_t in comparison to sizeof word. * misc.c [!CPPCHECK && FUNCPTR_IS_DATAPTR] (GC_init): Change word to ptr_t in comparison to sizeof GC_funcptr_uint. * misc.c [!CPPCHECK] (GC_init): Add assertion that size of GC_uintptr_t matches size of ptr_t. * pthread_support.c [E2K] (GC_record_stack_base, GC_set_stackbottom): Cast sb->reg_base to GC_uintptr_t instead of ADDR() usage. * pthread_support.c [E2K] (GC_get_my_stackbottom): Cast crtn->ps_ofs to GC_uintptr_t instead of word; add comment. * tests/cpp.cc (Disguise): Change type or result from GC_word to GC_uintptr_t. * tests/cpp.cc (Undisguise): Rename i argument to v and change its type from GC_word to GC_uintptr_t. * tests/cpp.cc (main): Change type of as, bs local variables from GC_word[] to GC_uintptr_t[]. * tests/cpp.cc (INT_TO_SEXPR, SEXPR_TO_INT): Rename argument; cast thru GC_uintptr_t instead of GC_word. * tests/cpp.cc [TEST_WITH_SYSTEM_MALLOC] (reverse): Cast TEST_WITH_SYSTEM_MALLOC() result to GC_word. * tests/cpp.cc (reverse_test_inner, finalizer, mktree): Cast between pointer and int thru GC_uintptr_t instead GC_word. * thread_local_alloc.c (return_freelists, GC_init_thread_local): Likewise. * tests/cpp.cc (warn_proc): Rename argument from p to arg; remove cast of arg to unsigned long.
Issue #627 (bdwgc). * dbg_mlc.c (GC_debug_ptr_store_and_dirty): Use GC_CAST_AWAY_CONST_PVOID() instead of explicit cast to word and then to void*. * include/gc/gc.h (GC_GENERAL_REGISTER_DISAPPEARING_LINK_SAFE, GC_REGISTER_LONG_LINK_SAFE): Likewise. * include/private/gc_priv.h (GC_base_C): Likewise. * specific.c (GC_key_create_inner): Likewise. * include/gc/gc.h (include/gc/gc.h): New public macro.
(refactoring) Issue #627 (bdwgc). * alloc.c (GC_clear_a_few_frames): Use CAST_AWAY_VOLATILE_PVOID() instead of a direct no-volatile cast. * mach_dep.c (GC_with_callee_saves_pushed): Likewise. * misc.c (GC_clear_stack, GC_clear_stack_inner): Likewise. * os_dep.c [!ANY_MSWIN && (SVR4 || AIX || DGUX)] (GC_SysVGetDataStart): Likewise. * os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_read_dirty): Likewise. * specific.c (GC_setspecific): Likewise. * win32_threads.c (GC_start_world): Likewise. * gcj_mlc.c [FUNCPTR_IS_DATAPTR] (GC_init_gcj_malloc): Use CAST_THRU_UINTPTR(). * include/private/gc_priv.h (NONNULL_ARG_NOT_NULL): Likewise. * mark.c (GC_push_marked): Likewise. * os_dep.c [GWW_VDB && MSWINRT_FLAVOR && FUNCPTR_IS_DATAPTR] (detect_GetWriteWatch): Likewise. * pthread_support.c [GC_PTHREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && DEBUG_THREADS && FUNCPTR_IS_DATAPTR] (GC_start_rtn_prepare_thread): Likewise. * tests/gctest.c (reverse_test_inner): Likewise. * win32_threads.c [((!HAVE_PTHREAD_SETNAME_NP_WITH_TID && !MSWINCE && PARALLEL_MARK) || WOW64_THREAD_CONTEXT_WORKAROUND) && MSWINRT_FLAVOR && FUNCPTR_IS_DATAPTR] (GC_thr_init): Likewise. * include/private/gc_priv.h (CAST_THRU_UINTPTR, CAST_AWAY_VOLATILE_PVOID): New macro. * pthread_support.c [GC_USE_DLOPEN_WRAP] (TYPED_DLSYM): Likewise. * pthread_support.c [GC_USE_DLOPEN_WRAP] (GC_init_real_syms): Use TYPED_DLSYM().
(fix of commit 0ca8be5) Issue #627 (bdwgc). * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME) && CPPCHECK && ADDRESS_SANITIZER] (GC_set_and_save_fault_handler): Use GC_noop1((word)(GC_funcptr_uint)&fn) instead of GC_noop1_ptr(&fn). * os_dep.c [MPROTECT_VDB && !DARWIN && CPPCHECK && ADDRESS_SANITIZER] (GC_dirty_init): Likewise.
Issue #627 (bdwgc). GC_return_addr_t is a type to hold a function return address (pointer). Never used for calling a function. * dbg_mlc.c [GC_ADD_CALLER && HAVE_DLADDR && GC_HAVE_RETURN_ADDR_PARENT] (GC_caller_func_offset): Define if macro unless FUNCPTR_IS_DATAPTR. * dbg_mlc.c [GC_ADD_CALLER && HAVE_DLADDR && FUNCPTR_IS_DATAPTR && GC_HAVE_RETURN_ADDR_PARENT] (GC_caller_func_offset): Rename ad to ra an change its type from word to GC_return_addr_t; replace char* casts to ptr_t ones. * include/gc/gc.h [(GC_CAN_SAVE_CALL_STACKS || GC_ADD_CALLER) && !GC_RETURN_ADDR_T_DEFINED] (GC_return_addr_t): New type. * include/gc/gc.h [(GC_CAN_SAVE_CALL_STACKS || GC_ADD_CALLER) && !GC_RETURN_ADDR_T_DEFINED] (GC_RETURN_ADDR_T_DEFINED): Define macro. * include/gc/gc.h [GC_ADD_CALLER] (GC_EXTRA_PARAMS): Change type of ra from GC_word to GC_return_addr_t. * include/gc/gc_config_macros.h (GC_RETURN_ADDR): Cast to GC_return_addr_t. * include/private/gc_priv.h [NEED_CALLINFO] (callinfo.ci_pc): Change type from word to GC_return_addr_t. * os_dep.c [SAVE_CALL_CHAIN] (GC_save_callers_no_unlock, GC_save_callers): Cast value stored to ci_pc field to GC_return_addr_t instead of word. * os_dep.c [SAVE_CALL_CHAIN] (GC_save_callers): Do not cast fp->fr_arg[i] to signed_word. * os_dep.c [NEED_CALLINFO && GC_HAVE_BUILTIN_BACKTRACE && !GC_BACKTRACE_SYMBOLS_BROKEN] (GC_print_callers): Do not call backtrace_symbols() and free() unless FUNCPTR_IS_DATAPTR.
(fix of commits 1fcf50d, 60634d0) Issue #627 (bdwgc). The error happens if the source is compiled with -D AO_USE_PTHREAD_DEFS. tests/atomicops.c [(GC_BUILTIN_ATOMIC || GC_THREADS) && AO_HAVE_compare_and_swap_release] (main): Do no define cptr variable and do not call GC_cptr_compare_and_swap() unless AO_REQUIRE_CAS.
(refactoring) Issue #627 (bdwgc). * tests/gctest.c (run_one_test): Do not cast &fail_count to GC_word. * tests/gctest.c (run_one_test): Set y to fail_proc1 only if FUNCPTR_IS_DATAPTR and not PCR; use CAST_THRU_UINTPTR() instead of cast of fail_count to GC_word. * tests/gctest.c [GC_PTHREADS] (main): Do not cast &atomic_count to GC_word.
Issue #627 (bdwgc). * include/gc/gc_typed.h (GC_CALLOC_TYPED_DESCR_PTRS): New macro. * include/gc/gc_typed.h (GC_CALLOC_TYPED_DESCR_WORDS): Add comment (that the value is the number of both "normal" and "pointer-sized" words). * include/gc/gc_typed.h [!GC_BUILD] (GC_calloc_typed_descr_s.opaque_p): New field. * include/gc/gc_typed.h [!GC_BUILD] (GC_calloc_typed_descr_s.opaque): Change elements count from GC_CALLOC_TYPED_DESCR_WORDS to GC_CALLOC_TYPED_DESCR_WORDS-GC_CALLOC_TYPED_DESCR_PTRS. * typd_mlc.c (GC_calloc_typed_descr_s): Move complex_d field upper to be the first field. * typd_mlc.c (GC_calloc_prepare_explicitly_typed): Update static assert about size of GC_calloc_typed_descr_s to use both GC_CALLOC_TYPED_DESCR_WORDS and GC_CALLOC_TYPED_DESCR_PTRS.
…llers (fix of commit b2552e0) Issue #627 (bdwgc). * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS == 0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC && THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Use CAST_THRU_UINTPTR() to set info[0].ci_pc. * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS == 0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC] (GC_save_callers): Likewise.
(refactoring) Issue #627 (bdwgc). This is to reduce code duplication between GC_next_block, GC_prev_block and GC_apply_to_all_blocks. * headers.c (HBLK_ADDR): New macro. * headers.c (GC_apply_to_all_blocks): Move j local variable to the nested block; rename index_p local variable to bi; use ADDR() for hhdr. * headers.c (GC_apply_to_all_blocks, ): Use HBLK_ADDR(). * headers.c (GC_next_block): Change while() outermost loop to for().
(a cherry-pick of commits ab69d29, d8ecfa3, c81f06e, 8c8c740, 403baec, 71cc392 partly from capablevms/bdwgc) Issue #627 (bdwgc). Original capability should be used to reclaim memory (and during explicit object free) rather than a computed integer value for the capability systems. * allchblk.c (GC_get_first_part): Set rest_hdr->hb_block value (i.e., add hblk pointer within header during re-allocation of GC'd memory). * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_check_heap_block): Add assertion that p is equal to hhdr->hb_block. * headers.c (GC_apply_to_all_blocks): Pass hhdr->hb_block (instead of HBLK_ADDR(bi,j)) to fn(). * headers.c (GC_apply_to_all_blocks, GC_next_block): Add assertion that HBLK_ADDR(bi,j) is equal to ADDR(hhdr->hb_block). * headers.c (GC_next_block): Return hhdr->hb_block instead of HBLK_ADDR(bi,j). * headers.c (GC_prev_block): Add TODO item to return hhdr->hb_block and add the corresponding assertion (as in GC_next_block). * malloc.c (free_internal): Pass hhdr->hb_block (instead of HBLKPTR(p)) to GC_freehblk(); add assertion that ADDR(HBLKPTR(p)) is equal to ADDR(hhdr->hb_block). * reclaim.c (GC_reclaim_small_nonempty_block, GC_reclaim_block): Add assertion that hbp is equal to hhdr->hb_block. Co-authored-by: Ivan Maidanski <[email protected]>
Current status: I've done a lot of refactoring to simplify porting to CHERI, and backported some changes from https://github.com/capablevms/bdwgc/ (see c29365b). Still many CHERI-specific changes to be backported. |
And below is the list of code places worth attention during enabling of CHERI in master:
|
A number of changes are not ported yet (as of commit 7f1503d), here's a diff:
|
…CHERI (fix of commit 433e2dd) Issue #627 (bdwgc). * include/gc/gc_typed.h [!GC_BUILD] (GC_calloc_typed_descr_s): First define it as a macro (referring to GC_calloc_typed_descr_opaque_s). * include/gc/gc_typed.h (GC_calloc_typed_descr_s): Undefine (after definition of struct GC_calloc_typed_descr_s. * typd_mlc.c (GC_calloc_prepare_explicitly_typed): Compare sizeof GC_calloc_typed_descr_s to that of GC_calloc_typed_descr_opaque_s in static assert (instead of computing the struct size using GC_CALLOC_TYPED_DESCR_PTRS and GC_CALLOC_TYPED_DESCR_WORDS).
(a cherry-pick of commits 8120c8b, 4f431ac partly from capablevms/bdwgc) Issue #627 (bdwgc). Changes specific to CHERI capability systems are conditionally compiled using the macro __CHERI_PURE_CAPABILITY__. * include/gc/gc.h [_UINTPTR_T_DECLARED && !__MSYS__] (GC_uintptr_t): Define to uintptr_t. * include/gc/gc.h [__GNUC__ && !__INTEL_COMPILER && __CHERI_PURE_CAPABILITY__] (GC_reachable_here): Use "g" constraint instead of "X". * include/gc/gc_config_macros.h [__GNUC__ && __CHERI_PURE_CAPABILITY__]: Include stdint.h; reformat comment. * include/gc/gc_tiny_fl.h [!GC_GRANULE_BYTES && __CHERI_PURE_CAPABILITY__] (GC_GRANULE_PTRS): Define to 1 (instead of 2). * include/private/gcconfig.h [__CHERI_PURE_CAPABILITY__ && USE_MMAP] (USE_MUNMAP): Undefine; add TODO item. * include/private/gcconfig.h [!CPP_PTRSZ && __CHERI_PURE_CAPABILITY__] (CPP_PTRSZ): Define to __SIZEOF_POINTER__*8 instead of CPP_WORDSZ. Co-authored-by: Ivan Maidanski <[email protected]>
As of commit e1fb227, bdwgc could be built using:
All tests fail currently, because of missing some patches from https://github.com/capablevms/bdwgc |
Note: some suppressed warnings could be eliminated by modifying GC_CAST_AWAY_CONST_PVOID() and CAST_THRU_UINTPTR() - remove intermediate GC_uintptr_t if |
(fix of commits 42c770a, 176d640) Issue #627 (bdwgc). * darwin_stop_world.c (StackFrame): Remove reserved, savedRTOC fields (these are unused trailing ones). * darwin_stop_world.c (GC_FindTopOfStack): Use MAKE_CPTR() for stack_start and frame->savedSP; compare frame to NULL instead of stack_start to zero. * darwin_stop_world.c [CPPCHECK] (GC_FindTopOfStack): Call GC_noop1(frame->savedCR) (to make a dummy use of the field). * dyn_load.c (GC_FirstDLOpenedLinkMap): Use MAKE_CPTR() for dp->d_un.d_ptr. * dyn_load.c (GC_register_dynamic_libraries): Replace char* to ptr_t; use ADDR() for e. * dyn_load.c (GC_register_dynamic_libraries, GC_register_dynlib_callback): Use MAKE_CPTR() for p->p_vaddr. * dyn_load.c [AIX] (GC_register_dynamic_libraries): Replace while() loop with a for(;;) one; cast ldi->ldinfo_dataorg to ptr_t instead of use of MAKE_CPTR(). * dyn_load.c [DARWIN] (dyld_section_add_del): Change type of start, end local variables from unsigned long to ptr_t; use MAKE_CPTR() for slide+sec->addr. * headers.c (GC_prev_block): Use MAKE_CPTR() for HBLK_ADDR(bi,j). * include/private/gc_priv.h (HBLKDISPL): Use ADDR(). * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && (NARGS!=0 || NFRAMES%2!=0 || !GC_HAVE_BUILTIN_BACKTRACE) && (I386 || SPARC)] (GC_save_callers): Cast frame->FR_SAVFP to ptr_t instead of long; use MAKE_CPTR() for fp->fr_arg[i]. * os_dep.c [NEED_CALLINFO] (GC_print_callers): Use ADDR() for info[i].ci_pc. * pthread_support.c [GC_PTHREADS_PARAMARK && GC_ASSERTIONS && GC_WIN32_THREADS && !USE_PTHREAD_LOCKS] (NUMERIC_THREAD_ID): Use ADDR() for GC_PTHREAD_PTRVAL(id); refine comment.
(refactoring) Issue #627 (bdwgc). Convert an unsigned value to a void pointer. Typically used to print a numeric value using "%p" format specifier. The pointer is not supposed to be dereferenced. * headers.c (GC_install_counts): Use NUMERIC_TO_VPTR(). * include/private/dbg_mlc.h [KEEP_BACK_PTRS || PRINT_BLACK_LIST] (MARKED_FOR_FINALIZATION, MARKED_FROM_REGISTER, NOT_MARKED): Likewise. * misc.c [E2K] (GC_call_with_stack_base): Likewise. * pthread_stop_world.c [NACL] (GC_suspend_all): Likewise. * pthread_support.c [PARALLEL_MARK && HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG] (set_marker_thread_name): Likewise. * pthread_support.c [GC_PTHREADS_PARAMARK] (GC_start_mark_threads_inner): Likewise. * pthread_support.c [E2K] (GC_get_my_stackbottom): Likewise. * reclaim.c (GC_start_reclaim): Likewise. * tests/gctest.c (INT_TO_SEXPR, reverse_test_inner, typed_test): Likewise. * thread_local_alloc.c (return_freelists, GC_init_thread_local): Likewise. * win32_threads.c [PARALLEL_MARK && !GC_PTHREADS_PARAMARK] (GC_start_mark_threads_inner): Likewise. * win32_threads.c (GC_win32_start_inner): Likewise. * win32_threads.c [GC_WINMAIN_REDIRECT] (GC_waitForSingleObjectInfinite): Likewise. * include/private/dbg_mlc.h [CPP_WORDSZ!=32] (GC_FREED_MEM_MARKER, START_FLAG, END_FLAG): Add outermost parentheses. * include/private/gc_priv.h (NUMERIC_TO_VPTR): New macro. * pthread_support.c [E2K] (GC_record_stack_base, GC_set_stackbottom): Remove redundant parentheses. * win32_threads.c [CPPCHECK] (GC_use_threads_discovery): Add extra parentheses.
(refactoring) Issue #627 (bdwgc). * include/private/gcconfig.h [GC_PRIVATE_H && !OS2 && (NEXT || DOS4GW || NONSTOP || SOLARIS && !USE_MMAP || RTEMS || EMBOX || KOS || __CC_ARM)] (GET_MEM): Cast calloc() result to ptr_t instead of size_t.
Issue #627 (bdwgc). * include/gc/gc.h [__GNUC__ && __CHERI_PURE_CAPABILITY__] (GC_ADDR_LT): Cast pointers to GC_word before comparison.
Issue #627 (bdwgc). Cast between numeric and pointer through GC_uintptr_t instead of word. * cord/tests/de_win.c [CPPCHECK] (WinMain): Cast a pointer to word through GC_uintptr_t. * include/gc/gc.h [!__GNUC__ || __CHERI_PURE_CAPABILITY__] (GC_ADDR_LT): Likewise. * include/gc/gc_cpp.h (gc_cleanup::cleanup): Likewise. * include/gc/gc_inline.h (GC_FAST_MALLOC_GRANS): Likewise. * include/private/gc_priv.h (ADDR): Likewise. * pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Likewise. * tests/subthreadcreate.c (entry): Likewise. * gcj_mlc.c [FUNCPTR_IS_DATAPTR && CPPCHECK] (GC_gcj_fake_mark_proc): Cast to word through GC_funcptr_uint. * os_dep.c [MPROTECT_VDB && DARWIN && CPPCHECK] (GC_dirty_init): Likewise. * include/gc/gc.h [include/gc/gc.h [] (GC_HIDE_NZ_POINTER): Cast p to intptr_t instead of GC_signed_word. * include/private/gc_hdrs.h (FORWARDED_ADDR): Cast to size_t through GC_uintptr_t. * include/private/gc_locks.h [GC_PTHREADS && !GC_WIN32_PTHREADS] (NUMERIC_THREAD_ID): Cast to unsigned long through GC_uintptr_t. * include/private/gc_priv.h (NUMERIC_TO_VPTR, MAKE_CPTR): Cast to pointer through GC_uintptr_t. * include/private/gcconfig.h [I386 && DGUX] (MAP_FAILED): Likewise. * pthread_stop_world.c (GC_suspend_all, GC_restart_all): Likewise. * tests/staticroots.c (root_nz): Likewise. * tests/staticroots_lib.c (root_nz): Likewise. * tests/subthreadcreate.c (main): Likewise. * include/private/gc_priv.h (CPTR_CLEAR_FLAGS, CPTR_SET_FLAGS): Cast pointer to GC_uintptr_t instead of word. * include/private/gcconfig.h (PTR_ALIGN_DOWN, PTR_ALIGN_UP): Likewise. * tests/cpp.cc (D::CleanUp): Likewise. * tests/cpp.cc [CPPCHECK] (WinMain): Likewise. * tests/cpp.cc [!CPPCHECK] (main): Likewise. * tests/weakmap.c (IS_FLAG_SET): Likewise. * pthread_support.c [DEBUG_THREADS && !GC_WIN32_PTHREADS] (GC_new_thread, GC_delete_thread, GC_unregister_my_thread_inner, GC_thread_exit_proc): Cast to pointer through GC_uintptr_t instead of signed_word. * tests/gctest.c (SEXPR_TO_INT): Cast pointer to int through GC_uintptr_t instead of GC_word. * tests/initfromthread.c [!GC_PTHREADS] (thread): Cast to DWORD through GC_uintptr_t instead of GC_word. * tests/threadleak.c [!GC_PTHREADS] (test): Likewise. * win32_threads.c (GC_win32_start): Likewise. * win32_threads.c [GC_WINMAIN_REDIRECT] (WinMain): Likewise. * tests/threadkey.c (on_thread_exit): Cast unused result to void.
As of commit 5d619ee, bdwgc could be built using:
Or, using |
1 similar comment
As of commit 5d619ee, bdwgc could be built using:
Or, using |
(refactoring) Issue #627 (bdwgc). * include/private/gcconfig.h (DATASTART, DATAEND): Remove extra parentheses. * include/private/gcconfig.h (DATASTART, HEAP_START, STACKBOTTOM): Use `MAKE_CPTR()`. * include/private/gcconfig.h [OPENBSD && __ELF__] (DATAEND): Remove unneeded "&" operation. * include/private/gcconfig.h [POWERPC && AIX] (STACKBOTTOM, DATASTART, DATAEND): Do not cast pointer through ulong. * include/private/gcconfig.h [POWERPC && AIX] (errno): Do not declare if `__64BIT__` is defined. * include/private/gcconfig.h [I386 && SCO || MIPS && EWS4800] (DATASTART): Use `ADDR()`. * include/private/gcconfig.h [I386 && DJGPP]: Remove commented out `STACKBOTTOM` definition. * include/private/gcconfig.h [ALPHA && OSF1] (STACKBOTTOM): Use `PTR_ALIGN_UP()`. * include/private/gcconfig.h [ALPHA && OSF1] (HEURISTIC2_LIMIT): Use `PTR_ALIGN_DOWN()`.
Issue #627 (bdwgc). * include/private/gc_priv.h (HBLKPTR, HBLK_PAGE_ALIGNED): Cast `objptr` to `ptr_t`. * include/private/gcconfig.h [GC_CLANG_PREREQ(11,0)] (PTR_ALIGN_DOWN): Define using `__builtin_align_down()`; refine comment. * include/private/gcconfig.h [GC_CLANG_PREREQ(11,0)] (PTR_ALIGN_UP): Define using `__builtin_align_up()`. * include/private/gcconfig.h [(M68K || I386) && LINUX && !__ELF__ || I386 && (SEQUENT || HAIKU || SCO || DJGPP) || MIPS && EWS4800 || M88K && CX_UX] (DATASTART): Cast first argument of `PTR_ALIGN_UP()` to `ptr_t`.
GCJ support is not working because it expects granule to be at least twice bigger than pointer currently. Should be fixed by #652. |
The purpose of this is not only support the protected mode but also better test bdwgc.
The patches in https://github.com/capablevms/bdwgc (master) should be useful.
Related issue: #461
The text was updated successfully, but these errors were encountered: