Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix complex transi compact #547

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Commits on Nov 16, 2023

  1. Configuration menu
    Copy the full SHA
    3bc41f4 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. Skip test_ForwardingArgumentsNode

    due to a failure on a CI
    
    http://ci.rvm.jp/results/trunk-iseq_binary@ruby-sp2-docker/4779277
    ```
    expected:
    == disasm: #<ISeq:prism_test_forwarding_arguments_node1@<compiled>:2 (2,8)-(4,11)>
    local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: 1])
    [ 1] "..."@0
    0000 putself                                                          (   3)
    0001 getlocal_WC_0                          ?@-2
    0003 splatarray                             false
    0005 getblockparamproxy                     ?@-1, 0
    0008 send                                   <calldata!mid:prism_test_forwarding_arguments_node, argc:1, ARGS_SPLAT|ARGS_BLOCKARG|FCALL>, nil
    0011 leave                                                            (   2)
    actual:
    == disasm: #<ISeq:prism_test_forwarding_arguments_node1@<compiled>:2 (2,8)-(4,11)>
    local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: 1])
    [ 1] "..."@0
    0000 putself                                                          (   3)
    0001 getlocal_WC_0                          ?@-2
    0003 splatarray                             false
    0005 getblockparamproxy                     "!"@-1, 0
    0008 send                                   <calldata!mid:prism_test_forwarding_arguments_node, argc:1, ARGS_SPLAT|ARGS_BLOCKARG|FCALL>, nil
    0011 leave                                                            (   2)
    /tmp/ruby/src/trunk-iseq_binary/tool/lib/iseq_loader_checker.rb:36:in `exit': exit (SystemExit)
    ```
    mame committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    498b086 View commit details
    Browse the repository at this point in the history
  2. Refactor rb_obj_evacuate_ivs_to_hash_table

    That function is a bit too low level to called from multiple
    places. It's always used in tandem with `rb_shape_set_too_complex`
    and both have to know how the object is laid out to update the
    `iv_ptr`.
    
    So instead we can provide two higher level function:
    
      - `rb_obj_copy_ivs_to_hash_table` to prepare a `st_table` from an
        arbitrary oject.
      - `rb_obj_convert_to_too_complex` to assign the new `st_table`
        to the old object, and safely free the old `iv_ptr`.
    
    Unfortunately both can't be combined into one, because `rb_obj_copy_ivar`
    need `rb_obj_copy_ivs_to_hash_table` to copy from one object
    to another.
    byroot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    94c9f16 View commit details
    Browse the repository at this point in the history
  3. size_pool_idx_for_size: Include debugging info in error message

    We ran into that case on our CI, including some sizes would help
    debug it much easier.
    byroot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    940f2e7 View commit details
    Browse the repository at this point in the history
  4. [ruby/prism] Add macTurkish

    haldun authored and matzbot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    4a26a65 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9ba49c6 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c2f2090 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    db4303f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e5d6b40 View commit details
    Browse the repository at this point in the history
  9. [ruby/prism] Add macUkraine

    haldun authored and matzbot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    85dcfef View commit details
    Browse the repository at this point in the history
  10. [ruby/prism] Add macRoman

    haldun authored and matzbot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    0a081a3 View commit details
    Browse the repository at this point in the history
  11. [ruby/prism] Add macThai

    haldun authored and matzbot committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    50b7b92 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    229f6e5 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    585fdfe View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    cbdac2f View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    7c99e43 View commit details
    Browse the repository at this point in the history
  16. Fix corruption when out of shape during ivar remove

    Reproduction script:
    
    ```
    o = Object.new
    10.times { |i| o.instance_variable_set(:"@A#{i}", i) }
    
    i = 0
    a = Object.new
    while RubyVM::Shape.shapes_available > 2
      a.instance_variable_set(:"@i#{i}", 1)
      i += 1
    end
    
    o.remove_instance_variable(:@a0)
    
    puts o.instance_variable_get(:@A1)
    ```
    
    Before this patch, it would incorrectly output `2` and now it correctly
    outputs `1`.
    peterzhu2118 committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    3dd77bc View commit details
    Browse the repository at this point in the history
  17. Fix File.directory? doc hidding File::Stat#directory? doc

    Now the documentation that was already in the codebase for
    `File::Stat#directory?` shows up.
    robotdana authored Nov 17, 2023
    Configuration menu
    Copy the full SHA
    ef72970 View commit details
    Browse the repository at this point in the history
  18. Fix ordering for auto compaction in get_overloaded_cme()

    Found through GC.stress + GC.auto_compact crashes in rubyGH-8932.
    Previously, the compaction run within `rb_method_entry_alloc()` could
    move the `def->body.iseq.cref` and `iseqptr` set up before the call and
    leave the `def` pointing to moved addresses. Nothing was marking `def`
    during that GC run.
    
    Low probability reproducer:
    
        GC.stress = true
        GC.auto_compact = true
        arr = []
        alloc = 1000.times.map { [] }
        alloc = nil
        a = arr.first
        GC.start
    XrXr authored Nov 17, 2023
    Configuration menu
    Copy the full SHA
    24fe22a View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. Configuration menu
    Copy the full SHA
    f479e62 View commit details
    Browse the repository at this point in the history
  2. Pin object ivars while they are being copied in a hash

    When transitioning an object to TOO_COMPLEX we copy all its
    ivar in a table, but if GC (and compaction) trigger in the middle
    of the transition, the old `iv_ptr` might still be the canonical
    ivar list and will be updated by the GC, but the reference we
    copied in the table will be outdated.
    
    So we must pin these reference until they are all copied and
    the object `iv_ptr` is pointing to the table.
    
    To do this we allocate a temporary TOO_COMPLEX object
    which we use as the host for the copy. TOO_COMPLEX objects
    are marked with `mark_tbl` which does pin references.
    
    Co-Authored-By: Alan Wu <XrXr@users.noreply.github.com>
    byroot and XrXr committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    97fb07d View commit details
    Browse the repository at this point in the history