summaryrefslogtreecommitdiff
path: root/ractor_core.h
AgeCommit message (Collapse)Author
2020-12-24shareable_constant_value: experimental_copyKoichi Sasada
"experimental_everything" makes the assigned value, it means the assignment change the state of assigned value. "experimental_copy" tries to make a deep copy and make copyied object sharable. Notes: Merged: https://github.com/ruby/ruby/pull/3989
2020-12-24introduce rb_ractor_atfork()Koichi Sasada
to reset main ractor at fork().
2020-12-22add Ractor#[]/#[]= for ractor local storageKoichi Sasada
This API is similar to plain old Thread#[]/Fiber#[] interface with symbol key. Notes: Merged: https://github.com/ruby/ruby/pull/3962
2020-12-22separate rb_ractor_pub from rb_ractor_tKoichi Sasada
separate some fields from rb_ractor_t to rb_ractor_pub and put it at the beggining of rb_ractor_t and declare it in vm_core.h so vm_core.h can access rb_ractor_pub fields. Now rb_ec_ractor_hooks() is a complete inline function and no MJIT related issue. Notes: Merged: https://github.com/ruby/ruby/pull/3943
2020-12-22TracePoint.new(&block) should be ractor-localKoichi Sasada
TracePoint should be ractor-local because the Proc can violate the Ractor-safe. Notes: Merged: https://github.com/ruby/ruby/pull/3943
2020-12-16Ractor#receive_if to receive only matched messagesKoichi Sasada
Instead of Ractor.receive, Ractor.receive_if can provide a pattern by a block and you can choose the receiving message. [Feature #17378] Notes: Merged: https://github.com/ruby/ruby/pull/3862
2020-12-11revert da3bca513f437b05b3953c3712ff48621fc5e008Koichi Sasada
It seems introduce critical problems. Now I could not find out the issue. http://ci.rvm.jp/results/trunk-test@ruby-sky1/3286048
2020-12-10cache free pages per ractorKoichi Sasada
Per ractor method cache (GH-#3842) only cached 1 page and this patch caches several pages to keep at least 512 free slots if available. If you increase the number of cached free slots, all cached slots will be collected when the GC is invoked. Notes: Merged: https://github.com/ruby/ruby/pull/3875
2020-12-09re-layout rb_ractor_tKoichi Sasada
separate synchronization data and ractor local data. Notes: Merged: https://github.com/ruby/ruby/pull/3858
2020-12-07per-ractor object allocationKoichi Sasada
Now object allocation requires VM global lock to synchronize objspace. However, of course, it introduces huge overhead. This patch caches some slots (in a page) by each ractor and use cached slots for object allocation. If there is no cached slots, acquire the global lock and get new cached slots, or start GC (marking or lazy sweeping). Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-12-07ruby_single_main_ractor for single ractor modeKoichi Sasada
ruby_multi_ractor was a flag that indicates the interpreter doesn't make any additional ractors (single ractor mode). Instead of boolean flag, ruby_single_main_ractor pointer is introduced which keeps main ractor's pointer if single ractor mode. If additional ractors are created, ruby_single_main_ractor becomes NULL. Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-12-01ractor local storage C-APIKoichi Sasada
To manage ractor-local data for C extension, the following APIs are defined. * rb_ractor_local_storage_value_newkey * rb_ractor_local_storage_value * rb_ractor_local_storage_value_set * rb_ractor_local_storage_ptr_newkey * rb_ractor_local_storage_ptr * rb_ractor_local_storage_ptr_set At first, you need to create a key of storage by rb_ractor_local_(value|ptr)_newkey(). For ptr storage, it accepts the type of storage, how to mark and how to free with ractor's lifetime. rb_ractor_local_storage_value/set are used to access a VALUE and rb_ractor_local_storage_ptr/set are used to access a pointer. random.c uses this API. Notes: Merged: https://github.com/ruby/ruby/pull/3822
2020-11-27Use opaque struct pointer than voidNobuyoshi Nakada
2020-11-27per-ractor Random::DEFAULTKoichi Sasada
Random generators are not Ractor-safe, so we need to prepare per-ractor default random genearators. This patch set `Random::DEFAULT = Randm` (not a Random instance, but the Random class) and singleton methods like `Random.rand()` use a per-ractor random generator. [Feature #17322] Notes: Merged: https://github.com/ruby/ruby/pull/3813
2020-11-18Move the declaration into the functionKazuhiro NISHIYAMA
instead of 'do not call it directly.' comment.
2020-11-18fix public interfaceKoichi Sasada
To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h) Notes: Merged: https://github.com/ruby/ruby/pull/3775