aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* fix ASAN errorsAaron Patterson2021-01-131-4/+17
|
* gc fix typo for the timer instruction for ARM64.David CARLIER2021-01-091-1/+1
|
* show more info about imemo_callcacheKoichi Sasada2021-01-061-5/+8
|
* [DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer2021-01-051-1/+1
|
* enable constant cache on ractorsKoichi Sasada2021-01-051-3/+16
| | | | | | | | | | | | | | | | constant cache `IC` is accessed by non-atomic manner and there are thread-safety issues, so Ruby 3.0 disables to use const cache on non-main ractors. This patch enables it by introducing `imemo_constcache` and allocates it by every re-fill of const cache like `imemo_callcache`. [Bug #17510] Now `IC` only has one entry `IC::entry` and it points to `iseq_inline_constant_cache_entry`, managed by T_IMEMO object. `IC` is atomic data structure so `rb_mjit_before_vm_ic_update()` and `rb_mjit_after_vm_ic_update()` is not needed.
* Stop managing valid class serialsTakashi Kokubun2020-12-291-1/+0
| | | | `mjit_valid_class_serial_p` has no longer been used since b9007b6c548.
* Adjusted styles [ci skip]Nobuyoshi Nakada2020-12-281-20/+40
|
* Fixed leaked global symbolsNobuyoshi Nakada2020-12-261-5/+9
|
* define RGENGC_DEBUG_ENABLED() as 0Koichi Sasada2020-12-251-1/+1
| | | | | | | on RUBY_DEVEL==0 and !HAVE_VA_ARGS_MACRO. gc_report() is always enabled on such configuration (maybe it is a bug) so disable RGENGC_DEBUG_ENABLED().
* Use rb_init_identtable instead of direct use of rb_hashtype_identNobuyoshi Nakada2020-12-231-3/+2
|
* separate rb_ractor_pub from rb_ractor_tKoichi Sasada2020-12-221-1/+1
| | | | | | | | | 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.
* finalizing should be checked before VM lockKoichi Sasada2020-12-181-2/+3
|
* Removed a moved local variableNobuyoshi Nakada2020-12-181-2/+0
|
* need to sync gc_finalize_deferredKoichi Sasada2020-12-181-3/+9
| | | | | gc_finalize_deferred() runs finalizers and it accesses objspace, so it need to sync.
* Removed old GC.stat keys deprecated since 2.2Nobuyoshi Nakada2020-12-181-133/+0
|
* Removed old GC tuning environment variables deprecated since 2.1Nobuyoshi Nakada2020-12-181-7/+0
|
* acquire VM lock on gc_verify_internal_consistency()Koichi Sasada2020-12-181-7/+10
| | | | There is a case to call this function without VM lock acquiring.
* add explicit checkKoichi Sasada2020-12-181-2/+2
| | | | | To debug this issue: https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20201217T220004Z.fail.html.gz
* gc_verify_internal_consistency() needs barrierKoichi Sasada2020-12-181-1/+3
| | | | | gc_verify_internal_consistency() accesses all slots (objects) so all ractors should stop before starting this function.
* sync obj_to_id_tblKoichi Sasada2020-12-171-3/+4
| | | | | objspace->obj_to_id_tbl is a shared table so we need to synchronize it to access.
* reduce barrier counts for GC eventsKoichi Sasada2020-12-171-1/+9
| | | | | mark needs barrier (stop other ractors), but other GC events don't need barriers (maybe...).
* relax synchronization on WBKoichi Sasada2020-12-171-29/+10
| | | | Current synchronization is too much on write barriers.
* add debug counters for gc start eventsKoichi Sasada2020-12-171-22/+59
|
* RGENGC_PROFILE=0Koichi Sasada2020-12-171-1/+1
| | | | Enabled this flag, maybe accidentally.
* Removed unneeded cast and use the real nameNobuyoshi Nakada2020-12-151-1/+1
|
* revert da3bca513f437b05b3953c3712ff48621fc5e008Koichi Sasada2020-12-111-59/+13
| | | | | | | It seems introduce critical problems. Now I could not find out the issue. http://ci.rvm.jp/results/trunk-test@ruby-sky1/3286048
* ObjectSpace._id2ref should not support unshareableKoichi Sasada2020-12-101-1/+9
| | | | | | ObjectSpace._id2ref(id) can return any objects even if they are unshareable, so this patch raises RangeError if it runs on multi-ractor mode and the found object is unshareable.
* Unpoison freelist to chainNobuyoshi Nakada2020-12-101-0/+1
|
* cache free pages per ractorKoichi Sasada2020-12-101-12/+57
| | | | | | | 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.
* set min/maximum free slots relative to ractor cntKoichi Sasada2020-12-101-3/+9
| | | | | | A program with multiple ractors can consume more objects per unit time, so this patch set minimum/maximum free_slots to relative to ractors count (upto 8).
* lazy sweep tries to collect 2048 slotsKoichi Sasada2020-12-101-3/+8
| | | | | | | Lazy sweep tries to collect free (unused) slots incrementally, and it only collect a few pages. This patch makes lazy sweep collects more objects (at least 2048 objects) and GC overhead of multi-ractor execution will be reduced.
* need the lock for debug checking.Koichi Sasada2020-12-091-12/+17
| | | | | Checking code (RGENGC_CHECK_MODE > 0) need a VM lock because it refers objspace.
* need more lock in finalize_list()Koichi Sasada2020-12-071-9/+10
| | | | | Some data should be accessed in parallel so they should be protected by the lock.
* RB_VM_LOCK_ENTER_NO_BARRIERKoichi Sasada2020-12-071-4/+4
| | | | | | | | | 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.
* skip assertion on multi-ractorKoichi Sasada2020-12-071-1/+3
| | | | This assertion is not considerred on multi-ractor mdoe.
* RB_EC_NEWOBJ_OFKoichi Sasada2020-12-071-1/+1
| | | | NEWOBJ with current ec.
* per-ractor object allocationKoichi Sasada2020-12-071-146/+219
| | | | | | | | 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).
* Revert "Skip repeated scan of object during compaction"Aaron Patterson2020-12-031-1/+1
| | | | | | | | | | This seems to be breaking the build for some reason. This command can reproduce it: `make yes-test-all TESTS=--repeat-count=20` This reverts commit 88bb1a672c49746972f4b15410fa92e9d237c43d.
* Skip repeated scan of object during compactionPeter Zhu2020-12-031-1/+1
|
* When allocating new pages, add them to the end of the linked listAaron Patterson2020-12-021-2/+2
| | | | | When we allocate new pages, allocate them on the end of the linked list. Then when we compact we can move things to the head of the list
* Incremental sweeping should not require page allocationAaron Patterson2020-12-021-3/+2
| | | | | | | | Incremental sweeping should sweep until we find a slot for objects to use. `heap_increment` was adding a page to the heap even though we would sweep immediately after. Co-authored-by: John Hawthorn <john@hawthorn.email>
* show with sharing infoKoichi Sasada2020-12-011-0/+1
|
* ractor local storage C-APIKoichi Sasada2020-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* support SIGSEGV/BUS while read_barrier_handler()Koichi Sasada2020-11-301-11/+18
| | | | | read_barrier_handler() can cause SIGSEGV/BUS so it should show the errors.
* Run rb_print_backtrace first on ruby_on_ciTakashi Kokubun2020-11-261-1/+7
| | | | | Unfortunately we couldn't see a C backtrace with the previous commit http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/3272697.
* Call rb_bug_without_die on CITakashi Kokubun2020-11-261-1/+6
| | | | when GC.compact's SEGV handler is installed
* Disable auto compaction on platforms that can't support itAaron Patterson2020-11-251-5/+64
| | | | | | | | | | | | | Both explicit compaction routines (gc_compact and the verify references form) need to clear the heap before executing compaction. Otherwise some objects may not be alive, and we'll need the read barrier. The heap must only contain *live* objects if we want to disable the read barrier during explicit compaction. The previous commit was missing the "clear the heap" phase from the "verify references" explicit compaction function. Fixes [Bug #17306]
* Revert "Disable auto compaction on platforms that can't support it"Aaron Patterson2020-11-241-49/+3
| | | | | | | | This reverts commit 63ad55cd882e4010fe313d271af006a430b5ffa8. Revert "Disable read barrier on explicit compaction request" This reverts commit 490b57783d80f0c5f7882c66d9fb6aa02713c9a5.
* Disable auto compaction on platforms that can't support itAaron Patterson2020-11-241-0/+21
| | | | | | | | | | Auto Compaction uses mprotect to implement a read barrier. mprotect can only work on regions of memory that are a multiple of the OS page size. Ruby's pages are a multiple of 4kb, but some platforms (like ppc64le) don't have 4kb page sizes. This commit disables the features on those platforms. Fixes [Bug #17306]
* add HEAP_PAGE_SIZE to internal constantsAaron Patterson2020-11-241-0/+1
|