Skip to content
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

elf: more incremental progress #21629

Merged
merged 18 commits into from
Oct 10, 2024
Merged

elf: more incremental progress #21629

merged 18 commits into from
Oct 10, 2024

Conversation

kubkon
Copy link
Member

@kubkon kubkon commented Oct 8, 2024

In order to track if we need to reparse paths and objects (including relocatables, archives and shared objects) I've decided to add the paths, files, and some flags to local cache but I haven't used the frontend mechanism to achieve this, well not yet anyhow since I wasn't sure how to best go about it. I would appreciate input on this especially from @andrewrk and @mlugg. Next in order to detect if we are running the link from scratch (i.e., if we should invalidate the cache) I'm committing a random uuid-like value for the linker run. Again, this is very much a PoC so any feedback and suggestions are more than welcome.

Now onto progress report. I hear from @mlugg that apparently with this patch incremental works enough to do some basic incremental updates on Andrew's tetris clone. I have also managed to get a simplistic update to building zig itself working too. Now, we are from incremental being actually usable but it's (some) progress.

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon closer examination, I don't think the frontend should be changed at all with regards to the cache. Instead, the linker should detect file metadata (size, inode, mtime, hash) upon first load of any given file, and with each update, detect if there have been any changes since the last update. The linker needs to always produce a correct output file no matter what changes have occurred. It can redo as much linking as necessary to accomplish this.

hash.add(obj.loption);
}
for (comp.c_object_table.keys()) |key| {
hash.addBytes(key.status.success.object_path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always access the wrong union field.

@kubkon
Copy link
Member Author

kubkon commented Oct 9, 2024

Upon closer examination, I don't think the frontend should be changed at all with regards to the cache. Instead, the linker should detect file metadata (size, inode, mtime, hash) upon first load of any given file, and with each update, detect if there have been any changes since the last update. The linker needs to always produce a correct output file no matter what changes have occurred. It can redo as much linking as necessary to accomplish this.

Sounds good. So the most effective way of accomplishing this would be to serialize this and save to state and then restore from the said state, do I understand this right?

@andrewrk
Copy link
Member

andrewrk commented Oct 9, 2024

I rebased, removing the cache management stuff. Now I'll work on adding some commits to demonstrate the strategy I have in mind for this.

@kubkon
Copy link
Member Author

kubkon commented Oct 9, 2024

I rebased, removing the cache management stuff. Now I'll work on adding some commits to demonstrate the strategy I have in mind for this.

Nice, looking forward to it!

@andrewrk andrewrk merged commit 2e29277 into master Oct 10, 2024
10 checks passed
@andrewrk andrewrk deleted the elf-incr branch October 10, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants