diff options
| author | Lucas Perlind <perlindluca@gmail.com> | 2024-10-22 17:58:54 +1100 |
|---|---|---|
| committer | Lucas Perlind <perlindluca@gmail.com> | 2024-10-22 18:05:01 +1100 |
| commit | 28b26043fb1b036e94ff741b7409b1ef94587a09 (patch) | |
| tree | 90489e12bbc346165e0ccb0b92fd3436b54d4336 /src/main.cpp | |
| parent | 7c1922b0a7ed210fe9ce2c1c70c320fde7858c83 (diff) | |
cached.cpp: Improve internal cached robustness
Do not memory map files; Windows cannot write to a file that is memory
mapped.
Write cache after llvm building. This ensures the cache won't have a
false positive if llvm fails.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 04d3bdf52..1574ac544 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3391,6 +3391,7 @@ int main(int arg_count, char const **arg_ptr) { Parser *parser = gb_alloc_item(permanent_allocator(), Parser); Checker *checker = gb_alloc_item(permanent_allocator(), Checker); + bool failed_to_cache_parsing = false; MAIN_TIME_SECTION("parse files"); @@ -3480,6 +3481,7 @@ int main(int arg_count, char const **arg_ptr) { if (try_cached_build(checker, args)) { goto end_of_code_gen; } + failed_to_cache_parsing = true; } #if ALLOW_TILDE @@ -3545,18 +3547,23 @@ int main(int arg_count, char const **arg_ptr) { end_of_code_gen:; - if (build_context.show_timings) { - show_timings(checker, &global_timings); - } - if (build_context.export_dependencies_format != DependenciesExportUnspecified) { export_dependencies(checker); } + if (build_context.cached) { + MAIN_TIME_SECTION("write cached build"); + if (!build_context.build_cache_data.copy_already_done) { + try_copy_executable_to_cache(); + } - if (!build_context.build_cache_data.copy_already_done && - build_context.cached) { - try_copy_executable_to_cache(); + if (failed_to_cache_parsing) { + write_cached_build(checker, args); + } + } + + if (build_context.show_timings) { + show_timings(checker, &global_timings); } if (run_output) { |