Skip to content

Commit aad9fa2

Browse files
committed
Use RB_VM_LOCKING
1 parent fc518fe commit aad9fa2

18 files changed

Lines changed: 201 additions & 323 deletions

class.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ push_subclass_entry_to_list(VALUE super, VALUE klass, bool is_module)
446446
entry = ZALLOC(rb_subclass_entry_t);
447447
entry->klass = klass;
448448

449-
RB_VM_LOCK_ENTER();
450-
{
449+
RB_VM_LOCKING() {
451450
anchor = RCLASS_WRITABLE_SUBCLASSES(super);
452451
VM_ASSERT(anchor);
453452
ns_subclasses = (rb_ns_subclasses_t *)anchor->ns_subclasses;
@@ -464,7 +463,6 @@ push_subclass_entry_to_list(VALUE super, VALUE klass, bool is_module)
464463
entry->prev = head;
465464
st_insert(tbl, namespace_subclasses_tbl_key(ns), (st_data_t)entry);
466465
}
467-
RB_VM_LOCK_LEAVE();
468466

469467
if (is_module) {
470468
RCLASS_WRITE_NS_MODULE_SUBCLASSES(klass, anchor->ns_subclasses);

gc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,11 +2280,9 @@ classext_fields_hash_memsize(rb_classext_t *ext, bool prime, VALUE namespace, vo
22802280
{
22812281
size_t *size = (size_t *)arg;
22822282
size_t count;
2283-
RB_VM_LOCK_ENTER();
2284-
{
2283+
RB_VM_LOCKING() {
22852284
count = rb_st_table_size((st_table *)RCLASSEXT_FIELDS(ext));
22862285
}
2287-
RB_VM_LOCK_LEAVE();
22882286
// class IV sizes are allocated as powers of two
22892287
*size += SIZEOF_VALUE << bit_length(count);
22902288
}
@@ -4570,8 +4568,7 @@ ruby_gc_set_params(void)
45704568
void
45714569
rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data)
45724570
{
4573-
RB_VM_LOCK_ENTER();
4574-
{
4571+
RB_VM_LOCKING() {
45754572
if (rb_gc_impl_during_gc_p(rb_gc_get_objspace())) rb_bug("rb_objspace_reachable_objects_from() is not supported while during GC");
45764573

45774574
if (!RB_SPECIAL_CONST_P(obj)) {
@@ -4587,7 +4584,6 @@ rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *
45874584
vm->gc.mark_func_data = prev_mfd;
45884585
}
45894586
}
4590-
RB_VM_LOCK_LEAVE();
45914587
}
45924588

45934589
struct root_objects_data {

0 commit comments

Comments
 (0)