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

mandatory_only_cme should not be in def #5311

Merged
merged 1 commit into from
Dec 21, 2021
Merged

Conversation

ko1
Copy link
Contributor

@ko1 ko1 commented Dec 20, 2021

def (rb_method_definition_t) is shared by multiple callable
method entries (cme, rb_callable_method_entry_t).

There are two issues:

  • old -> young reference: cme1->def->mandatory_only_cme = monly_cme
    if cme1 is young and monly_cme is young, there is no problem.
    Howevr, another old cme2 can refer def, in this case, old cme2
    points young monly_cme and it violates gengc assumption.
  • cme can have different defined_class but monly_cme only has
    one defined_class. It does not make sense and monly_cme
    should be created for a cme (not def).

To solve these issues, this patch allocates monly_cme per cme.
cme does not have another room to store a pointer to the monly_cme,
so this patch introduces overloaded_cme_table, which is weak key map
[cme] -> [monly_cme].

def::body::iseqptr::monly_cme is deleted.

The first issue is reported by Alan Wu.

`def` (`rb_method_definition_t`) is shared by multiple callable
method entries (cme, `rb_callable_method_entry_t`).

There are two issues:

* old -> young reference: `cme1->def->mandatory_only_cme = monly_cme`
  if `cme1` is young and `monly_cme` is young, there is no problem.
  Howevr, another old `cme2` can refer `def`, in this case, old `cme2`
  points young `monly_cme` and it violates gengc assumption.
* cme can have different `defined_class` but `monly_cme` only has
  one `defined_class`. It does not make sense and `monly_cme`
  should be created for a cme (not `def`).

To solve these issues, this patch allocates `monly_cme` per `cme`.
`cme` does not have another room to store a pointer to the `monly_cme`,
so this patch introduces `overloaded_cme_table`, which is weak key map
`[cme] -> [monly_cme]`.

`def::body::iseqptr::monly_cme` is deleted.

The first issue is reported by Alan Wu.
@ko1 ko1 merged commit df48db9 into ruby:master Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant