Repository navigation
exp(cov): GCC JIT gcov + Codecov mapping via c_runtime_cov.h - #49
Merged
Merged
Conversation
When USE_COV is on, pass -fprofile-arcs/-ftest-coverage/--coverage into the GCC JIT compile/link of generated C, place temps under build/jit_cov, use a two-step .c→.o→.so so .gcno/.gcda names stay harvestable, and keep the .c after unload for lcov. TCC path unchanged.
When USE_COV instruments GCC JIT (see prior commit), .gcno/.gcda land under build/jit_cov. The previous lcov --extract kept only src/* and include/*, so those hits were dropped before Codecov upload. Extract policy: still one capture of --directory build (--no-external), then --extract src/* + include/* + build/jit_cov/*. That keeps host sources and JIT-emitted fakelua_jit_*.c, and drops #line-remapped .lua paths plus /usr/CPM noise. Add --ignore-errors inconsistent because JIT #line → .lua confuses lcov end-line checks (and some host TUs trip the same). unit_tests already exercise AllJitTypes (incl. GCC); TCC remains uninstrumented.
Codecov cannot usefully browse build/jit_cov/fakelua_jit_*.c. Add src/compile/c_runtime_cov.h as a view-only copy of the kCRuntimeHeader C body and have CGen wrap that paste with #line 1 "src/compile/c_runtime_cov.h" so gcov attributes FlFastAlloc etc. to a real in-repo path under src/. Reset to <fakelua-generated> afterward so per-TU preamble/boilerplate and later #line→.lua mapping are unchanged. kCRuntimeHeader remains the compile-time source of truth; a unit test asserts the view file stays byte-identical to the raw-string body. CI extract already covers src/*; keep build/jit_cov/* as a residual net.
Exclude Codecov twin c_runtime_cov.h from cppcheck (body lived in kCRuntimeHeader string before and tripped returnDanglingLifetime FPs). Initialize key CVar.flag_ = 0 to match existing runtime init pattern; keep view and SoT byte-synced.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #49 +/- ##
==========================================
+ Coverage 88.45% 88.49% +0.04%
==========================================
Files 124 125 +1
Lines 26109 27211 +1102
==========================================
+ Hits 23095 24081 +986
- Misses 3014 3130 +116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-applies the wiped #47 coverage work onto current
master(a6fe459, which already includes #48). The old PR had been merged, then disappeared whenmasterwas force-updated; this branch cherry-picks only the coverage commits (with #48 conflict resolutions preserved).Enable usable Codecov signal for GCC JIT-emitted runtime C under
USE_COV.Changes
USE_COV) — When coverage is on, pass-fprofile-arcs/-ftest-coverage/--coverageinto the GCC JIT compile/link of generated C, place temps underbuild/jit_cov, use a two-step.c→.o→.soso.gcno/.gcdastay harvestable, and keep the.cafter unload for lcov. TCC path unchanged.jit_cov— After onelcov --directory buildcapture,--extractkeepssrc/*,include/*, andbuild/jit_cov/*so JIT hits are not dropped before Codecov upload. Adds--ignore-errors inconsistentfor#line→.luaend-line noise.#linemapping — Codecov cannot usefully browsebuild/jit_cov/fakelua_jit_*.c. Add checked-insrc/compile/c_runtime_cov.h(byte-identical view ofkCRuntimeHeader) and wrap the paste with#line 1 \"src/compile/c_runtime_cov.h\"so Fl* runtime hits map to an in-reposrc/path. Reset to<fakelua-generated>afterward so preamble /#line→.luastay unchanged.kCRuntimeHeaderremains the compile-time source of truth).CVar.flag_ = 0while keeping master'sUNLIKELY(perf(jit): optimize loop advance, closure call, condition comparisons and itoa #48) behavior.Caveats
USE_COV.c_runtime_cov.his ~87.8% in the measured run; residual gaps are expected for cold error/edge paths.build/jit_covandcoverage.inforemain gitignored artifacts — not committed.Commits
15f9a8eexp: instrument GCC JIT emitted C with gcov when USE_COV62197d7ci(cov): include build/jit_cov GCC JIT temps in Codecov uploadbd90271exp(cov): map GCC JIT Fl* runtime hits onto checked-in c_runtime_cov.hbf5ebe3fix(ci): silence cppcheck on c_runtime_cov view and init CVar.flag_Do not merge from this bot turn; review CI / Codecov first.