<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/ext/coverage/coverage.c, branch ruby_2_7</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Revert https://github.com/ruby/ruby/pull/2486</title>
<updated>2019-10-03T03:45:24+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2019-10-03T03:26:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=eb92159d72fc711387f7e17ffbaca1678f23fd47'/>
<id>eb92159d72fc711387f7e17ffbaca1678f23fd47</id>
<content type='text'>
This reverts commits: 10d6a3aca7 8ba48c1b85 fba8627dc1 dd883de5ba
6c6a25feca 167e6b48f1 7cb96d41a5 3207979278 595b3c4fdd 1521f7cf89
c11c5e69ac cf33608203 3632a812c0 f56506be0d 86427a3219 .

The reason for the revert is that we observe ABA problem around
inline method cache.  When a cache misshits, we search for a
method entry.  And if the entry is identical to what was cached
before, we reuse the cache.  But the commits we are reverting here
introduced situations where a method entry is freed, then the
identical memory region is used for another method entry.  An
inline method cache cannot detect that ABA.

Here is a code that reproduce such situation:

```ruby
require 'prime'

class &lt;&lt; Integer
  alias org_sqrt sqrt
  def sqrt(n)
    raise
  end

  GC.stress = true
  Prime.each(7*37){} rescue nil # &lt;- Here we populate CC
  class &lt;&lt; Object.new; end

  # These adjacent remove-then-alias maneuver
  # frees a method entry, then immediately
  # reuses it for another.
  remove_method :sqrt
  alias sqrt org_sqrt
end

Prime.each(7*37).to_a # &lt;- SEGV
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commits: 10d6a3aca7 8ba48c1b85 fba8627dc1 dd883de5ba
6c6a25feca 167e6b48f1 7cb96d41a5 3207979278 595b3c4fdd 1521f7cf89
c11c5e69ac cf33608203 3632a812c0 f56506be0d 86427a3219 .

The reason for the revert is that we observe ABA problem around
inline method cache.  When a cache misshits, we search for a
method entry.  And if the entry is identical to what was cached
before, we reuse the cache.  But the commits we are reverting here
introduced situations where a method entry is freed, then the
identical memory region is used for another method entry.  An
inline method cache cannot detect that ABA.

Here is a code that reproduce such situation:

```ruby
require 'prime'

class &lt;&lt; Integer
  alias org_sqrt sqrt
  def sqrt(n)
    raise
  end

  GC.stress = true
  Prime.each(7*37){} rescue nil # &lt;- Here we populate CC
  class &lt;&lt; Object.new; end

  # These adjacent remove-then-alias maneuver
  # frees a method entry, then immediately
  # reuses it for another.
  remove_method :sqrt
  alias sqrt org_sqrt
end

Prime.each(7*37).to_a # &lt;- SEGV
```
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor constify most of rb_method_entry_t</title>
<updated>2019-09-30T01:26:38+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2019-09-26T01:22:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=dd883de5ba311c38818d0f638a94b4fbc63f5ee5'/>
<id>dd883de5ba311c38818d0f638a94b4fbc63f5ee5</id>
<content type='text'>
Now that we have eliminated most destructive operations over the
rb_method_entry_t / rb_callable_method_entry_t, let's make them
mostly immutabe and mark them const.

One exception is rb_export_method(), which destructively modifies
visibilities of method entries.  I have left that operation as is
because I suspect that destructiveness is the nature of that
function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we have eliminated most destructive operations over the
rb_method_entry_t / rb_callable_method_entry_t, let's make them
mostly immutabe and mark them const.

One exception is rb_export_method(), which destructively modifies
visibilities of method entries.  I have left that operation as is
because I suspect that destructiveness is the nature of that
function.
</pre>
</div>
</content>
</entry>
<entry>
<title>* expand tabs.</title>
<updated>2019-07-02T17:13:25+00:00</updated>
<author>
<name>git</name>
<email>svn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2019-07-02T17:13:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c07165be1d2bccc9e1c67a90d16259a9c929b56d'/>
<id>c07165be1d2bccc9e1c67a90d16259a9c929b56d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use rb_ident_hash_new instead of rb_hash_new_compare_by_id</title>
<updated>2019-07-02T17:09:01+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-07-02T17:09:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bdddaa9f56702e1d3a58a14607e9881052424b53'/>
<id>bdddaa9f56702e1d3a58a14607e9881052424b53</id>
<content type='text'>
The latter is same as the former, removed the duplicate function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The latter is same as the former, removed the duplicate function.
</pre>
</div>
</content>
</entry>
<entry>
<title>* expand tabs.</title>
<updated>2018-10-20T05:33:13+00:00</updated>
<author>
<name>svn</name>
<email>svn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-10-20T05:33:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=807660197625d51ecf37082ce61c50916f0f3524'/>
<id>807660197625d51ecf37082ce61c50916f0f3524</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>ext/coverage/: add the oneshot mode</title>
<updated>2018-10-20T05:33:04+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-10-20T05:33:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=47ea999b4689fc591478a05da1670d2008a4a705'/>
<id>47ea999b4689fc591478a05da1670d2008a4a705</id>
<content type='text'>
This patch introduces "oneshot_lines" mode for `Coverage.start`, which
checks "whether each line was executed at least once or not", instead of
"how many times each line was executed".  A hook for each line is fired
at most once, and after it is fired, the hook flag was removed; it runs
with zero overhead.

See [Feature #15022] in detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces "oneshot_lines" mode for `Coverage.start`, which
checks "whether each line was executed at least once or not", instead of
"how many times each line was executed".  A hook for each line is fired
at most once, and after it is fired, the hook flag was removed; it runs
with zero overhead.

See [Feature #15022] in detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>ext/coverage/coverage.c: remove COVERAGE_EXPERIMENTAL_MODE</title>
<updated>2017-12-12T00:20:58+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-12-12T00:20:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9b1d8ab7d0ab45a81dcd682accd1b5d3441fec25'/>
<id>9b1d8ab7d0ab45a81dcd682accd1b5d3441fec25</id>
<content type='text'>
A NEWS entry is also added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A NEWS entry is also added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>ext/coverage/coverage.c: method coverage has column info. of method def.</title>
<updated>2017-12-05T08:56:51+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-12-05T08:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f6556c5c398190d21e59ce23ff814c6116fbd27e'/>
<id>f6556c5c398190d21e59ce23ff814c6116fbd27e</id>
<content type='text'>
This change makes method coverage result have not only first lineno of
method defintion, but also code range (i.e. first lineno, first column,
last lineno, and last column).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change makes method coverage result have not only first lineno of
method defintion, but also code range (i.e. first lineno, first column,
last lineno, and last column).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>vm_core.h (rb_iseq_locatoin_t): add a field `code_range`</title>
<updated>2017-12-05T08:56:50+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-12-05T08:56:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a5e02f249d398df2d3861f99ba9754061db562ff'/>
<id>a5e02f249d398df2d3861f99ba9754061db562ff</id>
<content type='text'>
This change makes each ISeq keep NODE's code range.  This information is
needed for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change makes each ISeq keep NODE's code range.  This information is
needed for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>Revamp method coverage to support define_method</title>
<updated>2017-12-05T07:16:42+00:00</updated>
<author>
<name>mame</name>
<email>mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-12-05T07:16:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0a6816ecd79fac5dfb32eb237f4c31bb45c9460d'/>
<id>0a6816ecd79fac5dfb32eb237f4c31bb45c9460d</id>
<content type='text'>
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`).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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`).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
