[ruby-cvs:78748] d7a50a5cc6 (master): Avoid revisiting seen nodes clearing method cache

"John Hawthorn" <[email protected]>
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
John Hawthorn	2019-12-12 06:10:39 +0900 (Thu, 12 Dec 2019)

  New Revision: d7a50a5cc6

  https://github.com/ruby/ruby/commit/d7a50a5cc6

  Log:
    Avoid revisiting seen nodes clearing method cache
    
    rb_clear_method_cache_by_class calls rb_class_clear_method_cache
    recursively on subclasses, where it will bump the class serial and clear
    some other data (callable_m_tbl, and some mjit data).
    
    Previously this could end up taking a long time to clear all the classes
    if the module was included a few levels deep and especially if there
    were multiple paths to it in the dependency tree (ie. a class includes
    two modules which both include the same other module) as we end up
    revisiting class/iclass/module objects multiple times.
    
    This commit avoids revisiting the same object, by short circuiting when
    revisit the same object. We can check this efficiently by comparing the
    class serial of each object we visit with the next class serial at the
    start. We know that any objects with a higher class serial have already
    been visited.

  Modified files:
    vm_method.c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.