summaryrefslogtreecommitdiff
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* Add RSymbol struct back into RVALUEPeter Zhu2021-04-131-0/+1
| | | | | Commit 0ca714fa1aa3fbe4fb60ae1e5b730e544dabc27b removed RSymbol from RVALUE. This commit adds RSymbol back into RVALUE.
* Suppress a warningNobuyoshi Nakada2021-04-011-1/+1
| | | | Loop variables of `list_for_each` need to be initialized.
* skip marking for uninitialized imemo_env.Koichi Sasada2021-03-311-6/+10
| | | | | | | | | | RUBY_INTERNAL_EVENT_NEWOBJ can expose uninitialized imemo_env objects and marking it will cause critical error. This patch skips marking on uninitialized imemo_env. See: http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20210329T183003Z.fail.html.gz Shortest repro-code is provided by mame-san.
* Change heap walking to be safe for object allocationPeter Zhu2021-03-241-44/+86
|
* Free iv index tableAaron Patterson2021-03-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | IV index tables weren't being freed. This program would leak memory: ```ruby loop do k = Class.new do def initialize @a = 1 @b = 1 @c = 1 @d = 1 @e = 1 @f = 1 @g = 1 end end k.new end ``` This commit fixes the leak.
* Remove unneeded declarationsS.H2021-03-201-2/+0
|
* gc.c: Use dedicated APIs for conservative GC in EmscriptenYusuke Endoh2021-03-191-0/+26
| | | | | | | Emscripten provides "emscripten_scan_stack" to get the beginning and end pointers of the stack for conservative GC. Also, "emscripten_scan_registers" allows the GC to mark local variables in WASM.
* Constified variables for getenvNobuyoshi Nakada2021-03-121-2/+2
|
* Don't use mmap on platforms that have large OS page sizesPeter Zhu2021-03-021-3/+18
|
* Fix typoPeter Zhu2021-03-021-1/+1
|
* Disable auto compaction on platforms that do not support itPeter Zhu2021-02-251-0/+7
|
* Use mmap for allocating heap pagesPeter Zhu2021-02-251-13/+37
|
* Reverting PR #4221Aaron Patterson2021-02-241-44/+13
| | | | | | | It seems this breaks tests on Solaris, so I'm reverting it until we figure out the right fix. http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210224T210007Z.fail.html.gz
* Disable auto compaction on platforms that do not support itPeter Zhu2021-02-241-0/+7
|
* Use mmap for allocating heap pagesPeter Zhu2021-02-241-13/+37
|
* show more information about imemo_mentKoichi Sasada2021-02-191-15/+18
| | | | | rb_obj_info(obj) (rp(obj)) doesn't show enough information for non-iseq methods, so this patch shows more.
* sync check_rvalue_consistency_force()Koichi Sasada2021-02-181-73/+76
| | | | | | check_rvalue_consistency_force() uses is_pointer_to_heap() and it should be synchronized with other ractors. [Bug #17636]
* clear RVALUE on NEWOBJ event.Koichi Sasada2021-02-181-12/+15
| | | | | | NEWOBJ event is called without clearing RVALUE values (v1, v2, v3). This patch clear them before NEWOBJ tracepoint internal hook. [Bug #17599]
* sync GC rest if neededKoichi Sasada2021-02-181-0/+3
| | | | | | marking requires a barrier (stop all Ractors) and gc_enter() does it. However, it doesn't check rest event which can start marking. [Bug #17599]
* Removed no-longer used variableNobuyoshi Nakada2021-02-171-2/+0
|
* Remove unreachable if statement in gc_page_sweepPeter Zhu2021-02-161-7/+0
| | | | This if statement is not reachable because `was_compacting` cannot be true when `heap->compact_cursor` is NULL.
* Don't register non-heap allocated objectsAaron Patterson2021-02-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | `rb_define_const` can add objects as "mark objects". This is to make code like this work: https://github.com/ruby/ruby/blob/33d6e92e0c6eaf1308ce7108e653c53bb5fb106c/ext/etc/etc.c#L1201 ``` rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */ ``` sPasswd is a heap allocated object that is also a C global, so we can't move it (it needs to be pinned). However, we have many calls to `rb_define_const` that just pass in an integer like this: ``` rb_define_const(rb_cDBM, "WRITER", INT2FIX(O_RDWR|RUBY_DBM_RW_BIT)); ``` Non heap allocated objects like integers will never move, so there is no reason to waste time in the GC marking / pinning them.
* Use RCLASS_EXT macro instead of directly accessing ptrMatt Valentine-House2021-02-011-5/+5
|
* Add RCLASS_SUBCLASSES MacroMatt Valentine-House2021-02-011-4/+4
|
* Removed static assertion about size of `RVALUE`Nobuyoshi Nakada2021-01-311-2/+0
| | | | | It is unable where unaligned word access is disallowed and `double` is wider than pointers.
* Narrowed down the condition to pack RValueNobuyoshi Nakada2021-01-311-3/+5
| | | | | | Because of `double` in `RFloat`, `RValue` would be packed by `sizeof(double)` by default, on platforms where `double` is wider than `VALUE`. Size of `RValue` is multiple of 5 now.
* [Fixes #17538] Fix assertion failure when rincgc is turned offPeter Zhu2021-01-271-2/+3
| | | | Co-Authored-By: Matt Valentine-House <31869+eightbitraptor@users.noreply.github.com>
* Re-enable RGENGC_DEBUG for platforms with HAVE_VA_ARGS_MACROMatt Valentine-House2021-01-261-0/+2
| | | | | | | | after this commit turned it off globally. 888cf28a7e3a07fc0a41688777a40910654005ad Co-authored-by: peterzhu2118 <peter@peterzhu.ca>
* Fix RGENGC CHECK MODE >= 4Matt Valentine-House2021-01-261-2/+7
| | | | | | | | [A previous commit](b59077eecf912a16efefc0256f6e94a000ce3888) removes some macro definitions that are used when RGENGC_CHECK_MODE >=4 because they were using data stored against objspace, which is not ractor safe This commit reinstates those macro definitions, using the current ractor Co-authored-by: peterzhu2118 <peter@peterzhu.ca>
* gc.c: stop overflow check on emscripten buildYusuke Endoh2021-01-231-6/+1
|
* check is_incremental_marking() againKoichi Sasada2021-01-221-1/+10
| | | | | is_incremental_marking() can be changed after checking the flag without locking, especially on `GC.stress = true`.
* Fix more assumptions about the read barrierAaron Patterson2021-01-211-10/+0
| | | | | This is a continuation of 0130e17a410d60a10e7041ce98748b8de6946971. We need to always use the read barrier
* Always enabled read barrier even on GC.compactAaron Patterson2021-01-211-17/+3
| | | | | | | | | | | | Some objects can survive the GC before compaction, but get collected in the second compaction. This means we could have objects reference T_MOVED during "free" in the second, compacting GC. If that is the case, we need to invalidate those "moved" addresses. Invalidation is done via read barrier, so we need to make sure the read barrier is active even during `GC.compact`. This also means we don't actually need to do one GC before compaction, we can just do the compaction and GC in one step.
* 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.