diff --git a/gc/gc.h b/gc/gc.h index d147a31..2a20d65 100644 --- a/gc/gc.h +++ b/gc/gc.h @@ -110,7 +110,7 @@ MODULAR_GC_FN void rb_gc_mark_roots(void *objspace, const char **categoryp); MODULAR_GC_FN void rb_gc_ractor_newobj_cache_foreach(void (*func)(void *cache, void *data), void *data); MODULAR_GC_FN bool rb_gc_multi_ractor_p(void); MODULAR_GC_FN bool rb_gc_shutdown_call_finalizer_p(VALUE obj); -MODULAR_GC_FN void rb_gc_obj_changed_pool(VALUE obj, size_t heap_id); +MODULAR_GC_FN void rb_gc_obj_changed_slot_size(VALUE obj, size_t slot_size); MODULAR_GC_FN void rb_gc_prepare_heap_process_object(VALUE obj); MODULAR_GC_FN bool rb_memerror_reentered(void); MODULAR_GC_FN bool rb_obj_id_p(VALUE); diff --git a/gc/gc_impl.h b/gc/gc_impl.h index b8417fd..892831c 100644 --- a/gc/gc_impl.h +++ b/gc/gc_impl.h @@ -38,7 +38,6 @@ GC_IMPL_FN void rb_gc_impl_objspace_init(void *objspace_ptr); GC_IMPL_FN void *rb_gc_impl_ractor_cache_alloc(void *objspace_ptr, void *ractor); GC_IMPL_FN void rb_gc_impl_set_params(void *objspace_ptr); GC_IMPL_FN void rb_gc_impl_init(void); -GC_IMPL_FN size_t *rb_gc_impl_heap_sizes(void *objspace_ptr); // Shutdown GC_IMPL_FN void rb_gc_impl_shutdown_free_objects(void *objspace_ptr); GC_IMPL_FN void rb_gc_impl_objspace_free(void *objspace_ptr); @@ -56,9 +55,9 @@ GC_IMPL_FN VALUE rb_gc_impl_config_get(void *objspace_ptr); GC_IMPL_FN void rb_gc_impl_config_set(void *objspace_ptr, VALUE hash); GC_IMPL_FN struct rb_gc_vm_context *rb_gc_impl_get_vm_context(void *objspace_ptr); // Object allocation -GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, bool wb_protected, size_t alloc_size); +GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, bool wb_protected, size_t alloc_size, size_t *actual_alloc_size); GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj); -GC_IMPL_FN size_t rb_gc_impl_heap_id_for_size(void *objspace_ptr, size_t size); +GC_IMPL_FN size_t rb_gc_impl_size_slot_size(void *objspace_ptr, size_t size); GC_IMPL_FN bool rb_gc_impl_size_allocatable_p(size_t size); // Malloc /* diff --git a/gc/mmtk/mmtk.c b/gc/mmtk/mmtk.c index d996b92..3600a3d 100644 --- a/gc/mmtk/mmtk.c +++ b/gc/mmtk/mmtk.c @@ -687,12 +687,6 @@ rb_gc_impl_init(void) rb_define_singleton_method(rb_mGC, "verify_compaction_references", rb_f_notimplement, -1); } -size_t * -rb_gc_impl_heap_sizes(void *objspace_ptr) -{ - return heap_sizes; -} - int rb_mmtk_obj_free_iter_wrapper(VALUE obj, void *data) { @@ -902,7 +896,7 @@ mmtk_post_alloc_fast_immix(struct objspace *objspace, struct MMTk_ractor_cache * } VALUE -rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, bool wb_protected, size_t alloc_size) +rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, bool wb_protected, size_t alloc_size, size_t *actual_alloc_size) { #define MMTK_ALLOCATION_SEMANTICS_DEFAULT 0 struct objspace *objspace = objspace_ptr; @@ -916,6 +910,7 @@ rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags break; } } + *actual_alloc_size = alloc_size; if (objspace->gc_stress) { mmtk_handle_user_collection_request(ractor_cache, false, false); @@ -962,10 +957,10 @@ rb_gc_impl_obj_slot_size(VALUE obj) } size_t -rb_gc_impl_heap_id_for_size(void *objspace_ptr, size_t size) +rb_gc_impl_size_slot_size(void *objspace_ptr, size_t size) { for (int i = 0; i < MMTK_HEAP_COUNT; i++) { - if (size <= heap_sizes[i]) return i; + if (size <= heap_sizes[i]) return heap_sizes[i]; } rb_bug("size too big"); diff --git a/test/.excludes-mmtk/TestGc.rb b/test/.excludes-mmtk/TestGc.rb index cbab458..4413f03 100644 --- a/test/.excludes-mmtk/TestGc.rb +++ b/test/.excludes-mmtk/TestGc.rb @@ -15,6 +15,10 @@ exclude(:test_old_to_young_reference, "testing behaviour specific to default GC") exclude(:test_profiler_enabled, "MMTk does not have GC::Profiler") exclude(:test_profiler_raw_data, "MMTk does not have GC::Profiler") +exclude(:test_profiler_raw_data_since, "MMTk does not have GC::Profiler") +exclude(:test_profiler_raw_data_limit, "MMTk does not have GC::Profiler") +exclude(:test_profiler_raw_data_reports_compaction_separately_from_sweep_wall_time, "MMTk does not have GC::Profiler") +exclude(:test_profiler_raw_data_includes_wall_time, "MMTk does not have GC::Profiler") exclude(:test_profiler_total_time, "MMTk does not have GC::Profiler") exclude(:test_start_full_mark, "testing behaviour specific to default GC") exclude(:test_start_immediate_sweep, "testing behaviour specific to default GC")