diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-06-13 16:19:33 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-07-13 09:27:33 -0400 |
commit | 1e7b67f73370056c7521306b9f037b6cbccf640d (patch) | |
tree | 288d284f69cea8935adf323da99f84eff2bb7707 /gc.c | |
parent | fff4773085bd70bf14ace146388dd0b9d80f244a (diff) |
[Feature #19730] Remove transient heap
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7942
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 45 |
1 files changed, 2 insertions, 43 deletions
@@ -131,7 +131,6 @@ #include "ruby_assert.h" #include "ruby_atomic.h" #include "symbol.h" -#include "transient_heap.h" #include "vm_core.h" #include "vm_sync.h" #include "vm_callinfo.h" @@ -1722,7 +1721,6 @@ RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, struct heap_page *pag { MARK_IN_BITMAP(&page->uncollectible_bits[0], obj); objspace->rgengc.old_objects++; - rb_transient_heap_promote(obj); #if RGENGC_PROFILE >= 2 objspace->profile.total_promoted_count++; @@ -3468,9 +3466,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) else if (RANY(obj)->as.basic.flags & ROBJECT_EMBED) { RB_DEBUG_COUNTER_INC(obj_obj_embed); } - else if (ROBJ_TRANSIENT_P(obj)) { - RB_DEBUG_COUNTER_INC(obj_obj_transient); - } else { xfree(RANY(obj)->as.object.as.heap.ivptr); RB_DEBUG_COUNTER_INC(obj_obj_ptr); @@ -3641,9 +3636,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) RANY(obj)->as.rstruct.as.heap.ptr == NULL) { RB_DEBUG_COUNTER_INC(obj_struct_embed); } - else if (RSTRUCT_TRANSIENT_P(obj)) { - RB_DEBUG_COUNTER_INC(obj_struct_transient); - } else { xfree((void *)RANY(obj)->as.rstruct.as.heap.ptr); RB_DEBUG_COUNTER_INC(obj_struct_ptr); @@ -7219,12 +7211,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) for (i=0; i < len; i++) { gc_mark(objspace, ptr[i]); } - - if (LIKELY(during_gc)) { - if (!ARY_EMBED_P(obj) && RARRAY_TRANSIENT_P(obj)) { - rb_transient_heap_mark(obj, ptr); - } - } } break; @@ -7268,11 +7254,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) for (i = 0; i < len; i++) { gc_mark(objspace, ptr[i]); } - - if (LIKELY(during_gc) && - ROBJ_TRANSIENT_P(obj)) { - rb_transient_heap_mark(obj, ptr); - } } if (shape) { VALUE klass = RBASIC_CLASS(obj); @@ -7329,11 +7310,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) for (i=0; i<len; i++) { gc_mark(objspace, ptr[i]); } - - if (LIKELY(during_gc) && - RSTRUCT_TRANSIENT_P(obj)) { - rb_transient_heap_mark(obj, ptr); - } } break; @@ -8098,13 +8074,6 @@ rb_gc_verify_internal_consistency(void) gc_verify_internal_consistency(&rb_objspace); } -static VALUE -gc_verify_transient_heap_internal_consistency(VALUE dmy) -{ - rb_transient_heap_verify(); - return Qnil; -} - static void heap_move_pooled_pages_to_free_pages(rb_heap_t *heap) { @@ -8325,7 +8294,6 @@ gc_marks_finish(rb_objspace_t *objspace) objspace->rgengc.need_major_gc ? "major" : "minor"); } - rb_transient_heap_finish_marking(); rb_ractor_finish_marking(); gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_END_MARK, 0); @@ -9403,7 +9371,6 @@ gc_start(rb_objspace_t *objspace, unsigned int reason) objspace->profile.heap_used_at_gc_start = heap_allocated_pages; gc_prof_setup_new_record(objspace, reason); gc_reset_malloc_info(objspace, do_full_mark); - rb_transient_heap_start_marking(do_full_mark); gc_event_hook(objspace, RUBY_INTERNAL_EVENT_GC_START, 0 /* TODO: pass minor/immediate flag? */); GC_ASSERT(during_gc); @@ -9988,12 +9955,7 @@ gc_ref_update_object(rb_objspace_t *objspace, VALUE v) // Object can be re-embedded memcpy(ROBJECT(v)->as.ary, ptr, sizeof(VALUE) * ROBJECT_IV_COUNT(v)); RB_FL_SET_RAW(v, ROBJECT_EMBED); - if (ROBJ_TRANSIENT_P(v)) { - ROBJ_TRANSIENT_UNSET(v); - } - else { - xfree(ptr); - } + xfree(ptr); ptr = ROBJECT(v)->as.ary; } @@ -10675,7 +10637,6 @@ gc_update_references(rb_objspace_t *objspace) } } rb_vm_update_references(vm); - rb_transient_heap_update_references(); rb_gc_update_global_tbl(); global_symbols.ids = rb_gc_location(global_symbols.ids); global_symbols.dsymbol_fstr_hash = rb_gc_location(global_symbols.dsymbol_fstr_hash); @@ -13505,10 +13466,9 @@ rb_raw_obj_info_buitin_type(char *const buff, const size_t buff_size, const VALU RARRAY_LEN(obj)); } else { - APPEND_F("[%s%s%s] len: %ld, capa:%ld ptr:%p", + APPEND_F("[%s%s] len: %ld, capa:%ld ptr:%p", C(ARY_EMBED_P(obj), "E"), C(ARY_SHARED_P(obj), "S"), - C(RARRAY_TRANSIENT_P(obj), "T"), RARRAY_LEN(obj), ARY_EMBED_P(obj) ? -1L : RARRAY(obj)->as.heap.aux.capa, (void *)RARRAY_CONST_PTR_TRANSIENT(obj)); @@ -13954,7 +13914,6 @@ Init_GC(void) /* internal methods */ rb_define_singleton_method(rb_mGC, "verify_internal_consistency", gc_verify_internal_consistency_m, 0); - rb_define_singleton_method(rb_mGC, "verify_transient_heap_internal_consistency", gc_verify_transient_heap_internal_consistency, 0); #if MALLOC_ALLOCATED_SIZE rb_define_singleton_method(rb_mGC, "malloc_allocated_size", gc_malloc_allocated_size, 0); rb_define_singleton_method(rb_mGC, "malloc_allocations", gc_malloc_allocations, 0); |