1. 10 6月, 2020 4 次提交
    • A
      Revert "Combine sweeping and moving" · 62ce8f96
      Aaron Patterson 提交于
      This reverts commit 02b216e5.
      This reverts commit 9b8825b6.
      
      I found that combining sweep and move is not safe.  I don't think that
      we can do compaction concurrently with _anything_ unless there is a read
      barrier installed.
      
      Here is a simple example.  A class object is freed, and during it's free
      step, it tries to remove itself from its parent's subclass list.
      However, during the sweep step, the parent class was moved and the
      "currently being freed" class didn't have references updated yet.  So we
      get a segv like this:
      
      ```
      (lldb) bt
      * thread #1, name = 'ruby', stop reason = signal SIGSEGV
        * frame #0: 0x0000560763e344cb ruby`rb_st_lookup at st.c:320:43
          frame #1: 0x0000560763e344cb ruby`rb_st_lookup(tab=0x2f7469672f6e6f72, key=3809, value=0x0000560765bf2270) at st.c:1010
          frame #2: 0x0000560763e8f16a ruby`rb_search_class_path at variable.c:99:9
          frame #3: 0x0000560763e8f141 ruby`rb_search_class_path at variable.c:145
          frame #4: 0x0000560763e8f141 ruby`rb_search_class_path(klass=94589785585880) at variable.c:191
          frame #5: 0x0000560763ec744e ruby`rb_vm_bugreport at vm_dump.c:996:17
          frame #6: 0x0000560763f5b958 ruby`rb_bug_for_fatal_signal at error.c:675:5
          frame #7: 0x0000560763e27dad ruby`sigsegv(sig=<unavailable>, info=<unavailable>, ctx=<unavailable>) at signal.c:955:5
          frame #8: 0x00007f8b891d33c0 libpthread.so.0`___lldb_unnamed_symbol1$$libpthread.so.0 + 1
          frame #9: 0x0000560763efa8bb ruby`rb_class_remove_from_super_subclasses(klass=94589790314280) at class.c:93:56
          frame #10: 0x0000560763d10cb7 ruby`gc_sweep_step at gc.c:2674:2
          frame #11: 0x0000560763d1187b ruby`gc_sweep at gc.c:4540:2
          frame #12: 0x0000560763d101f0 ruby`gc_start at gc.c:6797:6
          frame #13: 0x0000560763d15153 ruby`rb_gc_compact at gc.c:7479:12
          frame #14: 0x0000560763eb4eb8 ruby`vm_exec_core at vm_insnhelper.c:5183:13
          frame #15: 0x0000560763ea9bae ruby`rb_vm_exec at vm.c:1953:22
          frame #16: 0x0000560763eac08d ruby`rb_yield at vm.c:1132:9
          frame #17: 0x0000560763edb4f2 ruby`rb_ary_collect at array.c:3186:9
          frame #18: 0x0000560763e9ee15 ruby`vm_call_cfunc_with_frame at vm_insnhelper.c:2575:12
          frame #19: 0x0000560763eb2e66 ruby`vm_exec_core at vm_insnhelper.c:4177:11
          frame #20: 0x0000560763ea9bae ruby`rb_vm_exec at vm.c:1953:22
          frame #21: 0x0000560763eac08d ruby`rb_yield at vm.c:1132:9
          frame #22: 0x0000560763edb4f2 ruby`rb_ary_collect at array.c:3186:9
          frame #23: 0x0000560763e9ee15 ruby`vm_call_cfunc_with_frame at vm_insnhelper.c:2575:12
          frame #24: 0x0000560763eb2e66 ruby`vm_exec_core at vm_insnhelper.c:4177:11
          frame #25: 0x0000560763ea9bae ruby`rb_vm_exec at vm.c:1953:22
          frame #26: 0x0000560763ceee01 ruby`rb_ec_exec_node(ec=0x0000560765afa530, n=0x0000560765b088e0) at eval.c:296:2
          frame #27: 0x0000560763cf3b7b ruby`ruby_run_node(n=0x0000560765b088e0) at eval.c:354:12
          frame #28: 0x0000560763cee4a3 ruby`main(argc=<unavailable>, argv=<unavailable>) at main.c:50:9
          frame #29: 0x00007f8b88e560b3 libc.so.6`__libc_start_main + 243
          frame #30: 0x0000560763cee4ee ruby`_start + 46
      (lldb) f 9
      frame #9: 0x0000560763efa8bb ruby`rb_class_remove_from_super_subclasses(klass=94589790314280) at class.c:93:56
         90
         91  		*RCLASS_EXT(klass)->parent_subclasses = entry->next;
         92  		if (entry->next) {
      -> 93  		    RCLASS_EXT(entry->next->klass)->parent_subclasses = RCLASS_EXT(klass)->parent_subclasses;
         94  		}
         95  		xfree(entry);
         96  	    }
      (lldb) command script import -r misc/lldb_cruby.py
      lldb scripts for ruby has been installed.
      (lldb) rp entry->next->klass
      (struct RMoved) $1 = (flags = 30, destination = 94589792806680, next = 94589784369160)
      (lldb)
      ```
      62ce8f96
    • B
      Enhanced Rdoc for Array (#3193) · b85b8663
      Burdette Lamar 提交于
      Methods:
      
          #freeze
          #<<
          #push
          #pop
          #shift
          #unshift
          #slice
          #at
          #first
          #last
      b85b8663
    • G
      * 2020-06-10 [ci skip] · 6c5cdc88
      git 提交于
      6c5cdc88
    • A
      Freeing cc tables doesn't need access to ID · 2ba2b32d
      Aaron Patterson 提交于
      We don't need to resolve symbols when freeing cc tables, so this commit
      just changes the id table iterator to look at values rather than keys
      and values.
      2ba2b32d
  2. 09 6月, 2020 36 次提交
    • H
      the default gems couldn't use ruby2_keywords gem. · 7f3efee1
      Hiroshi SHIBATA 提交于
        We avoid to use the current delegate library under the Ruby 2.7.
      7f3efee1
    • N
      Use the dedicated conversion macro · cbb9935f
      Nobuyoshi Nakada 提交于
      cbb9935f
    • N
      Improved assertions · 101d56dd
      Nobuyoshi Nakada 提交于
      101d56dd
    • H
      Added ruby2_keywords for Ruby 2.6 and 2.5 · c8cd6b20
      Hiroshi SHIBATA 提交于
      c8cd6b20
    • P
    • H
    • D
    • H
    • N
      Return seconds slept after Thread.scheduler wait_sleep · b6bae0ec
      nicholas a. evans 提交于
      Kernel#sleep should still return seconds slept, even when using a
      Thread.scheduler. The return value of Scheduler#wait_sleep can be
      ignored.
      b6bae0ec
    • N
      Removed + token from single test runner recipes [ci skip] · 96482949
      Nobuyoshi Nakada 提交于
      These test runners do not deal with `-n` make flag.
      96482949
    • K
      disable GC on a test · 195075e8
      Koichi Sasada 提交于
      CI fails with GC while `foo{}`, so that disable GC for this script.
      195075e8
    • H
      Added CodeQL scanning by GitHub (#3196) · 366646c1
      Hiroshi SHIBATA 提交于
      Added configuration for CodeQL scanning by GitHub
      366646c1
    • mjit_mark_cc_entries: should consider VM_CALLCACHE_UNMARKABLE · f4950145
      卜部昌平 提交于
      Now that vm_empty_cc is VM_CALLCACHE_UNMARKABLE, it has to be properly
      ruled out from being GCed.
      f4950145
    • .github: add test for -DMJIT_FORCE_ENABLE · adfd4f39
      卜部昌平 提交于
      adfd4f39
    • T
    • rb_eql_opt,rb_equal_opt: purge stale cc · 1016cff4
      卜部昌平 提交于
      When on USE_EMBED_CI, cd is stored statically.  Previous use could cache
      stale cd->cc, which could have already been GCed.  Need flush them.
      1016cff4
    • vm_ccs_push: do not cache non-heap entries · ffe58b9c
      卜部昌平 提交于
      Entires not GC-able must be considered to be volatile.  Not eligible for
      later use.
      ffe58b9c
    • VM_CI_NEW_ID: USE_EMBED_CI could be false · e1e84fbb
      卜部昌平 提交于
      It was a wrong idea to assume CIs are always embedded.
      e1e84fbb
    • eliminate C99 compound literals · 324038c6
      卜部昌平 提交于
      Ko1 prefers variables be assgined, instead of bare literals in function
      arguments.
      324038c6
    • vm_empty_cc: fix MSVC compile error · 98d099be
      卜部昌平 提交于
      Seems they do not allow compound literals for static variables. See
      https://github.com/ruby/ruby/runs/733735274
      98d099be
    • vm_call_method: use struct assignment · 4fbe86d0
      卜部昌平 提交于
      This further reduces the generated binary of vm_call_method from 566
      bytes to 545 bytes on my machine, according to nm(1).
      4fbe86d0
    • vm_empty_cc: refactor use macro · 88e67997
      卜部昌平 提交于
      88e67997
    • rb_vm_call0: on-stack call info · 46728557
      卜部昌平 提交于
      This changeset reduces the generated binary of rb_vm_call0 from 281
      bytes to 211 bytes on my machine.  Should reduce GC pressure as well.
      46728557
    • vm_yield_setup_args: refactor use macro · db406daa
      卜部昌平 提交于
      db406daa
    • vm_call_method: no call vm_cc_fill · 367263c3
      卜部昌平 提交于
      This changeset reduces the generated binary of vm_call_method from 600
      bytes to 566 bytes on my machine, accroding to nm(1).
      367263c3
    • vm_call_refined: no call vm_cc_fill · fb3f1f95
      卜部昌平 提交于
      This changeset reduces the generated binary of vm_call_method_each_type
      from 2,442 bytes to 2,378 bytes on my machine, accroding to nm(1).
      fb3f1f95
    • vm_call_zsuper: no call vm_cc_fill · be5dfdd8
      卜部昌平 提交于
      This changeset reduces the generated binary of vm_call_method_each_type
      from 2,522 bytes to 2,442 bytes on my machine, accroding to nm(1).
      be5dfdd8
    • vm_call_method_missing_body: on-stack call info · dbbde61c
      卜部昌平 提交于
      This changeset reduces the generated binary of
      vm_call_method_missing_body from 604 bytes to 532 bytes on my machine.
      Should reduce GC pressure as well.
      dbbde61c
    • vm_call_symbol: on-stack call info · 9c287f8c
      卜部昌平 提交于
      This changeset reduces the generated binary of vm_call_symbol from 808
      bytes to 798 bytes on my machine.  Should reduce GC pressure as well.
      9c287f8c
    • vm_call_alias: no call vm_cc_fill · 62b471bd
      卜部昌平 提交于
      This changeset reduces the generated binary of vm_call_alias from 188
      bytes to 149 bytes on my machine, accroding to nm(1).
      62b471bd
    • rb_eql_opt: fully static call data · 97f45637
      卜部昌平 提交于
      This changeset reduces the generated binary of rb_eql_opt from 86 bytes to
      20 bytes on my machine, according to nm(1).
      97f45637
    • rb_vm_search_method_slowpath: skip vm_empty_cc · 3da9c519
      卜部昌平 提交于
      Now that vm_empty_cc is statically allocated outside of the object
      space.  It shall not be GCed.  Here, because vm_search_cc can return
      that.  Must not be blindly passed to RB_OBJ_WRITE, unless assertions
      fail on RGENGC_CHECK_MODE, like this:
      
      -- C level backtrace information
      -------------------------------------------
      ruby(rb_print_backtrace+0x19) [0x5555557fd579] vm_dump.c:757
      ruby(rb_vm_bugreport+0x151) [0x5555557fd6f1] vm_dump.c:955
      ruby(rb_bug+0x1d6) [0x5555558d6396] error.c:660
      ruby(check_rvalue_consistency_force+0x707) [0x5555555adb97] gc.c:1289
      ruby(check_rvalue_consistency+0x1a) [0x555555598a0a] gc.c:1305
      ruby(RVALUE_OLD_P+0x15) [0x5555555975d5] gc.c:1382
      ruby(rb_gc_writebarrier+0x9f) [0x55555559753f] gc.c:6882
      ruby(rb_obj_written+0x3a) [0x5555557a025a] include/ruby/internal/rgengc.h:180
      ruby(rb_obj_write+0x41) [0x5555557a1a81] include/ruby/internal/rgengc.h:195
      ruby(rb_vm_search_method_slowpath+0x5a) [0x5555557a125a] vm_insnhelper.c:1603
      ruby(vm_search_method_fastpath+0x197) [0x5555557d8027] vm_insnhelper.c:1638
      ruby(vm_search_method+0xea) [0x5555557d7d2a] vm_insnhelper.c:1650
      ruby(vm_search_method_wrap+0x29) [0x5555557dbaf9] vm_insnhelper.c:4091
      ruby(vm_sendish+0xa9) [0x5555557dba39] vm_insnhelper.c:4143
      ruby(vm_exec_core+0xe357) [0x5555557b0757] insns.def:801
      ruby(rb_vm_exec+0x12c) [0x5555557d17cc] vm.c:1942
      ruby(invoke_block+0xea) [0x5555557f42fa] vm.c:1058
      ruby(invoke_iseq_block_from_c+0x16e) [0x5555557f3eae] vm.c:1130
      ruby(invoke_block_from_c_bh) vm.c:1148
      ruby(vm_yield+0x71) [0x5555557f3c41] vm.c:1193
      ruby(rb_yield_0+0x25) [0x5555557ca615] vm_eval.c:1141
      ruby(rb_yield_1+0x27) [0x5555557ca5c7] vm_eval.c:1147
      ruby(rb_yield+0x34) [0x5555557ca654] vm_eval.c:1157
      ruby(rb_ary_collect+0xb0) [0x555555828320] array.c:3186
      ruby(call_cfunc_0+0x29) [0x5555557f0f39] vm_insnhelper.c:2385
      ruby(vm_call_cfunc_with_frame+0x278) [0x5555557eca98] vm_insnhelper.c:2553
      ruby(vm_sendish+0xd0) [0x5555557dba60] vm_insnhelper.c:4146
      ruby(vm_exec_core+0xe0f8) [0x5555557b04f8] insns.def:782
      ruby(rb_vm_exec+0x12c) [0x5555557d17cc] vm.c:1942
      ruby(invoke_block+0xea) [0x5555557f42fa] vm.c:1058
      ruby(invoke_iseq_block_from_c+0x16e) [0x5555557f3eae] vm.c:1130
      ruby(invoke_block_from_c_bh) vm.c:1148
      ruby(vm_yield+0x71) [0x5555557f3c41] vm.c:1193
      ruby(rb_yield_0+0x25) [0x5555557ca615] vm_eval.c:1141
      ruby(rb_yield_1+0x27) [0x5555557ca5c7] vm_eval.c:1147
      ruby(rb_yield+0x34) [0x5555557ca654] vm_eval.c:1157
      ruby(rb_ary_each+0xa5) [0x55555581c795] array.c:2242
      ruby(call_cfunc_0+0x29) [0x5555557f0f39] vm_insnhelper.c:2385
      ruby(vm_call_cfunc_with_frame+0x278) [0x5555557eca98] vm_insnhelper.c:2553
      ruby(vm_sendish+0xd0) [0x5555557dba60] vm_insnhelper.c:4146
      ruby(vm_exec_core+0xe0f8) [0x5555557b04f8] insns.def:782
      ruby(rb_vm_exec+0x12c) [0x5555557d17cc] vm.c:1942
      ruby(invoke_block+0xea) [0x5555557f42fa] vm.c:1058
      ruby(invoke_iseq_block_from_c+0x16e) [0x5555557f3eae] vm.c:1130
      ruby(invoke_block_from_c_bh) vm.c:1148
      ruby(vm_yield+0x71) [0x5555557f3c41] vm.c:1193
      ruby(rb_yield_0+0x25) [0x5555557ca615] vm_eval.c:1141
      ruby(rb_yield_1+0x27) [0x5555557ca5c7] vm_eval.c:1147
      ruby(rb_yield+0x34) [0x5555557ca654] vm_eval.c:1157
      ruby(rb_ary_each+0xa5) [0x55555581c795] array.c:2242
      ruby(call_cfunc_0+0x29) [0x5555557f0f39] vm_insnhelper.c:2385
      ruby(vm_call_cfunc_with_frame+0x278) [0x5555557eca98] vm_insnhelper.c:2553
      ruby(vm_sendish+0xd0) [0x5555557dba60] vm_insnhelper.c:4146
      ruby(vm_exec_core+0xe0f8) [0x5555557b04f8] insns.def:782
      ruby(rb_vm_exec+0x19f) [0x5555557d183f] vm.c:1951
      ruby(rb_iseq_eval+0x30) [0x5555557d2530] vm.c:2190
      ruby(load_iseq_eval+0xd6) [0x5555555fa7e6] load.c:592
      ruby(require_internal+0x25e) [0x5555555f7f5e] load.c:1022
      ruby(rb_require_string+0x27) [0x5555555f74e7] load.c:1094
      ruby(rb_f_require_relative+0x5f) [0x5555555f758f] load.c:837
      ruby(call_cfunc_1+0x30) [0x5555557f0f70] vm_insnhelper.c:2391
      ruby(vm_call_cfunc_with_frame+0x278) [0x5555557eca98] vm_insnhelper.c:2553
      ruby(vm_call_cfunc+0xad) [0x5555557e521d] vm_insnhelper.c:2574
      ruby(vm_call_method_each_type+0xc7) [0x5555557e4af7] vm_insnhelper.c:3040
      ruby(vm_call_method+0x19c) [0x5555557e45dc] vm_insnhelper.c:3144
      ruby(vm_call_general+0x2d) [0x5555557c8c3d] vm_insnhelper.c:3176
      ruby(vm_sendish+0xd0) [0x5555557dba60] vm_insnhelper.c:4146
      ruby(vm_exec_core+0xe357) [0x5555557b0757] insns.def:801
      ruby(rb_vm_exec+0x12c) [0x5555557d17cc] vm.c:1942
      ruby(rb_iseq_eval_main+0x30) [0x5555557d2670] vm.c:2201
      ruby(rb_ec_exec_node+0x16b) [0x55555557e39b] eval.c:296
      ruby(ruby_run_node+0x72) [0x55555557e1f2] eval.c:354
      ruby(main+0x78) [0x55555557a5d8] main.c:50
      3da9c519
    • rb_equal_opt: fully static call data · 8f3d4090
      卜部昌平 提交于
      This changeset reduces the generated binary of rb_equal_opt from 129 bytes
      to 17 bytes on my machine, according to nm(1).
      8f3d4090
    • vm_ci_markable: added · 77293cef
      卜部昌平 提交于
      CIs are created on-the-fly, which increases GC pressure.  However they
      include no references to other objects, and those on-the-fly CIs tend to
      be short lived.  Why not skip allocation of them.  In doing so we need
      to add a flag denotes the CI object does not reside inside of objspace.
      77293cef
    • vm_search_method_fastpath: avoid rb_vm_empty_cc() · 3928c151
      卜部昌平 提交于
      This is such a hot path that it's worth eliminating a function call.  Use
      the static variable directly instead.
      3928c151
    • check_cfunc: add assertions · 877238f2
      卜部昌平 提交于
      For debug.  Must not change generated binary unless VM_ASSERT is on.
      877238f2