Skip to content
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

Open
ivmai opened this issue Mar 20, 2024 · 0 comments
Open

Support CHERI extension #627

ivmai opened this issue Mar 20, 2024 · 0 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Mar 20, 2024

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

ivmai added a commit that referenced this issue Mar 23, 2024
(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.
ivmai added a commit that referenced this issue Mar 23, 2024
(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.
ivmai added a commit that referenced this issue Mar 23, 2024
(refactoring)

Issue #627 (bdwgc).

* tests/gctest.c (small_cons_uncollectable): Use GC_HIDE_POINTER().
* tests/gctest.c (UNCOLLECTABLE_CDR): Use GC_REVEAL_POINTER().
ivmai added a commit that referenced this issue Apr 15, 2024
(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.
ivmai added a commit that referenced this issue Apr 15, 2024
…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.
ivmai added a commit that referenced this issue Apr 15, 2024
(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.
ivmai added a commit that referenced this issue Apr 15, 2024
…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.
ivmai added a commit that referenced this issue Apr 15, 2024
…pages

(fix of commit e37ab2a)

Issue #627 (bdwgc).

* os_dep.c [SOFT_VDB] (soft_set_grungy_pages): Cast h to ptr_t when
passed to ADDR_LT().
ivmai added a commit that referenced this issue Apr 16, 2024
(fix of commit e37ab2a)

Issue #627 (bdwgc).

* allchblk.c (drop_hblk_in_chunks): Declare limit local variable as
a const pointer.
* mark.c [ENABLE_TRACE] (GC_mark_from): Declare base local variable as
a const pointer.
ivmai added a commit that referenced this issue Apr 16, 2024
(fix of commit e37ab2a)

Issue #627 (bdwgc).

* checksums.c (GC_check_dirty): Move h, start local variables to inner
block statement.
* ptr_chck.c (GC_same_obj): Move h local variable to inner block
statement.
ivmai added a commit that referenced this issue Apr 16, 2024
(fix of commit e37ab2a)

Issue #627 (bdwgc).

* include/gc/gc.h [__CYGWIN32__ || __CYGWIN__] (GC_DATASTART,
GC_DATAEND): Cast GC_ADDR_LT() arguments to char*.
ivmai added a commit that referenced this issue Apr 24, 2024
(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].
ivmai added a commit that referenced this issue Apr 24, 2024
(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.
ivmai added a commit that referenced this issue Apr 24, 2024
(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.
ivmai added a commit that referenced this issue Apr 24, 2024
(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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant