LATX, opt: Separate PE AOT caches by load address - #342
Draft
LaurenIsACoder wants to merge 9 commits into
Draft
Conversation
Replace file overwrites with atomic rename operations. Eliminate locks during AOT file reading. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Fix LATX AOT cache generation when temporary-file writes or publication fail. Write to an exclusive .tmp file, sync its contents, rename it over the final path, and sync the parent directory. Failure-injection coverage verifies that write and rename errors preserve the current final file. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Fix LATX lock-free readers invalidating a cache that a writer replaced concurrently. Take the writer lock and compare the opened and current inode before unlinking an invalid cache. The regression test covers both replaced and unchanged files. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Fix non-TU LATX AOT merges overwriting the final cache in place. Write the merged image to the same exclusive temporary path and let the outer publication step replace the final file atomically. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Fix LATX AOT builds where configuration headers expose bool with a different underlying type across translation units. Use int for the cross-file generation status while preserving boolean success semantics. The AOT-enabled non-TU affected objects compile with this declaration. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Add regression coverage for post-rename durability failures, legacy cache fragments, and stale temporary-file reclamation. The test runs only through the explicit LATX test configuration. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Publish a generated temporary file only when there is no prior cache or when the merge completed successfully. Preserve the current cache on load, validation, or merge failures. Remove deprecated A/B fragments under the writer lock, account stale .tmp files in cache reclamation, and report post-rename directory-sync failures without hiding the successful namespace update. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Allow LATX AOT caches with a deterministically invalid length or version trailer to recover under the writer lock. Keep the current file unchanged for transient open, seek, read, temporary-file, or merge failures. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Use a versioned, type-qualified cache identity for AOT files and include the full segment address for PE and cache mappings. Apply that identity consistently to generation, locking, merging, publication, loading, and the in-memory library tree. Build cache paths with bounds checks, keep runtime segment state separate from the AOT file type, and release address-specific cache mappings when their segment is removed. Add focused coverage for identity namespacing, distinct and same-page PE addresses, independent state/type fields, and lib-tree removal. Keep the test target out of normal product builds. Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
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
Compatibility
Existing unqualified AOT cache files are not reused by the v2 identity and will be rebuilt. This prevents stale caches from blocking or merging with address-specific caches.
Dependency
This branch is based on #341. The PR diff will shrink to the single 0005 commit after #341 merges.
Validation
Validated on LoongArch host
l1atc8d27d69f37a151433bbe0ffe9167f1120388f1e:test-latx-aot-pe-load-address.segment.c,aot.c,aot_lib.c, andaot_merge.cobjects compile successfully.tests=disabledproduct build completes.git diff --checkpasses; checkpatch reports no errors.