summaryrefslogtreecommitdiff
path: root/vm_sync.c
AgeCommit message (Collapse)Author
2020-12-26Fixed leaked global symbolsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4003
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-16add vm_sync debug countersKoichi Sasada
* vm_sync_lock * vm_sync_lock_enter * vm_sync_lock_enter_nb * vm_sync_lock_enter_cr * vm_sync_barrier Notes: Merged: https://github.com/ruby/ruby/pull/3910
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-07RB_VM_LOCK_ENTER_NO_BARRIERKoichi Sasada
Write barrier requires VM lock because it accesses VM global bitmap but RB_VM_LOCK_ENTER() can invoke GC because another ractor can wait to invoke GC and RB_VM_LOCK_ENTER() is barrier point. This means that before protecting by a write barrier, GC can invoke. To prevent such situation, RB_VM_LOCK_ENTER_NO_BARRIER() is introduced. This lock primitive does not become GC barrier points.
2020-12-07log for the beggining of vm_lock_enterKoichi Sasada
Before this patch, there is no information to start locking. Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-12-07RB_VM_LOCK_ENTER_CR_LEVKoichi Sasada
This is variant of RB_VM_LOCK_ENTER_LEV, but accept current racotr's pointer. Notes: Merged: https://github.com/ruby/ruby/pull/3842
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
2020-10-17sync RClass::ext::iv_index_tblKoichi Sasada
iv_index_tbl manages instance variable indexes (ID -> index). This data structure should be synchronized with other ractors so introduce some VM locks. This patch also introduced atomic ivar cache used by set/getinlinecache instructions. To make updating ivar cache (IVC), we changed iv_index_tbl data structure to manage (ID -> entry) and an entry points serial and index. IVC points to this entry so that cache update becomes atomically. Notes: Merged: https://github.com/ruby/ruby/pull/3662
2020-10-14fix releasing timing.Koichi Sasada
(1) recorded_lock_rec > current_lock_rec should not be occurred on rb_ec_vm_lock_rec_release(). (2) should be release VM lock at EXEC_TAG(), not POP_TAG(). (3) some refactoring. Notes: Merged: https://github.com/ruby/ruby/pull/3655
2020-10-14support exception when lock_rec > 0Koichi Sasada
If a ractor getting a VM lock (monitor) raises an exception, unlock can be skipped. To release VM lock correctly on exception (or other jumps with JUMP_TAG), EC_POP_TAG() releases VM lock. Notes: Merged: https://github.com/ruby/ruby/pull/3654
2020-09-15relax dependencyKoichi Sasada
vm_sync.h does not need to include vm_core.h and ractor_pub.h. Notes: Merged: https://github.com/ruby/ruby/pull/3534
2020-09-04Initialize loop variables of list_for_each for MS VCNobuyoshi Nakada
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues. Notes: Merged: https://github.com/ruby/ruby/pull/3365