[ruby-cvs:68204] mame:r61023 (trunk): Revamp method coverage to support define_method

mame at ruby-lang.org mame at ruby-lang.org
Tue Dec 5 16:16:43 JST 2017


mame	2017-12-05 16:16:42 +0900 (Tue, 05 Dec 2017)

  New Revision: 61023

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61023

  Log:
    Revamp method coverage to support define_method
    
    Traditionally, method coverage measurement was implemented by inserting
    `trace2` instruction to the head of method iseq.  So, it just measured
    methods defined by `def` keyword.
    
    This commit drastically changes the measuring mechanism of method
    coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t*
    to runs (i.e., it counts the runs per method entry), and at
    `Coverage.result`, it creates the result hash by enumerating all
    `rb_method_entry_t*` objects (by `ObjectSpace.each_object`).

  Modified files:
    trunk/compile.c
    trunk/ext/coverage/coverage.c
    trunk/hash.c
    trunk/internal.h
    trunk/iseq.h
    trunk/method.h
    trunk/test/coverage/test_coverage.rb
    trunk/thread.c
    trunk/tool/run-lcov.rb
    trunk/tool/test-coverage.rb
    trunk/vm_core.h


More information about the ruby-cvs mailing list