diff --git a/README.md b/README.md index 420cbbd..249ebf7 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ Ready-to-adapt workflow examples: --compdb= alias for --compile-commands --compdb-fast drops heavy build flags for faster analysis --include-compdb-deps includes `_deps` entries when inputs are auto-discovered from compile_commands.json ---jobs= parallel jobs for multi-file loading/analysis and cross-TU resource summary build (default: 1) +--jobs= parallel jobs for the cross-TU summaries of multi-file runs (default: auto) --escape-model= loads external noescape rules for stack pointer escape analysis (`noescape_arg`) --buffer-model= loads external buffer write rules for copy/string overflow checks (`bounded_write`/`unbounded_write`) --resource-model= loads external acquire/release rules for generic resource lifetime checks @@ -295,7 +295,7 @@ To generate `compile_commands.json` with CMake, configure with If analysis feels slow, `--compdb-fast` disables heavy flags (optimizations, sanitizers, profiling) while keeping include paths and macros. -For multi-file runs, `--jobs=` parallelizes input loading; with cross-TU enabled it also parallelizes summary construction. +For multi-file runs, `--jobs=` parallelizes the construction of cross-TU summaries; the inputs are loaded one at a time. `--compile-ir-cache-dir=` reuses compiled LLVM IR for unchanged translation units based on source/dependency stamps, which reduces repeated C/C++ frontend cost across runs. IR that another compiler produced (another coretrace-compiler revision or LLVM version) is compiled again. @@ -574,7 +574,7 @@ Cross-TU summary behavior: - `--no-resource-cross-tu` forces local-only (single-file) resource reasoning. - `--resource-summary-cache-dir=` controls where per-module summary cache files are stored. - `--resource-summary-cache-memory-only` disables filesystem cache writes and uses an in-process cache only. -- `--jobs=` parallelizes module loading/compilation and per-module summary extraction during each fixpoint iteration. +- `--jobs=` parallelizes per-module summary extraction during each fixpoint iteration; modules are loaded one at a time. - The CLI prints an explicit status line to `stderr` to indicate whether resource inter-procedural analysis is enabled or unavailable/disabled (with reason). - If a local release depends on an unmodeled/external callee and no summary is available, the tool diff --git a/main.cpp b/main.cpp index 5ad7ec0..80bd486 100644 --- a/main.cpp +++ b/main.cpp @@ -51,8 +51,8 @@ static void printHelp() << " --compdb-fast Speed up compdb builds (drops heavy flags)\n" << " --include-compdb-deps Include _deps entries when auto-discovering files from " "compile_commands.json\n" - << " --jobs= Parallel jobs for multi-file loading/analysis and cross-TU " - "summary build (default: 1)\n" + << " --jobs= Parallel jobs for the cross-TU summaries of multi-file runs " + "(default: auto)\n" << " If no input files are provided, supported files are loaded\n" << " from compile_commands.json automatically.\n" << " --timing Print compilation/analysis timing to stderr\n" diff --git a/src/app/AnalyzerApp.cpp b/src/app/AnalyzerApp.cpp index 54f3e66..500e329 100644 --- a/src/app/AnalyzerApp.cpp +++ b/src/app/AnalyzerApp.cpp @@ -957,17 +957,12 @@ static AppStatus analyzeWithSharedModuleLoading(const std::vector& loadSucceeded[index] = 1; }; - const unsigned loadJobs = resolveConfiguredJobs(cfg); - if (loadJobs <= 1 || inputFilenames.size() <= 1) - { - for (std::size_t index = 0; index < inputFilenames.size(); ++index) - loadSingleModule(index); - } - else - { - runParallelWork(inputFilenames.size(), loadJobs, - [&](std::size_t index) { loadSingleModule(index); }); - } + // One input after the other, on this thread, whatever --jobs. The compilations are serialized + // (InputPipeline.cpp): a loading worker would only parse its bitcode in parallel, while glibc + // would give it an arena of its own and keep there the memory its compilation freed, about one + // compilation per worker for the rest of the run. The cross-TU summaries below still use --jobs. + for (std::size_t index = 0; index < inputFilenames.size(); ++index) + loadSingleModule(index); std::vector orderedLoadedModules; orderedLoadedModules.reserve(inputFilenames.size());