Skip to content

Conversation

@loewenheim
Copy link
Contributor

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.

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.
@loewenheim loewenheim requested a review from a team December 10, 2025 16:09
Copy link
Member

Choose a reason for hiding this comment

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

I haven't reviewed this properly, but why is there a raw:v7 but no raw:v8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@jjbayer
Copy link
Member

jjbayer commented Dec 17, 2025

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 SymCacheV7 generic over get_string, something like

        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>;

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