Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-v…
Browse files Browse the repository at this point in the history
…ersion-3
  • Loading branch information
rm155 committed Aug 26, 2024
2 parents 73a394f + 8c01dec commit a202170
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -4113,25 +4113,29 @@ rb_ary_delete_at(VALUE ary, long pos)

/*
* call-seq:
* array.delete_at(index) -> deleted_object or nil
* delete_at(index) -> deleted_object or nil
*
* Deletes an element from +self+, per the given Integer +index+.
* Deletes the element of +self+ at the given +index+, which must be an
* {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
*
* When +index+ is non-negative, deletes the element at offset +index+:
*
* a = [:foo, 'bar', 2]
* a.delete_at(1) # => "bar"
* a # => [:foo, 2]
*
* If index is too large, returns +nil+.
*
* When +index+ is negative, counts backward from the end of the array:
*
* a = [:foo, 'bar', 2]
* a.delete_at(-2) # => "bar"
* a # => [:foo, 2]
*
* If +index+ is too small (far from zero), returns nil.
* When +index+ is out of range, returns +nil+.
*
* a = [:foo, 'bar', 2]
* a.delete_at(3) # => nil
* a.delete_at(-4) # => nil
*
*/

static VALUE
Expand Down
5 changes: 3 additions & 2 deletions gc/default.c
Original file line number Diff line number Diff line change
Expand Up @@ -2929,8 +2929,9 @@ newobj_alloc(rb_objspace_t *objspace, rb_ractor_newobj_cache_t *cache, size_t si

rb_size_pool_t *size_pool = &size_pools[size_pool_idx];
size_pool->total_allocated_objects++;
GC_ASSERT(SIZE_POOL_EDEN_HEAP(size_pool)->total_slots + SIZE_POOL_TOMB_HEAP(size_pool)->total_slots >=
(size_pool->total_allocated_objects - size_pool->total_freed_objects - size_pool->final_slots_count));
GC_ASSERT(rb_gc_multi_ractor_p() ||
SIZE_POOL_EDEN_HEAP(size_pool)->total_slots + SIZE_POOL_TOMB_HEAP(size_pool)->total_slots >=
(size_pool->total_allocated_objects - size_pool->total_freed_objects - size_pool->final_slots_count));

return obj;
}
Expand Down

0 comments on commit a202170

Please sign in to comment.