ref(symcache): Make parsing backwards-compatible#947
Open
loewenheim wants to merge 3 commits intomasterfrom
Open
ref(symcache): Make parsing backwards-compatible#947loewenheim wants to merge 3 commits intomasterfrom
loewenheim wants to merge 3 commits intomasterfrom
Conversation
This puts in some indirection to make it so that old symcache versions remain parseable, even if the on-disk format changes. For the two currently supported versions, 7 and 8, this is massive overkill because they only differ in how string lengths are serialized to the string table. The intention is to enable us to add data to the format without having to throw out every old symcache immediately.
jjbayer
reviewed
Dec 12, 2025
Member
There was a problem hiding this comment.
I haven't reviewed this properly, but why is there a raw:v7 but no raw:v8?
Contributor
Author
There was a problem hiding this comment.
Because v7 and v8 use the same on-disk structure. I could duplicate it but they would literally be character-for-character identical. I think I need to document this better.
Member
|
If the only difference between V7 and V8 is how it reads strings, I think there's a lot of potential to remove code duplication if you make trait Dialect {
fn get_string<'data>() -> &'data str;
}
struct V7;
impl Dialect for V7 {
fn get_string<'data>() -> &'data str {
...
}
}
struct SymCache<D = V7> {
_d: PhantomData<D>,
}
impl<D: Dialect> SymCache<D> {
fn do_something(&self) {
let s = D::get_string();
}
}
type SymCacheV8 = SymCacheV7<V8>; |
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.
This puts in some indirection to make it so that old symcache versions remain parseable, even if the on-disk format changes. For the two currently supported versions, 7 and 8, this is massive overkill because they only differ in how string lengths are serialized to the string table. The intention is to enable us to add data to the format without having to throw out every old symcache immediately.