Skip to content

Fix generic_ivar_set_shape_field for table rebuild #13589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove fields_tbl in gen_fields_lookup_ensure_size
  • Loading branch information
jhawthorn committed Jun 14, 2025
commit 7500d6c67527c1297f9e6cb82850ab012bf07d73
6 changes: 2 additions & 4 deletions variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,6 @@ general_field_set(VALUE obj, shape_id_t target_shape_id, VALUE val, void *data,
struct gen_fields_lookup_ensure_size {
VALUE obj;
ID id;
struct gen_fields_tbl *fields_tbl;
shape_id_t shape_id;
bool resize;
};
Expand All @@ -1829,11 +1828,11 @@ generic_ivar_set_shape_fields(VALUE obj, void *data)
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));

struct gen_fields_lookup_ensure_size *fields_lookup = data;
struct gen_fields_tbl *fields_tbl = NULL;

// We can't use st_update, since when resizing the fields table GC can
// happen, which will modify the st_table and may rebuild it
RB_VM_LOCKING() {
struct gen_fields_tbl *fields_tbl = NULL;
st_table *tbl = generic_fields_tbl(obj, fields_lookup->id, false);
int existing = st_lookup(tbl, (st_data_t)obj, (st_data_t *)&fields_tbl);

Expand All @@ -1847,13 +1846,12 @@ generic_ivar_set_shape_fields(VALUE obj, void *data)
st_insert(tbl, (st_data_t)obj, (st_data_t)fields_tbl);
}

fields_lookup->fields_tbl = fields_tbl;
if (fields_lookup->shape_id) {
rb_obj_set_shape_id(fields_lookup->obj, fields_lookup->shape_id);
}
}

return fields_lookup->fields_tbl->as.shape.fields;
return fields_tbl->as.shape.fields;
}

static void
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy