summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add debug logging to GC_clear_exclusion_table and GC_exclude_static_rootsHEADmasterIvan Maidanski2023-05-161-0/+12
| | | | | | * mark_rts.c [DEBUG_ADD_DEL_ROOTS] (GC_clear_exclusion_table, GC_exclude_static_roots_inner): Call GC_log_printf() to report update GC_excl_table[].
* Allow GC_push_roots to work even when no exclusions registeredIvan Maidanski2023-05-161-21/+17
| | | | | | | | | | | | Also, includes minor code refactoring and reformatting of GC_exclude_static_roots_inner and GC_push_conditional_with_exclusions. * mark_rts.c (GC_next_exclusion): Update comment; return NULL if GC_excl_table_entries is zero (instead of assertion violation). * mark_rts.c (GC_exclude_static_roots_inner): Call GC_next_exclusion() unconditionally. * mark_rts.c (GC_push_conditional_with_exclusions): Refactor code to have GC_PUSH_CONDITIONAL() call in a single place.
* Fix GC_excl_table overrun on overflow in GC_exclude_static_rootsIvan Maidanski2023-05-161-7/+9
| | | | | | | | | | | Previously, in case of full GC_excl_table[], an attempt to insert an element to it caused write past end of GC_excl_table (when shifting the tail elements) before aborting cause of the table overflow. * mark_rts.c (GC_exclude_static_roots_inner): Move check of GC_excl_table_entries upper to be before first access to GC_excl_table; move i local variable down to be near place of usage; cast result of next-GC_excl_table to size_t.
* Fix overlapping region assertion in mark_some if malloc redirect on LinuxIvan Maidanski2023-05-162-1/+7
| | | | | | | | | * alloc.c [SET_REAL_HEAP_BOUNDS && INCLUDE_LINUX_THREAD_DESCR] (GC_add_to_heap): If endp is greater than GC_greatest_real_heap_addr then add [p,endp) region to the data roots exclusions; add comment. * include/private/gc_priv.h [INCLUDE_LINUX_THREAD_DESCR] (SET_REAL_HEAP_BOUNDS, GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define.
* Clear GC_thread_key thread-local value on unregistering the threadIvan Maidanski2023-05-152-1/+3
| | | | | | | | * pthread_support.c [THREAD_LOCAL_ALLOC] (GC_unregister_my_thread_inner): Move assertion to GC_destroy_thread_local(). * thread_local_alloc.c (GC_destroy_thread_local): Call GC_setspecific() to clear thread-local value associated with GC_thread_key.
* Fix GC_unregister_my_thread call before GC functions usageIvan Maidanski2023-05-141-5/+4
| | | | | | | | | | | | (fix of commit d7e3062a0) * tests/gctest.c [THREADS] (check_heap_stats): Do not call GC_unregister_my_thread(). * tests/gctest.c [GC_WIN32_THREADS && !GC_PTHREADS] (main): Call GC_unregister_my_thread() just before return. * tests/gctest.c [GC_PTHREADS && !PTW32_STATIC_LIB] (main): Likewise. * tests/gctest.c [GC_PTHREADS && !GC_NO_DLOPEN && !DARWIN && !GC_WIN32_THREADS] (main): Add comment for GC_dlopen argument.
* Make comparisons to the lowest heap boundary strictIvan Maidanski2023-05-138-27/+26
| | | | | | | | | | | | | | | | | | | | | | * alloc.c (GC_expand_hp_inner): Subtract sizeof(word) from new_limit (for the case when comparing to GC_least_plausible_heap_addr). * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Compare current to GC_least_real_heap_addr and GC_greatest_real_heap_addr (instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr). * malloc.c [GC_ASSERTIONS] (GC_malloc_kind_global): Likewise. * include/gc/gc_mark.h (GC_MARK_AND_PUSH): Replace greater-or-equal to strictly greater when comparing to GC_least_plausible_heap_addr. * include/private/gc_pmark.h (GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Likewise. * include/private/gc_priv.h [MAKE_BACK_GRAPH] (SET_REAL_HEAP_BOUNDS, GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define. * mark.c (GC_mark_from, GC_push_all): Add dummy "| GC_DS_LENGTH" when storing length to mse_descr.w. * mark.c (GC_mark_from): Replace greater-or-equal to strictly greater when comparing to least_ha variable. * typd_mlc.c (GC_typed_mark_proc): Likewise. * mark.c [GC_DS_TAGS>ALIGNMENT-1] (GC_push_all): Simplify code to round up length.
* Fix old name (typo) of gc_priv.hIvan Maidanski2023-05-133-4/+4
| | | | | | * blacklst.c: Fix old file name in comment ("gc_priv.h"). * include/private/gcconfig.h: Likewise. * tools/setjmp_t.c (main): Fix old file name in message ("gc_priv.h").
* Fix comparisons to heap boundary in GC_get_back_ptr_info and GC_mark_fromIvan Maidanski2023-05-135-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The region delimited by GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr might contain part of static data roots or stacks (in addition to potential heap expansion areas). Certain comparisons in GC_get_back_ptr_info (when ALIGNMENT is 1) and in GC_mark_from (in assertions) expect the real heap boundaries. * alloc.c [SET_REAL_HEAP_BOUNDS] (GC_add_to_heap): Update GC_least_real_heap_addr and GC_greatest_real_heap_addr variables. * dbg_mlc.c [KEEP_BACK_PTRS && ALIGNMENT == 1] (GC_get_back_ptr_info): Compare alternate_target and target to GC_least_real_heap_addr and GC_greatest_real_heap_addr (instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr). * include/gc/gc_mark.h (GC_greatest_plausible_heap_addr): Refine comment. * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (SET_REAL_HEAP_BOUNDS): Define macro. * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define (as macro). * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (_GC_arrays._least_real_heap_addr, _GC_arrays._greatest_real_heap_addr): New field; add comment. * mark.c (GC_mark_from): Use GC_greatest_real_heap_addr and GC_least_real_heap_addr instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr, respectively, in assertions.
* Fix assertion in GC_mark_from regarding GC_least_plausible_heap_addrIvan Maidanski2023-05-121-5/+6
| | | | | | | (fix of commit b21b53a35) * mark.c (GC_mark_from): Allow current_p (p->mse_start) plus descr to be equal to GC_least_plausible_heap_addr in assertion; add comment.
* Improve ABORT message in GC_darwin_sigbusIvan Maidanski2023-05-101-8/+6
| | | | | | | * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_darwin_sigbus): Refine ABORT message. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_dirty_init): Refine comment ("SIGBUS signals").
* Travis CI: Test single signal usage for world suspend/resume on Ubuntu/x64Ivan Maidanski2023-05-091-1/+1
|
* Allow single signal usage for both world suspend and resume in gctestIvan Maidanski2023-05-091-1/+5
| | | | | | | | | | By default, 2 distinct signals are used for suspend and resume of the world except for platforms where the signal context is not used. * tests/gctest.c [GC_PTHREADS] (main): Move GC_set_suspend_signal() call to be before GC_COND_INIT() one. * tests/gctest.c [GC_PTHREADS && TEST_REUSE_SIG_SUSPEND] (main): Pass value of GC_get_thr_restart_signal() to GC_set_suspend_signal().
* Fix 'AST broken' cppcheck syntax error in GC_init_linux_data_startIvan Maidanski2023-05-081-2/+6
| | | | | | | (fix of commit 2bcec83b6) * include/private/gcconfig.h [(MSWIN32 || MSWINCE) && CPPCHECK] (DATAEND): Do not define to empty.
* Remove code duplication in gcconfig.h for HurdIvan Maidanski2023-05-081-23/+21
| | | | | | | | | (refactoring) * include/private/gcconfig.h [HURD && (I386 || X86_64)] (OS_TYPE, HEURISTIC2, SEARCH_FOR_DATA_START, DATAEND, DYNAMIC_LOADING, USE_MMAP_ANON): Move defintion to common place. * include/private/gcconfig.h [HURD] (MPROTECT_VDB): Add TODO item.
* Support Hurd/x86_64Samuel Thibault2023-05-081-0/+14
| | | | | | | | | * include/private/gcconfig.h [__x86_64__ && __GNU__] (HURD, X86_64, mach_type_known): Define macro. * include/private/gcconfig.h [X86_64 && HURD] (OS_TYPE, HEURISTIC2, SEARCH_FOR_DATA_START, DATAEND, DYNAMIC_LOADING, USE_MMAP_ANON): Likewise. * include/private/gcconfig.h [X86_64 && HURD] (_end): Declare variable.
* Fix 'scope of total_time can be reduced' cppcheck warning in stopped_markIvan Maidanski2023-05-051-3/+3
| | | | | | | (fix of commit 53f132650) * alloc.c [!NO_CLOCK] (GC_stopped_mark): Move total_time and divisor local variables to inner block of their usage.
* Workaround a malfunction of soft-dirty bits clearing on Power9Ivan Maidanski2023-05-041-16/+30
| | | | | | | | | | | | | | | | | | (fix of commit c1bf1b973) Issue #479 (bdwgc). Make a page dirty twice in detect_soft_dirty_supported() clearing all the soft-dirty bits in the middle. If the 2nd write to a page is not noticeable, then fallback to mprotect-based VDB. This a workaround for a bug observed, at least, in Fedora 36 kernel on Power9 CPU. * os_dep.c [SOFT_VDB] (clear_soft_dirty_bits): New static function (move part of code from GC_soft_read_dirty). * os_dep.c [SOFT_VDB] (detect_soft_dirty_supported): Call clear_soft_dirty_bits() and retry changing *vaddr to check whether the latter is reflected in pagemap file; add comment. * os_dep.c [SOFT_VDB] (GC_soft_read_dirty): Call clear_soft_dirty_bits.
* Add API to get total stopped-world marking timeIvan Maidanski2023-05-043-31/+59
| | | | | | | | | | | | | | | | | | | | New public function is GC_get_stopped_mark_total_time(). * alloc.c [!NO_CLOCK] (stopped_mark_total_time, stopped_mark_total_ns_frac): New static variable. * alloc.c [!NO_CLOCK] (GC_get_stopped_mark_total_time): New API function definition. * alloc.c [!NO_CLOCK] (GC_stopped_mark): Define start_time_valid, ns_frac_diff local variables; call GET_TIME() also if measure_performance; add TODO item (about code duplication); update stopped_mark_total_time and stopped_mark_total_ns_frac values. * alloc.c (GC_stopped_mark): Move logging of "Marking for collection" upper to be before GET_TIME(start_time). * include/gc/gc.h (GC_get_full_gc_total_time): Refine documentation. * include/gc/gc.h (GC_get_stopped_mark_total_time): New API prototype. * tests/gctest.c [!NO_CLOCK] (check_heap_stats): Call GC_get_stopped_mark_total_time() to report total stopped-world marking time.
* Do not do unnecessary GC_read_dirty() from GC_enable_incrementalIvan Maidanski2023-05-031-3/+8
| | | | | | | | | * misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS] (GC_enable_incremental): Do not call GC_read_dirty() if GC_bytes_allocd is non-zero. * misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS && !CHECKSUMS] (GC_enable_incremental): Pass TRUE (output_unneeded) to GC_read_dirty().
* More clear message about total duration of full collections in gctestIvan Maidanski2023-05-031-9/+8
| | | | | | * tests/gctest.c [!NO_CLOCK] (check_heap_stats): Print value of GC_get_full_gc_total_time() on a standalone line (and with the proper message).
* Workaround 'condition is always false' cppcheck FP in GC_setpagesizeIvan Maidanski2023-05-031-2/+4
| | | | | | | (fix of commit 3af192338) * os_dep.c [SOFT_VDB] (GC_setpagesize): Do not check that GC_page_size value is a power of two if CPPCHECK.
* Update time statistics about stopped marking even if abandonedIvan Maidanski2023-05-021-53/+41
| | | | | | | | | | | | | | Also, move logging of the message about collection abandoning to the place after the world is resumed. * alloc.c (GC_stopped_mark): Rename i local variable to abandoned_at. * alloc.c [THREADS] (GC_stopped_mark): Remove code duplication regarding GC_world_stopped, GC_on_collection_event and START_WORLD(). * alloc.c [!NO_CLOCK] (GC_stopped_mark): Update world_stopped_total_time and world_stopped_total_divisor even if marking was abandoned. * alloc.c (GC_stopped_mark): Move message about collection abandoning to be after the world is started and GET_TIME(current_time) is called.
* Do not count time spent processing toggle-refs in stopped_markIvan Maidanski2023-05-021-4/+4
| | | | | | | | | Reported world-stopped collection time should not include the time spent in GC_process_togglerefs(). * alloc.c [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED && !NO_CLOCK] (GC_stopped_mark): Call GC_process_togglerefs() before GET_TIME(start_time).
* Do not use integer division in GC_soft_read_dirtyIvan Maidanski2023-05-021-61/+78
| | | | | | | | | | | | | | | | | | An integer division operation might be slow on some CPU architectures. It should be replaced with a shift operation where possible. The SOFT_VDB algorithm used division and multiplication by the page size. * os_dep.c [SOFT_VDB] (GC_log_pagesize): Define STATIC variable. * os_dep.c (GC_setpagesize): Define in a single place (for Win32 and non-Win32 cases). * os_dep.c [SOFT_VDB] (os2_getpagesize): Define pgsize and log_pgsize local variables; compute GC_log_pagesize value. * os_dep.c [SOFT_VDB] (detect_soft_dirty_supported, soft_set_grungy_pages): Check GC_log_pagesize instead of GC_page_size in assertion; use shift by GC_log_pagesize instead of division (and multiplication) by GC_page_size. * os_dep.c [SOFT_VDB] (pagemap_buffered_read): Add assertion that GC_page_size is non-zero.
* Update ChangeLog fileIvan Maidanski2023-04-291-4/+41
|
* Update ChangeLog file (v8.2 changes)Ivan Maidanski2023-04-291-0/+20
|
* Update ChangeLog file (v8.0 changes)Ivan Maidanski2023-04-291-0/+6
|
* Update ChangeLog file (v7.2 - v7.4 changes only)Ivan Maidanski2023-04-291-0/+4
|
* Use THREAD_ID_EQUAL() to compare thread_id_t valuesIvan Maidanski2023-04-281-2/+2
| | | | | | | | | (fix of commits 4240cfb99, 68d419a51) * pthread_support.c [!DONT_USE_ATEXIT] (GC_is_main_thread): Use THREAD_ID_EQUAL() to compare GC_main_thread_id value. * pthread_support.c [!GC_NO_THREADS_DISCOVERY && GC_WIN32_THREADS] (GC_unregister_my_thread): Likewise.
* Fix missing cast of typed calloc result in gctestIvan Maidanski2023-04-271-1/+2
| | | | | | | (fix of commit fef1ce084) * tests/gctest.c [!NO_TYPED_TEST && !GC_DEBUG] (typed_test): Cast result of GC_calloc_do_explicitly_typed() to GC_word* type.
* Fix missing extern C for __asan_default_optionsIvan Maidanski2023-04-271-0/+4
| | | | | | | | | | (fix of commit 84b695d01) Issue #206 (bdwgc). * os_dep.c [ADDRESS_SANITIZER && (UNIX_LIKE || NEED_FIND_LIMIT || MPROTECT_VDB) && !CUSTOM_ASAN_DEF_OPTIONS] (__asan_default_options): Add the declaration wrapped into EXTERN_C_BEGIN.
* Travis CI: Fall back to Focal and Xenial for some builds with TSanIvan Maidanski2023-04-271-4/+5
| | | | This is temporary until Thread sanitizer deadlock issues are resolved.
* Suppress a data race report in debug-related GC_n_set_marksIvan Maidanski2023-04-271-0/+3
| | | | | | | | There could be a race between GC_clear_hdr_marks and GC_n_set_marks but the latter is for a debug purpose. * reclaim.c [USE_MARK_BYTES] (GC_n_set_marks): Add GC_ATTR_NO_SANITIZE_THREAD attribute; update comment.
* Eliminate data race FP between remove_protection and write_fault_handlerIvan Maidanski2023-04-271-1/+17
| | | | | | | | | * os_dep.c [MPROTECT_VDB] (get_pht_entry_from_index_async): Define (as a static function with GC_ATTR_NO_SANITIZE_THREAD or as a macro); add comment. * os_dep.c [!GC_DISABLE_INCREMENTAL && MPROTECT_VDB] (GC_remove_protection): Call get_pht_entry_from_index_async() instead of get_pht_entry_from_index().
* Fix unused GC_parse_version if no SOFT_VDB and no parallel mark on LinuxIvan Maidanski2023-04-262-2/+2
| | | | | | | | | | (fix of commit 6e1b82b0a) * include/private/gc_priv.h [GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Do not declare unless GC_PTHREADS_PARAMARK. * os_dep.c [(!SOFT_VDB || NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK) && GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Do not define unless GC_PTHREADS_PARAMARK.
* New API for more optimal usage of GC_calloc_explicitly_typedIvan Maidanski2023-04-263-18/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the client needs to allocate many typed object arrays of same layout and amount of elements, then "calloc" descriptor could be created once (by GC_calloc_prepare_explicitly_typed) followed by multiple allocations (by GC_calloc_do_explicitly_typed) referring to the same descriptor. * include/gc/gc_typed.h (GC_CALLOC_TYPED_DESCR_WORDS): New macro. * include/gc/gc_typed.h (GC_calloc_typed_descr_s): New struct type. * include/gc/gc_typed.h (GC_calloc_prepare_explicitly_typed, GC_calloc_do_explicitly_typed): New function declaration. * tests/gctest.c [!NO_TYPED_TEST && !GC_DEBUG] (typed_test): Define ctd_l local variable; call GC_calloc_prepare_explicitly_typed() before loop; call GC_calloc_do_explicitly_typed() instead of GC_CALLOC_EXPLICITLY_TYPED(1001). * typd_mlc.c (GC_calloc_typed_descr_s.alloc_lb): Change type from size_t to word. * typd_mlc.c (GC_calloc_typed_descr_s.descr_type): Change type from int to signed_word. * typd_mlc.c (GC_calloc_prepare_explicitly_typed, GC_calloc_do_explicitly_typed): Change from STATIC to GC_API; add ctd_sz argument; check ctd_sz in assertion; add casts for alloc_lb field. * typd_mlc.c (GC_calloc_prepare_explicitly_typed): Add static assertion about size of GC_calloc_typed_descr_s and GC_CALLOC_TYPED_DESCR_WORDS; change return type from void to it. * typd_mlc.c (GC_calloc_explicitly_typed): Pass sizeof(ctd) to GC_calloc_prepare_explicitly_typed(), GC_calloc_do_explicitly_typed().
* Decouple descriptor compute from object alloc in calloc_explicitly_typedIvan Maidanski2023-04-261-36/+70
| | | | | | | | | | | | | | | | | | | (refactoring) This is a preparation for providing ability to the client to compute (and allocate) the internal descriptor of GC_calloc_explicitly_typed once (for the given object layout and elements count) and perform the typed allocation multiple times. * typd_mlc.c (GC_calloc_typed_descr_s): New struct type. * typd_mlc.c (GC_calloc_prepare_explicitly_typed, GC_calloc_do_explicitly_typed): New static function (move part of code from GC_calloc_explicitly_typed); use GC_calloc_typed_descr_s to pass leaf, simple_d, complex_d, alloc_lb, descr_type values between two functions; set and use alloc_lb instead of updating lb local variable. * typd_mlc.c (GC_calloc_explicitly_typed): Use GC_calloc_prepare_explicitly_typed and GC_calloc_do_explicitly_typed. * typd_mlc.c (GC_array_mark_proc): Update comment.
* Invoke GC_oom_fn if GC_make_array_descriptor failed because of no memoryIvan Maidanski2023-04-251-1/+1
| | | | | * typd_mlc.c (GC_calloc_explicitly_typed): If descr_type is NO_MEM then return the result of GC_get_oom_fn()(lb).
* Travis CI: Randomly choose CPU core for tests with AO ops emulationIvan Maidanski2023-04-251-3/+3
|
* Allow to randomly choose a CPU core if AO ops are emulated with locksIvan Maidanski2023-04-251-0/+13
| | | | | | | | | | | | This is needed for test purpose to have all test processes to run on different CPU cores (even if each process occupies just one core). * pthread_support.c [!GC_WIN32_THREADS && BASE_ATOMIC_OPS_EMULATED && SIGNAL_BASED_STOP_WORLD && RANDOM_ONE_CPU_CORE] (GC_thr_init): Define and set cpu_highest_set variable; update cpu_lowest_set based getpid() and cpu_highest_set values (so that to have cpu_lowest_set randomly set between lowest and highest set bits in the mask); add comment.
* Do incremental mark some in GC_collect_a_little even if GC is disabledIvan Maidanski2023-04-253-10/+11
| | | | | | | | | | | | | | | | | | | | Previous behavior was not documented but this API function did nothing in this case. That might cause a deadlock in the client code if the incremental collection was ongoing and the client called GC_collect_a_little() repeatedly (while the result is true). The new behavior, for the cause of disabled garbage collection, is to perform some amount of marking if the incremental collection is ongoing (but not stopping the world and, thus, not causing the memory reclaim to start), returning true if there is something more to mark. * alloc.c (GC_try_to_collect_inner): Change a loop to do-while one. * alloc.c (GC_collect_a_little): Do not check GC_dont_gc (i.e. call GC_collect_a_little_inner() unconditionally); add comment. * include/gc/gc.h (GC_collect_a_little): Update comment (describe the case when GC is disabled). * tests/gctest.c (check_heap_stats): Do not call GC_is_disabled(); add comment.
* Fix infinite loop in disable_gc_for_dlopen and GC_wait_for_gc_completionIvan Maidanski2023-04-252-13/+17
| | | | | | | | | | | | | Issue #257 (bdwgc). * alloc.c (GC_start_incremental_collection, GC_collect_a_little): Do not call GC_collect_a_little_inner() and ENTER/EXIT_GC() if GC_dont_gc. * alloc.c (GC_collect_a_little_inner): Call GC_mark_some() (in a loop) even if GC_dont_gc. * alloc.c (GC_allocobj): Do not call GC_collect_a_little_inner() if GC_dont_gc. * tests/gctest.c (check_heap_stats): Do not call GC_collect_a_little() (repeatedly) if GC_is_disabled().
* Remove extra variable and rename argument of GC_new_hblkIvan Maidanski2023-04-251-16/+14
| | | | | | | (refactoring) * new_hblk.c (GC_new_hblk): Reformat comment; rename kind argument to k one; remove clear local variable.
* Fix old function name in comment of GC_finalized_disclaimIvan Maidanski2023-04-221-1/+1
| | | | | | | (fix of commit 6c1a92445) * fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_disclaim): Fix old function name in comment ("GC_disclaim_and_reclaim").
* Provide global non-throwing operator new/delete in gccpp libraryIvan Maidanski2023-04-202-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: this might require define GC_INCLUDE_NEW by client before include gc_cpp.h on Windows hosts (to have nothrow_t declared before the global inline operator new and delete are defined). * gc_cpp.cc [(!_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW) && !GC_INLINE_STD_NEW && GC_OPERATOR_NEW_NOTHROW] (operator new, operator delete): Define with nothrow_t argument. * gc_cpp.cc [(!_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW) && !GC_INLINE_STD_NEW && GC_OPERATOR_NEW_ARRAY && !CPPCHECK && GC_OPERATOR_NEW_NOTHROW] (operator new[], operator delete[]): Likewise. * include/gc/gc_cpp.h [GC_INLINE_STD_NEW && GC_OPERATOR_NEW_ARRAY && GC_OPERATOR_NEW_NOTHROW] (operator new[], operator delete[]): Likewise. * include/gc/gc_cpp.h [GC_INLINE_STD_NEW && GC_OPERATOR_NEW_NOTHROW] (operator new, operator delete): Likewise. * include/gc/gc_cpp.h [!GC_OPERATOR_NEW_NOTHROW && !GC_NO_OPERATOR_NEW_NOTHROW && (GC_INCLUDE_NEW && (__cplusplus>=201103L || _MSVC_LANG>=201103L) || __NOTHROW_T_DEFINED)] (GC_OPERATOR_NEW_NOTHROW): Define macro; add comment. * include/gc/gc_cpp.h [!GC_INLINE_STD_NEW && GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_ARRAY && GC_OPERATOR_NEW_NOTHROW] (operator new[], operator delete[]): Add prototype with nothrow_t argument (with commented out GC_ATTR_MALLOC). * include/gc/gc_cpp.h [!GC_INLINE_STD_NEW && GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_NOTHROW] (operator new, operator delete): Likewise.
* Define sized delete operator in 'gc' classIvan Maidanski2023-04-202-45/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gc_cpp.cc [!_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW] (operator delete): Replace __cplusplus>=201703L||_MSVC_LANG>=201703L to defined(GC_OPERATOR_SIZED_DELETE). * include/gc/gc_cpp.h [GC_INLINE_STD_NEW]: Likewise. * gc_cpp.cc [!_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW] (GC_ALLOCATOR_THROW_OR_ABORT, operator new, operator delete, operator new[], operator delete[]): Do not define if GC_INLINE_STD_NEW. * gc_cpp.cc (operator new, operator delete): Reformat code. * include/gc/gc_cpp.h [!GC_NO_INLINE_STD_NEW && !GC_INLINE_STD_NEW && (_MSC_VER || __DMC__ || (__BORLANDC__ || __CYGWIN__ || __CYGWIN32__ || __MINGW32__ || __WATCOMC__) && !GC_BUILD && !GC_NOT_DLL)] (GC_INLINE_STD_NEW): Define macro. * include/gc/gc_cpp.h [!GC_NO_OPERATOR_SIZED_DELETE && !GC_OPERATOR_SIZED_DELETE && (__cplusplus>=201402L || _MSVC_LANG>=201402L)] (GC_OPERATOR_SIZED_DELETE): Likewise. * include/gc/gc_cpp.h [!GC_NO_INLINE_STD_NEW && (_MSC_VER || __DMC__ || (__BORLANDC__ || __CYGWIN__ || __CYGWIN32__ || __MINGW32__ || __WATCOMC__) && !GC_BUILD && !GC_NOT_DLL)]: Check GC_INLINE_STD_NEW instead. * include/gc/gc_cpp.h [GC_OPERATOR_SIZED_DELETE] (gc::operator delete(void*,GC_SIZE_T)): Declare. * include/gc/gc_cpp.h [GC_OPERATOR_NEW_ARRAY && GC_OPERATOR_SIZED_DELETE] (gc::operator delete[](void*,GC_SIZE_T)): Likewise. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_ARRAY && GC_OPERATOR_SIZED_DELETE] (operator delete[](void*,GC_SIZE_T)): Likewise. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_SIZED_DELETE] (operator delete(void*,GC_SIZE_T)): Likewise. * include/gc/gc_cpp.h [GC_OPERATOR_SIZED_DELETE] (gc::operator delete(void*,GC_SIZE_T)): Define inline function. * include/gc/gc_cpp.h [GC_OPERATOR_NEW_ARRAY && GC_OPERATOR_SIZED_DELETE] (gc::operator delete[](void*,GC_SIZE_T)): Likewise.
* Specify throw and noexcept for operator new/delete in gc_cpp.h for MS VCIvan Maidanski2023-04-191-5/+8
| | | | | | | | | | | | | | | | (fix of commit eb571cb86) * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_ARRAY] (operator new[]): Add GC_DECL_NEW_THROW. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER] (operator new): Likewise. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_ARRAY] (operator delete[]): Add GC_NOEXCEPT. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER] (operator delete): Likewise. * include/gc/gc_cpp.h [GC_NO_INLINE_STD_NEW && _MSC_VER && GC_OPERATOR_NEW_ARRAY] (operator new[](size_t,int,const char*,int)): New prototype.
* Fix 'C++17 does not allow dynamic exc spec' warn if GC_NO_INLINE_STD_NEWIvan Maidanski2023-04-192-20/+17
| | | | | | | | | | | | | | | | | | | | (fix of commit 17364f061) * gc_cpp.cc: Do not include <new> directly. * gc_cpp.cc [!GC_INCLUDE_NEW] (GC_INCLUDE_NEW): Define macro. * gc_cpp.cc (GC_DECL_NEW_THROW): Move definition to gc_cpp.h. * include/gc/gc_cpp.h [!GC_NO_INLINE_STD_NEW && (_MSC_VER || __DMC__ || (__BORLANDC__ || __CYGWIN__ || __CYGWIN32__ || __MINGW32__ || __WATCOMC__) && !GC_BUILD && !GC_NOT_DLL)] (GC_DECL_INLINE_NEW_THROW): Do not define. * include/gc/gc_cpp.h [GC_NEW_DELETE_NEED_THROW && !(__cplusplus>=201703L || _MSVC_LANG>=201703L) && !GC_INCLUDE_NEW] (GC_DECL_NEW_THROW): Define to empty. * include/gc/gc_cpp.h [!GC_NO_INLINE_STD_NEW && (_MSC_VER || __DMC__ || (__BORLANDC__ || __CYGWIN__ || __CYGWIN32__ || __MINGW32__ || __WATCOMC__) && !GC_BUILD && !GC_NOT_DLL)] (operator new, operator new[]): Replace GC_DECL_INLINE_NEW_THROW attribute to GC_DECL_NEW_THROW.
* Fix 'size_t not found in namespace std' dmc error in gc_allocator.hIvan Maidanski2023-04-173-23/+39
| | | | | | | | | | | | | | | | | | | | | (fix of commit 08eb0da6f) * gc_cpp.cc (operator new, operator delete): Use GC_SIZE_T instead of std::size_t. * include/gc/gc_allocator.h (GC_ALCTR_PTRDIFF_T, GC_ALCTR_SIZE_T): Define macro (and undefine it at the end of file). * include/gc/gc_allocator.h (GC_selective_alloc, gc_allocator.size_type, gc_allocator.max_size, gc_allocator_ignore_off_page.size_type, gc_allocator_ignore_off_page.max_size, traceable_allocator.size_type, traceable_allocator.max_size): Use GC_ALCTR_SIZE_T instead of std::size_t. * include/gc/gc_allocator.h (gc_allocator.difference_type, gc_allocator_ignore_off_page.difference_type, traceable_allocator.difference_type): Use GC_ALCTR_PTRDIFF_T instead of std::ptrdiff_t. * include/gc/gc_cpp.h [GC_INCLUDE_NEW] (GC_PTRDIFF_T, GC_SIZE_T): Do not use std:: prefix unless __cplusplus>=201103L.