|
33 | 33 | #define MAX_SHAPE_ID (SHAPE_BUFFER_SIZE - 1) |
34 | 34 | #define ANCESTOR_SEARCH_MAX_DEPTH 2 |
35 | 35 |
|
36 | | -static ID id_frozen; |
37 | | -static ID id_t_object; |
38 | | -ID ruby_internal_object_id; // extern |
| 36 | +static ID id_object_id; |
39 | 37 |
|
40 | 38 | #define LEAF 0 |
41 | 39 | #define BLACK 0x0 |
@@ -714,7 +712,7 @@ shape_transition_object_id(shape_id_t original_shape_id) |
714 | 712 | RUBY_ASSERT(!rb_shape_has_object_id(original_shape_id)); |
715 | 713 |
|
716 | 714 | bool dont_care; |
717 | | - rb_shape_t *shape = get_next_shape_internal(RSHAPE(original_shape_id), ruby_internal_object_id, SHAPE_OBJ_ID, &dont_care, true); |
| 715 | + rb_shape_t *shape = get_next_shape_internal(RSHAPE(original_shape_id), id_object_id, SHAPE_OBJ_ID, &dont_care, true); |
718 | 716 | if (!shape) { |
719 | 717 | shape = RSHAPE(ROOT_SHAPE_WITH_OBJ_ID); |
720 | 718 | } |
@@ -1146,7 +1144,7 @@ rb_shape_copy_complex_ivars(VALUE dest, VALUE obj, shape_id_t src_shape_id, st_t |
1146 | 1144 | // obj is TOO_COMPLEX so we can copy its iv_hash |
1147 | 1145 | st_table *table = st_copy(fields_table); |
1148 | 1146 | if (rb_shape_has_object_id(src_shape_id)) { |
1149 | | - st_data_t id = (st_data_t)ruby_internal_object_id; |
| 1147 | + st_data_t id = (st_data_t)id_object_id; |
1150 | 1148 | st_delete(table, &id, NULL); |
1151 | 1149 | } |
1152 | 1150 | rb_obj_init_too_complex(dest, table); |
@@ -1497,9 +1495,7 @@ Init_default_shapes(void) |
1497 | 1495 | rb_memerror(); |
1498 | 1496 | } |
1499 | 1497 |
|
1500 | | - id_frozen = rb_make_internal_id(); |
1501 | | - id_t_object = rb_make_internal_id(); |
1502 | | - ruby_internal_object_id = rb_make_internal_id(); |
| 1498 | + id_object_id = rb_make_internal_id(); |
1503 | 1499 |
|
1504 | 1500 | #ifdef HAVE_MMAP |
1505 | 1501 | size_t shape_cache_mmap_size = rb_size_mul_or_raise(REDBLACK_CACHE_SIZE, sizeof(redblack_node_t), rb_eRuntimeError); |
@@ -1529,11 +1525,12 @@ Init_default_shapes(void) |
1529 | 1525 | rb_shape_tree.root_shape = root; |
1530 | 1526 | RUBY_ASSERT(raw_shape_id(rb_shape_tree.root_shape) == ROOT_SHAPE_ID); |
1531 | 1527 |
|
1532 | | - rb_shape_t *root_with_obj_id = rb_shape_alloc_with_parent_id(0, ROOT_SHAPE_ID); |
1533 | | - root_with_obj_id->type = SHAPE_OBJ_ID; |
1534 | | - root_with_obj_id->edge_name = ruby_internal_object_id; |
1535 | | - root_with_obj_id->next_field_index++; |
| 1528 | + bool dontcare; |
| 1529 | + rb_shape_t *root_with_obj_id = get_next_shape_internal(root, id_object_id, SHAPE_OBJ_ID, &dontcare, true); |
1536 | 1530 | RUBY_ASSERT(raw_shape_id(root_with_obj_id) == ROOT_SHAPE_WITH_OBJ_ID); |
| 1531 | + RUBY_ASSERT(root_with_obj_id->type == SHAPE_OBJ_ID); |
| 1532 | + RUBY_ASSERT(root_with_obj_id->edge_name == id_object_id); |
| 1533 | + RUBY_ASSERT(root_with_obj_id->next_field_index == 1); |
1537 | 1534 | } |
1538 | 1535 |
|
1539 | 1536 | void |
|
0 commit comments