summaryrefslogtreecommitdiff
path: root/ext/coverage
Commit message (Collapse)AuthorAgeFilesLines
* Update the depend filesMatt Valentine-House2023-02-281-1/+0
|
* Remove intern/gc.h from Make depsMatt Valentine-House2023-02-271-1/+0
|
* Merge gc.h and internal/gc.hMatt Valentine-House2023-02-092-2/+1
| | | | [Feature #19425]
* Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada2023-02-081-0/+1
| | | | | | | | | Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the macros bellow: * `RBIMPL_ATTR_PACKED_STRUCT_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_END` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
* Coverage.supported? recognizes oneshot_lines mode (#7040)Kevin Murphy2022-12-291-1/+2
| | | This adds oneshot_lines as a mode of coverage that is supported.
* Update dependenciesDaniel Colson2022-12-061-0/+1
|
* Fix typos (#6775)Yudai Takada2022-11-201-2/+2
| | | | | | | | | | | * s/Innteger/Integer/ * s/diretory/directory/ * s/Bufer/Buffer/ * s/defalt/default/ * s/covearge/coverage/
* Revert "Revert "This commit implements the Object Shapes technique in CRuby.""Jemma Issroff2022-10-111-0/+4
| | | | This reverts commit 9a6803c90b817f70389cae10d60b50ad752da48f.
* Revert "This commit implements the Object Shapes technique in CRuby."Aaron Patterson2022-09-301-4/+0
| | | | This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
* Add `Coverage.supported?` to detect what modes are supported.Samuel Williams2022-09-291-0/+29
|
* Add `eval: true/false` flag to `Coverage.setup`.Samuel Williams2022-09-291-10/+11
|
* This commit implements the Object Shapes technique in CRuby.Jemma Issroff2022-09-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* Revert this until we can figure out WB issues or remove shapes from GCAaron Patterson2022-09-261-4/+0
| | | | | | | | | | Revert "* expand tabs. [ci skip]" This reverts commit 830b5b5c351c5c6efa5ad461ae4ec5085e5f0275. Revert "This commit implements the Object Shapes technique in CRuby." This reverts commit 9ddfd2ca004d1952be79cf1b84c52c79a55978f4.
* This commit implements the Object Shapes technique in CRuby.Jemma Issroff2022-09-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-82/+82
| | | | [Misc #18891]
* Rust YJITAlan Wu2022-04-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In December 2021, we opened an [issue] to solicit feedback regarding the porting of the YJIT codebase from C99 to Rust. There were some reservations, but this project was given the go ahead by Ruby core developers and Matz. Since then, we have successfully completed the port of YJIT to Rust. The new Rust version of YJIT has reached parity with the C version, in that it passes all the CRuby tests, is able to run all of the YJIT benchmarks, and performs similarly to the C version (because it works the same way and largely generates the same machine code). We've even incorporated some design improvements, such as a more fine-grained constant invalidation mechanism which we expect will make a big difference in Ruby on Rails applications. Because we want to be careful, YJIT is guarded behind a configure option: ```shell ./configure --enable-yjit # Build YJIT in release mode ./configure --enable-yjit=dev # Build YJIT in dev/debug mode ``` By default, YJIT does not get compiled and cargo/rustc is not required. If YJIT is built in dev mode, then `cargo` is used to fetch development dependencies, but when building in release, `cargo` is not required, only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer. The YJIT command-line options remain mostly unchanged, and more details about the build process are documented in `doc/yjit/yjit.md`. The CI tests have been updated and do not take any more resources than before. The development history of the Rust port is available at the following commit for interested parties: https://github.com/Shopify/ruby/commit/1fd9573d8b4b65219f1c2407f30a0a60e537f8be Our hope is that Rust YJIT will be compiled and included as a part of system packages and compiled binaries of the Ruby 3.2 release. We do not anticipate any major problems as Rust is well supported on every platform which YJIT supports, but to make sure that this process works smoothly, we would like to reach out to those who take care of building systems packages before the 3.2 release is shipped and resolve any issues that may come up. [issue]: https://bugs.ruby-lang.org/issues/18481 Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com> Co-authored-by: Kevin Newton <kddnewton@gmail.com>
* [Feature #18249] Update dependenciesPeter Zhu2022-02-221-0/+1
|
* Fix typosNobuyoshi Nakada2021-11-021-1/+1
|
* Make Coverage suspendable (#4856)Yusuke Endoh2021-10-251-5/+118
| | | | | | | * Make Coverage suspendable Add `Coverage.suspend`, `Coverage.resume` and some methods. [Feature #18176] [ruby-core:105321]
* Tie lifetime of uJIT blocks to iseqsAlan Wu2021-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | * Tie lifetime of uJIT blocks to iseqs Blocks weren't being freed when iseqs are collected. * Add rb_dary. Use it for method dependency table * Keep track of blocks per iseq Remove global version_tbl * Block version bookkeeping fix * dary -> darray * free ujit_blocks * comment about size of ujit_blocks
* dependency updates卜部昌平2021-04-131-1/+0
|
* Expose atomic operation macros with RUBY prefixNobuyoshi Nakada2020-12-241-0/+1
| | | | | Now we need atomic operations, which are lighter than mutex, more widely for extension libraries because of Ractor.
* Document Different Coverage ModesKevin Murphy2020-11-201-1/+111
| | | | | | | This commits adds in documentation to illustrate the different modes you can start coverage with. Examples are provided to show how to start each of these modes, along with an explanation of the mode and a description of the output.
* Fix up dependencies on internal/sanitizers.hNobuyoshi Nakada2020-09-291-13/+14
|
* make ext/coverage ASAN friendlyAaron Patterson2020-09-281-0/+8
|
* sed -i '/rmodule.h/d'卜部昌平2020-08-271-1/+0
|
* sed -i '/r_cast.h/d'卜部昌平2020-08-271-1/+0
|
* sed -i '\,2/extern.h,d'卜部昌平2020-08-271-1/+0
|
* RHASH_TBL: is now ext-only卜部昌平2020-08-191-1/+2
| | | | | It seems almost no internal codes use RHASH_TBL any longer. Why not just eliminate it entirely, so that the macro can be purely ext-only.
* compile.c: Improve branch coverage instrumentation [Bug #16967]Yusuke Endoh2020-06-201-26/+52
| | | | | | | | | | | | | | Formerly, branch coverage measurement counters are generated for each compilation traverse of the AST. However, ensure clause node is traversed twice; one is for normal-exit case (the resulted bytecode is embedded in its outer scope), and the other is for exceptional case (the resulted bytecode is used in catch table). Two branch coverage counters are generated for the two cases, but it is not desired. This changeset revamps the internal representation of branch coverage measurement. Branch coverage counters are generated only at the first visit of a branch node. Visiting the same node reuses the already-generated counter, so double counting is avoided.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-140/+140
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-140/+140
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+152
| | | Split ruby.h
* Updated dependencies on internal/warnings.hNobuyoshi Nakada2019-12-311-0/+1
| | | | | Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`* macros.
* update dependencies卜部昌平2019-12-261-0/+10
|
* decouple internal.h headers卜部昌平2019-12-261-1/+3
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Update dependenciesNobuyoshi Nakada2019-11-181-17/+0
|
* Revert https://github.com/ruby/ruby/pull/2486卜部昌平2019-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 << Integer alias org_sqrt sqrt def sqrt(n) raise end GC.stress = true Prime.each(7*37){} rescue nil # <- Here we populate CC class << 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 # <- SEGV ```
* refactor constify most of rb_method_entry_t卜部昌平2019-09-301-1/+1
| | | | | | | | | | | 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.
* Split RUBY_ASSERT and so on under include/rubyNobuyoshi Nakada2019-07-141-0/+1
|
* * expand tabs.git2019-07-031-1/+1
|
* Use rb_ident_hash_new instead of rb_hash_new_compare_by_idNobuyoshi Nakada2019-07-031-1/+1
| | | | The latter is same as the former, removed the duplicate function.
* Removed moving toplevel header since r12501nobu2019-02-081-2/+2
| | | | | | | Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/coverage/lib/coverage.rb (Coverage.line_stub): use only line eventsmame2018-12-201-1/+1
| | | | | | | | It wrongly used all linenos of ISeq#trace_points which includes not only line events but also call, return, and other events. So, the result included some linenos that can not be covered at all by line coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-10-201-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/coverage/: add the oneshot modemame2018-10-202-12/+63
| | | | | | | | | | | | 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
* update dependenciesnobu2018-01-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/coverage/coverage.c: remove COVERAGE_EXPERIMENTAL_MODEmame2017-12-121-8/+1
| | | | | | A NEWS entry is also added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/coverage/coverage.c: method coverage has column info. of method def.mame2017-12-051-2/+5
| | | | | | | | 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
* vm_core.h (rb_iseq_locatoin_t): add a field `code_range`mame2017-12-051-1/+1
| | | | | | | 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