10000 Move `object_id` in object fields. · ruby/ruby@dc039da · GitHub
[go: up one dir, main page]

Skip to content

Commit dc039da

Browse files
Move object_id in object fields.
And get rid of the `obj_to_id_tbl` It's no longer needed, the `object_id` is now stored inline in the object alongside instance variables. We still need the inverse table in case `_id2ref` is invoked, but we lazily build it by walking the heap if that happens. The `object_id` concern is also no longer a GC implementation concern, but a generic implementation. Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
1 parent 6577ef7 commit dc039da

File tree

23 files changed

+1159
-553
lines changed
  • include/ruby/internal
  • internal
  • test/ruby
  • yjit/src
  • zjit/src
  • 23 files changed

    +1159
    -553
    lines changed

    ext/objspace/objspace_dump.c

    Lines changed: 8 additions & 8 deletions
    Original file line numberDiff line numberDiff line change
    @@ -805,29 +805,29 @@ shape_i(rb_shape_t *shape, void *data)
    805805
    dump_append(dc, ", \"depth\":");
    806806
    dump_append_sizet(dc, rb_shape_depth(shape));
    807807

    808-
    dump_append(dc, ", \"shape_type\":");
    809808
    switch((enum shape_type)shape->type) {
    810809
    case SHAPE_ROOT:
    811-
    dump_append(dc, "\"ROOT\"");
    810+
    dump_append(dc, ", \"shape_type\":\"ROOT\"");
    812811
    break;
    813812
    case SHAPE_IVAR:
    814-
    dump_append(dc, "\"IVAR\"");
    813+
    dump_append(dc, ", \"shape_type\":\"IVAR\"");
    815814

    816815
    dump_append(dc, ",\"edge_name\":");
    817816
    dump_append_id(dc, shape->edge_name);
    818817

    819818
    break;
    820819
    case SHAPE_FROZEN:
    821-
    dump_append(dc, "\"FROZEN\"");
    820+
    dump_append(dc, ", \"shape_type\":\"FROZEN\"");
    822821
    break;
    823822
    case SHAPE_T_OBJECT:
    824-
    dump_append(dc, "\"T_OBJECT\"");
    823+
    dump_append(dc, ", \"shape_type\":\"T_OBJECT\"");
    825824
    break;
    826825
    case SHAPE_OBJ_TOO_COMPLEX:
    827-
    dump_append(dc, "\"OBJ_TOO_COMPLEX\"");
    826+
    dump_append(dc, ", \"shape_type\":\"OBJ_TOO_COMPLEX\"");
    827+
    break;
    828+
    case SHAPE_OBJ_ID:
    829+
    dump_append(dc, ", \"shape_type\":\"OBJ_ID\"");
    828830
    break;
    829-
    default:
    830-
    rb_bug("[objspace] unexpected shape type");
    831831
    }
    832832

    833833
    dump_append(dc, ", \"edges\":");

    0 commit comments

    Comments
     (0)
    0