diff --git a/api/bdw-attrs.h b/api/bdw-attrs.h index 938356a5e..19d5250f2 100644 --- a/api/bdw-attrs.h +++ b/api/bdw-attrs.h @@ -36,10 +36,6 @@ static inline uint8_t gc_allocator_alloc_table_end_pattern(void) { GC_CRASH(); } -static inline int gc_allocator_needs_clear(void) { - return 0; -} - static inline enum gc_old_generation_check_kind gc_old_generation_check_kind(size_t) { return GC_OLD_GENERATION_CHECK_NONE; } diff --git a/api/gc-api.h b/api/gc-api.h index ff1a20927..58cd5c02d 100644 --- a/api/gc-api.h +++ b/api/gc-api.h @@ -56,14 +56,6 @@ GC_API_ void* gc_call_without_gc(struct gc_mutator *mut, void* (*f)(void*), GC_API_ void gc_collect(struct gc_mutator *mut, enum gc_collection_kind requested_kind); -static inline void gc_clear_fresh_allocation(struct gc_ref obj, - size_t size) GC_ALWAYS_INLINE; -static inline void gc_clear_fresh_allocation(struct gc_ref obj, - size_t size) { - if (!gc_allocator_needs_clear()) return; - memset(gc_ref_heap_object(obj), 0, size); -} - static inline void gc_update_alloc_table(struct gc_ref obj, size_t size) GC_ALWAYS_INLINE; static inline void gc_update_alloc_table(struct gc_ref obj, @@ -119,7 +111,6 @@ static inline void* gc_allocate_small_fast_bump_pointer(struct gc_mutator *mut, *hp_loc = new_hp; - gc_clear_fresh_allocation(gc_ref(hp), size); gc_update_alloc_table(gc_ref(hp), size); return (void*)hp; @@ -140,7 +131,6 @@ static inline void* gc_allocate_small_fast_freelist(struct gc_mutator *mut, size *freelist_loc = *(void**)head; - gc_clear_fresh_allocation(gc_ref_from_heap_object(head), size); gc_update_alloc_table(gc_ref_from_heap_object(head), size); return head; diff --git a/api/gc-attrs.h b/api/gc-attrs.h index f0a6e94e6..bb563c0e2 100644 --- a/api/gc-attrs.h +++ b/api/gc-attrs.h @@ -25,8 +25,6 @@ static inline size_t gc_allocator_alloc_table_alignment(void) GC_ALWAYS_INLINE; static inline uint8_t gc_allocator_alloc_table_begin_pattern(void) GC_ALWAYS_INLINE; static inline uint8_t gc_allocator_alloc_table_end_pattern(void) GC_ALWAYS_INLINE; -static inline int gc_allocator_needs_clear(void) GC_ALWAYS_INLINE; - enum gc_old_generation_check_kind { GC_OLD_GENERATION_CHECK_NONE, GC_OLD_GENERATION_CHECK_ALLOC_TABLE, diff --git a/api/mmc-attrs.h b/api/mmc-attrs.h index 65cb434c9..fe9edb0a4 100644 --- a/api/mmc-attrs.h +++ b/api/mmc-attrs.h @@ -36,10 +36,6 @@ static inline uint8_t gc_allocator_alloc_table_end_pattern(void) { return 16; } -static inline int gc_allocator_needs_clear(void) { - return 0; -} - static inline enum gc_old_generation_check_kind gc_old_generation_check_kind(size_t obj_size) { if (GC_GENERATIONAL) { if (obj_size <= gc_allocator_large_threshold()) diff --git a/api/pcc-attrs.h b/api/pcc-attrs.h index 654acf8b9..913208cdd 100644 --- a/api/pcc-attrs.h +++ b/api/pcc-attrs.h @@ -39,10 +39,6 @@ static inline uint8_t gc_allocator_alloc_table_end_pattern(void) { GC_CRASH(); } -static inline int gc_allocator_needs_clear(void) { - return 0; -} - static inline enum gc_old_generation_check_kind gc_old_generation_check_kind(size_t size) { if (!GC_GENERATIONAL) return GC_OLD_GENERATION_CHECK_NONE; diff --git a/api/semi-attrs.h b/api/semi-attrs.h index 69a87560e..b8baab693 100644 --- a/api/semi-attrs.h +++ b/api/semi-attrs.h @@ -28,10 +28,6 @@ static inline size_t gc_allocator_freelist_offset(size_t size) { GC_CRASH(); } -static inline int gc_allocator_needs_clear(void) { - return 1; -} - static inline size_t gc_allocator_alloc_table_alignment(void) { return 0; } diff --git a/src/pcc.c b/src/pcc.c index f3a94d22b..c480021f9 100644 --- a/src/pcc.c +++ b/src/pcc.c @@ -997,7 +997,6 @@ void* gc_allocate_slow(struct gc_mutator *mut, size_t size) { break; } - gc_clear_fresh_allocation(ret, size); return gc_ref_heap_object(ret); } diff --git a/src/semi.c b/src/semi.c index 0d0c9ecca..86541f913 100644 --- a/src/semi.c +++ b/src/semi.c @@ -437,6 +437,7 @@ static void collect(struct gc_mutator *mut, size_t for_alloc) { gc_heap_sizer_on_gc(heap->sizer, heap->size, live_size, pause_ns, resize_heap); reset_heap_limits(heap); + clear_memory(semi->hp, semi->limit - semi->hp); HEAP_EVENT(heap, restarting_mutators); // fprintf(stderr, "%zd bytes copied\n", (space->size>>1)-(space->limit-space->hp)); @@ -520,8 +521,6 @@ void* gc_allocate_slow(struct gc_mutator *mut, size_t size) { continue; } space->hp = new_hp; - // FIXME: Allow allocator to avoid clearing memory? - clear_memory(addr, size); return (void *)addr; } }