-
Notifications
You must be signed in to change notification settings - Fork 1
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
OTP 27 will break coverage support #20
Comments
|
I believe that
The BIF it's using to decide when to use native or emulator coverage |
I brought this up upstream in erlang/otp#8214 But it's not trivial to make native coverage configurable. Even if we can configure it, we would need to also modify rebar to be able to configure how rebar calls So for now I will put this down since I don't think it's worth the time investment. We can always call the original functions used in Khepri transactions in unit tests for coverage if needed. We will just need to gate the coverage tests when OTP 27 is released. |
Before OTP 27,
cover
worked by inserting code to docounters:add(CRef, LineIndex, 1)
around any significant code. TheCRef
is a counter for the original module's coverage, so Horus only needed to preserve those instructions in the standalone module in order to have the function's coverage count for the original module.OTP 27 introduces "native" coverage (introduced in erlang/otp#7856). The compiler now emits
executable_line
instructions when passed theforce_line_counters
(orline_coverage
option, depending on the system'scode:get_coverage_mode/0
). The JIT turns that that instruction into an atomic add or literal mov that updates a section of theBeamCodeHeader
'scoverage
buffer (see x86, arm).BeamCodeHeader
is a member of each module instance (erl_module_instance
) and the BIF thatcover
uses to read coverage information when native coverage is enabled reads from this new buffer from the current module. (As a consequence, old coverage is now no longer accessible after upgrading/reloading a module.)The old
cover
code is still around for architectures that use the emulator but we can't turn off native coverage on a JIT-enabled build of OTP.Since coverage information is now attached to module instances, I don't believe we can trick
cover
into counting executions of horus functions anymore.The text was updated successfully, but these errors were encountered: