summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2021-07-15[Bug #18014] Add assertion to verify freelistPeter Zhu
This commit adds an assertion has been added after `gc_page_sweep` to verify that the freelist length is equal to the number of free slots in the page. Notes: Merged: https://github.com/ruby/ruby/pull/4613
2021-07-15[Bug #18014] Fix memory leak in GC when using RactorsPeter Zhu
When a Ractor is removed, the freelist in the Ractor cache is not returned to the GC, leaving the freelist permanently lost. This commit recycles the freelist when the Ractor is destroyed, preventing a memory leak from occurring. Notes: Merged: https://github.com/ruby/ruby/pull/4613
2021-07-15[Bug #18014] Fix rb_gc_force_recycle unmark before sweepPeter Zhu
If we force recycle an object before the page is swept, we should clear it in the mark bitmap. If we don't clear it in the bitmap, then during sweeping we won't account for this free slot so the `free_slots` count of the page will be incorrect. Notes: Merged: https://github.com/ruby/ruby/pull/4613
2021-07-10Get rid of conflict in ccan/listNobuyoshi Nakada
Undefine LIST_HEAD from BSD-origin sys/queue.h.
2021-07-07gc.c: use each_stack_location for emscriptenYusuke Endoh
follow up of e4e416380d4b1b36ca1cc2e1e1ed993c9be694bb
2021-06-30Use stride passed into os_obj_of_iPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4614
2021-06-29Fix crash on RGENGC_CHECK_MODE=4Peter Zhu
When running btest there is a crash when compiled with RGENGC_CHECK_MODE=4. The crash happens because `during_gc` is not turned off before `gc_marks_check` is called, causing the marking to happen on the main mark stack instead of mark stack created in `objspace_allrefs`. Notes: Merged: https://github.com/ruby/ruby/pull/4610
2021-06-22Fix asan error when walking heap for T_PAYLOAD objectseileencodes
Related to https://bugs.ruby-lang.org/issues/18001 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4597
2021-06-18Add a cache for class variableseileencodes
Redo of 34a2acdac788602c14bf05fb616215187badd504 and 931138b00696419945dc03e10f033b1f53cd50f3 which were reverted. GitHub PR #4340. This change implements a cache for class variables. Previously there was no cache for cvars. Cvar access is slow due to needing to travel all the way up th ancestor tree before returning the cvar value. The deeper the ancestor tree the slower cvar access will be. The benefits of the cache are more visible with a higher number of included modules due to the way Ruby looks up class variables. The benchmark here includes 26 modules and shows with the cache, this branch is 6.5x faster when accessing class variables. ``` compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105c) [x86_64-darwin19] built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be009) [x86_64-darwin19] | |compare-ruby|built-ruby| |:--------|-----------:|---------:| |vm_cvar | 5.681M| 36.980M| | | -| 6.51x| ``` Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails application. ActiveRecord::Base.logger has 71 ancestors. The more ancestors a tree has, the more clear the speed increase. IE if Base had only one ancestor we'd see no improvement. This benchmark is run on a vanilla Rails application. Benchmark code: ```ruby require "benchmark/ips" require_relative "config/environment" Benchmark.ips do |x| x.report "logger" do ActiveRecord::Base.logger end end ``` Ruby 3.0 master / Rails 6.1: ``` Warming up -------------------------------------- logger 155.251k i/100ms Calculating ------------------------------------- ``` Ruby 3.0 with cvar cache / Rails 6.1: ``` Warming up -------------------------------------- logger 1.546M i/100ms Calculating ------------------------------------- logger 14.857M (± 4.8%) i/s - 74.198M in 5.006202s ``` Lastly we ran a benchmark to demonstate the difference between master and our cache when the number of modules increases. This benchmark measures 1 ancestor, 30 ancestors, and 100 ancestors. Ruby 3.0 master: ``` Warming up -------------------------------------- 1 module 1.231M i/100ms 30 modules 432.020k i/100ms 100 modules 145.399k i/100ms Calculating ------------------------------------- 1 module 12.210M (± 2.1%) i/s - 61.553M in 5.043400s 30 modules 4.354M (± 2.7%) i/s - 22.033M in 5.063839s 100 modules 1.434M (± 2.9%) i/s - 7.270M in 5.072531s Comparison: 1 module: 12209958.3 i/s 30 modules: 4354217.8 i/s - 2.80x (± 0.00) slower 100 modules: 1434447.3 i/s - 8.51x (± 0.00) slower ``` Ruby 3.0 with cvar cache: ``` Warming up -------------------------------------- 1 module 1.641M i/100ms 30 modules 1.655M i/100ms 100 modules 1.620M i/100ms Calculating ------------------------------------- 1 module 16.279M (± 3.8%) i/s - 82.038M in 5.046923s 30 modules 15.891M (± 3.9%) i/s - 79.459M in 5.007958s 100 modules 16.087M (± 3.6%) i/s - 81.005M in 5.041931s Comparison: 1 module: 16279458.0 i/s 100 modules: 16087484.6 i/s - same-ish: difference falls within error 30 modules: 15891406.2 i/s - same-ish: difference falls within error ``` Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4544
2021-06-17Refactor heap_set_incrementPeter Zhu
heap_set_increment essentially only calls heap_allocatable_pages_set. They only differ in behaviour when `additional_pages == 0`. However, this is only possible because heap_extend_pages may return 0. This commit also changes heap_extend_pages to always return at least 1. Notes: Merged: https://github.com/ruby/ruby/pull/4580
2021-06-17Adjust styles [ci skip]Nobuyoshi Nakada
* --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
2021-06-13Added parentheses to silence sizeof-array-div warningsNobuyoshi Nakada
As well as 2366c681166a1dab95de6b9ca8ffcaae18aadd39.
2021-06-13Removed duplicate includeNobuyoshi Nakada
2021-06-10Finish GC before calling gc_set_initial_pagesPeter Zhu
If we are during incremental sweeping when calling gc_set_initial_pages there is an assertion error. The following patch will artificially produce the bug: ``` diff --git a/gc.c b/gc.c index c3157dbe2c..d7282cf8f0 100644 --- a/gc.c +++ b/gc.c @@ -404,7 +404,7 @@ int ruby_rgengc_debug; * 5: show all references */ #ifndef RGENGC_CHECK_MODE -#define RGENGC_CHECK_MODE 0 +#define RGENGC_CHECK_MODE 1 #endif // Note: using RUBY_ASSERT_WHEN() extend a macro in expr (info by nobu). @@ -10821,6 +10821,10 @@ gc_set_initial_pages(void) void ruby_gc_set_params(void) { + for (int i = 0; i < 10000; i++) { + rb_ary_new(); + } + /* RUBY_GC_HEAP_FREE_SLOTS */ if (get_envparam_size("RUBY_GC_HEAP_FREE_SLOTS", &gc_params.heap_free_slots, 0)) { /* ok */ ``` The crash looks like: ``` Assertion Failed: ../gc.c:2038:heap_add_page:!(heap == heap_eden && heap->sweeping_page) ``` Notes: Merged: https://github.com/ruby/ruby/pull/4562
2021-06-09Refactor gc_marks_start_heap to only configure heapPeter Zhu
Move the non-heap related configurations to gc_marks_start. Notes: Merged: https://github.com/ruby/ruby/pull/4560
2021-06-08Add multi-heap support to gc_marks_wb_unprotected_objectsPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4559
2021-06-03Support an arbitrary number of header bits (< BITS_BITLENGTH)Aaron Patterson
NUM_IN_PAGE(page->start) will sometimes return a 0 or a 1 depending on how the alignment of the 40 byte slots work out. This commit uses the NUM_IN_PAGE function to shift the bitmap down on the first bitmap plane. Iterating on the first bitmap plane is "special", but this commit allows us to align object addresses on something besides 40 bytes, and also eliminates the need to fill guard bits.
2021-06-02use a bool instead of intAaron Patterson
2021-06-02Allocate exact space for objspace_each_objectsPeter Zhu
We are only iterating over the eden heap so `heap_eden->total_pages` contains the exact number of pages we need to allocate for. `heap_allocated_pages` may contain pages in the tomb. Notes: Merged: https://github.com/ruby/ruby/pull/4547
2021-06-01Use the current object as the compaction indexAaron Patterson
Instead of keeping track of the current bit plane, keep track of the actual slot when compacting. This means we don't need to re-scan objects inside the same bit plane when we continue with movement
2021-05-26Fill out switch statement in push_mark_stackAaron Patterson
When objects are popped from the mark stack, we check that the object is the right type (otherwise an rb_bug happens). The problem is that when we pop a bad object from the stack, we have no idea what pushed the bad object on the stack. This change makes an error happen when a bad object is pushed on the mark stack, that way we can track down the source of the bug. Notes: Merged: https://github.com/ruby/ruby/pull/4531
2021-05-25Disable compaction on platforms that can't support itAaron Patterson
Manual compaction also requires a read barrier, so we need to disable even manual compaction on platforms that don't support mprotect. [Bug #17871] Notes: Merged: https://github.com/ruby/ruby/pull/4528
2021-05-18Revert any references that are on the machine stack after compactingAaron Patterson
Since compaction can be concurrent, the machine stack is allowed to change while compaction is happening. When compaction finishes, there may be references on the machine stack that need to be reverted so that we can remove the read barrier. Notes: Merged: https://github.com/ruby/ruby/pull/4510
2021-05-16PAGE_SIZE is never used on msys/mingwNobuyoshi Nakada
2021-05-14Refix PAGE_SIZENobuyoshi Nakada
* honor actually used headers * include sys/user.h only when `PAGE_SIZE` is not defined
2021-05-14Make USE_MMAP_ALIGNED_ALLOC static constNobuyoshi Nakada
2021-05-13skip rb_bug for inconsistent zombies countKoichi Sasada
It seems a bug but it takes more time to debug. To stop CI failures, skip this rb_bug on `RGENGC_CHECK_MODE=2` temporarily.
2021-05-11Revert "Filling cache values on cvar write"Aaron Patterson
This reverts commit 08de37f9fa3469365e6b5c964689ae2bae0eb9f3. This reverts commit e8ae922b62adb00a80d3d4c49f7d7b0e6026eaba.
2021-05-11Add a cache for class variableseileencodes
This change implements a cache for class variables. Previously there was no cache for cvars. Cvar access is slow due to needing to travel all the way up th ancestor tree before returning the cvar value. The deeper the ancestor tree the slower cvar access will be. The benefits of the cache are more visible with a higher number of included modules due to the way Ruby looks up class variables. The benchmark here includes 26 modules and shows with the cache, this branch is 6.5x faster when accessing class variables. ``` compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105ca45) [x86_64-darwin19] built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be0093ae) [x86_64-darwin19] | |compare-ruby|built-ruby| |:--------|-----------:|---------:| |vm_cvar | 5.681M| 36.980M| | | -| 6.51x| ``` Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails application. ActiveRecord::Base.logger has 71 ancestors. The more ancestors a tree has, the more clear the speed increase. IE if Base had only one ancestor we'd see no improvement. This benchmark is run on a vanilla Rails application. Benchmark code: ```ruby require "benchmark/ips" require_relative "config/environment" Benchmark.ips do |x| x.report "logger" do ActiveRecord::Base.logger end end ``` Ruby 3.0 master / Rails 6.1: ``` Warming up -------------------------------------- logger 155.251k i/100ms Calculating ------------------------------------- ``` Ruby 3.0 with cvar cache / Rails 6.1: ``` Warming up -------------------------------------- logger 1.546M i/100ms Calculating ------------------------------------- logger 14.857M (± 4.8%) i/s - 74.198M in 5.006202s ``` Lastly we ran a benchmark to demonstate the difference between master and our cache when the number of modules increases. This benchmark measures 1 ancestor, 30 ancestors, and 100 ancestors. Ruby 3.0 master: ``` Warming up -------------------------------------- 1 module 1.231M i/100ms 30 modules 432.020k i/100ms 100 modules 145.399k i/100ms Calculating ------------------------------------- 1 module 12.210M (± 2.1%) i/s - 61.553M in 5.043400s 30 modules 4.354M (± 2.7%) i/s - 22.033M in 5.063839s 100 modules 1.434M (± 2.9%) i/s - 7.270M in 5.072531s Comparison: 1 module: 12209958.3 i/s 30 modules: 4354217.8 i/s - 2.80x (± 0.00) slower 100 modules: 1434447.3 i/s - 8.51x (± 0.00) slower ``` Ruby 3.0 with cvar cache: ``` Warming up -------------------------------------- 1 module 1.641M i/100ms 30 modules 1.655M i/100ms 100 modules 1.620M i/100ms Calculating ------------------------------------- 1 module 16.279M (± 3.8%) i/s - 82.038M in 5.046923s 30 modules 15.891M (± 3.9%) i/s - 79.459M in 5.007958s 100 modules 16.087M (± 3.6%) i/s - 81.005M in 5.041931s Comparison: 1 module: 16279458.0 i/s 100 modules: 16087484.6 i/s - same-ish: difference falls within error 30 modules: 15891406.2 i/s - same-ish: difference falls within error ``` Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4340
2021-05-07Protoized old pre-ANSI K&R style declarations and definitionsNobuyoshi Nakada
2021-05-06Conditionally used functionsNobuyoshi Nakada
2021-05-06Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slotsMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/4391
2021-05-06Reuse sysconf resultNobuyoshi Nakada
2021-05-06Revised PAGE_MAX_SIZE caseNobuyoshi Nakada
2021-05-05Fall back to sysconf to determine page size during runtimePeter Zhu
On some platforms the PAGE_SIZE macro does not exist so we can fall back to `sysconf` to determine the page size at runtime. Notes: Merged: https://github.com/ruby/ruby/pull/4462
2021-05-05Fix PAGE_SIZE macro detection in autoconfPeter Zhu
The current fix for PAGE_SIZE macro detection in autoconf does not work correctly. I see the following output with running configure on Linux: ``` checking PAGE_SIZE is defined... no ``` Linux has PAGE_SIZE macro. This is happening because the macro exists in sys/user.h and not in the malloc headers. Notes: Merged: https://github.com/ruby/ruby/pull/4461
2021-05-06PAGE_SIZE is used only when mmap is availableNobuyoshi Nakada
2021-05-05Fix compilation on M1 MacNobuyoshi Nakada
As PAGE_SIZE may not be a preprocessor constant, dispatch at runtime in that case.
2021-05-04Fix -Wundef warnings for patterns `#if HAVE`Benoit Daloze
* See [Feature #17752] * Using this to detect them: git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF' Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-05-04Fix trivial -Wundef warningsBenoit Daloze
* See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/4428
2021-05-03Eagerly allocate instance variable tables along with objectAaron Patterson
This allows us to allocate the right size for the object in advance, meaning that we don't have to pay the cost of ivar table extension later. The idea is that if an object type ever became "extended" at some point, then it is very likely it will become extended again. So we may as well allocate the ivar table up front. Notes: Merged: https://github.com/ruby/ruby/pull/4216
2021-04-27Partially revert 2c7d3b3a722c4636ab1e9d289cbca47ddd168d3eYusuke Endoh
to make imemo_ast WB-protected again. Only the test is kept. Notes: Merged: https://github.com/ruby/ruby/pull/4419
2021-04-26node.c (rb_ast_new): imemo_ast is WB-unprotectedYusuke Endoh
Previously imemo_ast was handled as WB-protected which caused a segfault of the following code: # shareable_constant_value: literal M0 = {} M1 = {} ... M100000 = {} My analysis is here: `shareable_constant_value: literal` creates many Hash instances during parsing, and add them to node_buffer of imemo_ast. However, the contents are missed because imemo_ast is incorrectly WB-protected. This changeset makes imemo_ast as WB-unprotected. Notes: Merged: https://github.com/ruby/ruby/pull/4416
2021-04-26Fix some typos by spell checkerRyuta Kamizono
Notes: Merged: https://github.com/ruby/ruby/pull/4414
2021-04-20check ep during compaction because it can be nullAaron Patterson
This commit adds a check on the ep just like in the mark function. The env can contain null bytes if allocation tracing is enabled. We're seeing errors during autocompaction like this: ``` (lldb) bt 40 * thread #1, name = 'ruby', stop reason = signal SIGABRT frame #0: 0x00007f7d64b6018b libc.so.6`raise + 203 frame #1: 0x00007f7d64b3f859 libc.so.6`abort + 299 frame #2: 0x000055af5f2fefc9 ruby`die at error.c:764:5 frame #3: 0x000055af5f2ff1ac ruby`rb_bug_for_fatal_signal(default_sighandler=0x0000000000000000, sig=11, ctx=0x000055af60bc3340, fmt="") at error.c:804:5 frame #4: 0x000055af5f4bd08f ruby`sigsegv(sig=11, info=0x000055af60bc3470, ctx=0x000055af60bc3340) at signal.c:960:5 frame #5: 0x00007f7d64ebe3c0 libpthread.so.0`__restore_rt frame #6: 0x000055af5f339b0a ruby`gc_ref_update_imemo(objspace=0x000055af60b2b040, obj=0x00007f7d5b513fd0) at gc.c:9046:13 frame #7: 0x000055af5f339172 ruby`gc_update_object_references(objspace=0x000055af60b2b040, obj=0x00007f7d5b513fd0) at gc.c:9307:9 frame #8: 0x000055af5f338e79 ruby`gc_ref_update(vstart=0x00007f7d5b510010, vend=0x00007f7d5b513ff8, stride=40, objspace=0x000055af60b2b040, page=0x000055af62577aa0) at gc.c:9452:21 frame #9: 0x000055af5f337846 ruby`gc_update_references(objspace=0x000055af60b2b040, heap=0x000055af60b2b068) at gc.c:9481:9 frame #10: 0x000055af5f336569 ruby`gc_compact_finish(objspace=0x000055af60b2b040, heap=0x000055af60b2b068) at gc.c:4840:5 frame #11: 0x000055af5f335efb ruby`gc_page_sweep(objspace=0x000055af60b2b040, heap=0x000055af60b2b068, sweep_page=0x000055af63a1eb30) at gc.c:5046:13 frame #12: 0x000055af5f3355c5 ruby`gc_sweep_step(objspace=0x000055af60b2b040, heap=0x000055af60b2b068) at gc.c:5214:19 frame #13: 0x000055af5f33daf6 ruby`gc_sweep_rest(objspace=0x000055af60b2b040) at gc.c:5271:2 frame #14: 0x000055af5f33cacd ruby`gc_sweep(objspace=0x000055af60b2b040) at gc.c:5389:2 frame #15: 0x000055af5f33c21d ruby`gc_marks_rest(objspace=0x000055af60b2b040) at gc.c:7555:5 frame #16: 0x000055af5f324d41 ruby`gc_rest(objspace=0x000055af60b2b040) at gc.c:8457:13 frame #17: 0x000055af5f3297d8 ruby`garbage_collect(objspace=0x000055af60b2b040, reason=45568) at gc.c:8318:9 frame #18: 0x000055af5f344ece ruby`garbage_collect_with_gvl(objspace=0x000055af60b2b040, reason=45568) at gc.c:8632:9 frame #19: 0x000055af5f344e61 ruby`objspace_malloc_gc_stress(objspace=0x000055af60b2b040) at gc.c:10592:9 frame #20: 0x000055af5f32ced1 ruby`objspace_xmalloc0(objspace=0x000055af60b2b040, size=64) at gc.c:10767:5 frame #21: 0x000055af5f32ce11 ruby`ruby_xmalloc0(size=64) at gc.c:10988:12 frame #22: 0x000055af5f32cdac ruby`ruby_xmalloc_body(size=64) at gc.c:10997:12 frame #23: 0x000055af5f329415 ruby`ruby_xmalloc(size=64) at gc.c:12942:12 frame #24: 0x00007f7d611c4fe5 objspace.so`newobj_i(tpval=0x00007f7d5b553770, data=0x000055af639031a0) at object_tracing.c:101:35 frame #25: 0x000055af5f5b283f ruby`tp_call_trace(tpval=0x00007f7d5b553770, trace_arg=0x00007fff1016d398) at vm_trace.c:1115:2 frame #26: 0x000055af5f5b50ec ruby`exec_hooks_body(ec=0x000055af60b2b700, list=0x000055af60b2b920, trace_arg=0x00007fff1016d398) at vm_trace.c:304:3 frame #27: 0x000055af5f5b0f24 ruby`exec_hooks_unprotected(ec=0x000055af60b2b700, list=0x000055af60b2b920, trace_arg=0x00007fff1016d398) at vm_trace.c:333:5 frame #28: 0x000055af5f5b0da8 ruby`rb_exec_event_hooks(trace_arg=0x00007fff1016d398, hooks=0x000055af60b2b920, pop_p=0) at vm_trace.c:378:13 frame #29: 0x000055af5f33f8e2 ruby`rb_exec_event_hook_orig(ec=0x000055af60b2b700, hooks=0x000055af60b2b920, flag=1048576, self=0x00007f7d5b5c08c0, id=0, called_id=0, klass=0x0000000000000000, data=0x00007f7d5b513fd0, pop_p=0) at vm_core.h:1989:5 frame #30: 0x000055af5f334975 ruby`gc_event_hook_body(ec=0x000055af60b2b700, objspace=0x000055af60b2b040, event=1048576, data=0x00007f7d5b513fd0) at gc.c:2083:5 * frame #31: 0x000055af5f3342df ruby`newobj_slowpath_wb_protected [inlined] newobj_slowpath(klass=0x00007f7d5b9d19c8, flags=0x000000000000001a, objspace=0x000055af60b2b040, cr=0x000055af60b2b910, wb_protected=1) at gc.c:2284:9 frame #32: 0x000055af5f33410f ruby`newobj_slowpath_wb_protected(klass=0x00007f7d5b9d19c8, flags=0x000000000000001a, objspace=0x000055af60b2b040, cr=0x000055af60b2b910) at gc.c:2299 frame #33: 0x000055af5f333de9 ruby`newobj_of0(klass=0x00007f7d5b9d19c8, flags=0x000000000000001a, wb_protected=1, cr=0x000055af60b2b910) at gc.c:2338:11 frame #34: 0x000055af5f3227ae ruby`newobj_of(klass=0x00007f7d5b9d19c8, flags=0x000000000000001a, v1=0x000055af657d88a0, v2=0x000055af657d8890, v3=0x0000000000000000, wb_protected=1) at gc.c:2348:17 frame #35: 0x000055af5f322c5b ruby`rb_imemo_new(type=imemo_env, v1=0x000055af657d88a0, v2=0x000055af657d8890, v3=0x0000000000000000, v0=0x00007f7d5b9d19c8) at gc.c:2434:12 frame #36: 0x000055af5f5a3925 ruby`vm_env_new(env_ep=0x000055af657d88a0, env_body=0x000055af657d8890, env_size=4, iseq=0x00007f7d5b9d19c8) at vm_core.h:1363:33 frame #37: 0x000055af5f5a3808 ruby`vm_make_env_each(ec=0x000055af60b2b700, cfp=0x00007f7d6482fc90) at vm.c:801:11 frame #38: 0x000055af5f5a368d ruby`vm_make_env_each(ec=0x000055af60b2b700, cfp=0x00007f7d6482fc20) at vm.c:752:13 frame #39: 0x000055af5f5a368d ruby`vm_make_env_each(ec=0x000055af60b2b700, cfp=0x00007f7d6482fbb0) at vm.c:752:13 (lldb) f 31 frame #31: 0x000055af5f3342df ruby`newobj_slowpath_wb_protected [inlined] newobj_slowpath(klass=0x00007f7d5b9d19c8, flags=0x000000000000001a, objspace=0x000055af60b2b040, cr=0x000055af60b2b910, wb_protected=1) at gc.c:2284:9 2281 } 2282 GC_ASSERT(obj != 0); 2283 newobj_init(klass, flags, wb_protected, objspace, obj); -> 2284 gc_event_hook_prep(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj, newobj_fill(obj, 0, 0, 0)); 2285 } 2286 RB_VM_LOCK_LEAVE_CR_LEV(cr, &lev); 2287 (lldb) p obj (VALUE) $3 = 0x00007f7d5b513fd0 (lldb) f 6 frame #6: 0x000055af5f339b0a ruby`gc_ref_update_imemo(objspace=0x000055af60b2b040, obj=0x00007f7d5b513fd0) at gc.c:9046:13 9043 { 9044 rb_env_t *env = (rb_env_t *)obj; 9045 TYPED_UPDATE_IF_MOVED(objspace, rb_iseq_t *, env->iseq); -> 9046 UPDATE_IF_MOVED(objspace, env->ep[VM_ENV_DATA_INDEX_ENV]); 9047 gc_update_values(objspace, (long)env->env_size, (VALUE *)env->env); 9048 } 9049 break; (lldb) p obj (VALUE) $4 = 0x00007f7d5b513fd0 (lldb) ``` Notes: Merged: https://github.com/ruby/ruby/pull/4392
2021-04-15Remove useless attribute set in init_mark_stackPeter Zhu
init_mark_stack already clears the mark stack so we do not need to set the attribute cache_size to zero. Notes: Merged: https://github.com/ruby/ruby/pull/4382
2021-04-13Add RSymbol struct back into RVALUEPeter Zhu
Commit 0ca714fa1aa3fbe4fb60ae1e5b730e544dabc27b removed RSymbol from RVALUE. This commit adds RSymbol back into RVALUE. Notes: Merged: https://github.com/ruby/ruby/pull/4378
2021-04-01Suppress a warningNobuyoshi Nakada
Loop variables of `list_for_each` need to be initialized.
2021-03-31skip marking for uninitialized imemo_env.Koichi Sasada
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. Notes: Merged: https://github.com/ruby/ruby/pull/4342
2021-03-24Change heap walking to be safe for object allocationPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4263