objspace_dump: Include shareable
flag
Given that the currently planned ractor local GC implementation performance will heavilly be influenced by the number of shareable objects it would be valuable to be able to know how many of them are in the heap.
This commit is contained in:
parent
7af5a632f4
commit
cb1ea54bbf
@ -6199,7 +6199,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
|
||||
{
|
||||
rb_objspace_t *objspace = objspace_ptr;
|
||||
size_t n = 0;
|
||||
static ID ID_wb_protected, ID_age, ID_old, ID_uncollectible, ID_marking, ID_marked, ID_pinned, ID_object_id;
|
||||
static ID ID_wb_protected, ID_age, ID_old, ID_uncollectible, ID_marking, ID_marked, ID_pinned, ID_object_id, ID_shareable;
|
||||
|
||||
if (!ID_marked) {
|
||||
#define I(s) ID_##s = rb_intern(#s);
|
||||
@ -6211,6 +6211,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
|
||||
I(marked);
|
||||
I(pinned);
|
||||
I(object_id);
|
||||
I(shareable);
|
||||
#undef I
|
||||
}
|
||||
|
||||
@ -6229,6 +6230,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
|
||||
if (RVALUE_MARKED(objspace, obj)) SET_ENTRY(marked, Qtrue);
|
||||
if (RVALUE_PINNED(objspace, obj)) SET_ENTRY(pinned, Qtrue);
|
||||
if (FL_TEST(obj, FL_SEEN_OBJ_ID)) SET_ENTRY(object_id, rb_obj_id(obj));
|
||||
if (FL_TEST(obj, FL_SHAREABLE)) SET_ENTRY(shareable, Qtrue);
|
||||
|
||||
object_metadata_entries[n].name = 0;
|
||||
object_metadata_entries[n].val = 0;
|
||||
|
@ -977,6 +977,13 @@ class TestObjSpace < Test::Unit::TestCase
|
||||
assert_equal class_name, JSON.parse(json)["name"]
|
||||
end
|
||||
|
||||
def test_dump_include_shareable
|
||||
omit 'Not provided by mmtk' if RUBY_DESCRIPTION.include?("+GC[mmtk]")
|
||||
|
||||
assert_include(ObjectSpace.dump(ENV), '"shareable":true')
|
||||
assert_not_include(ObjectSpace.dump([]), '"shareable":true')
|
||||
end
|
||||
|
||||
def test_utf8_method_names
|
||||
name = "utf8_❨╯°□°❩╯︵┻━┻"
|
||||
obj = ObjectSpace.trace_object_allocations do
|
||||
|
Loading…
x
Reference in New Issue
Block a user