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

Refactor MastForest format to put all decorator data at the end #1489

Open
plafer opened this issue Sep 10, 2024 · 2 comments
Open

Refactor MastForest format to put all decorator data at the end #1489

plafer opened this issue Sep 10, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@plafer
Copy link
Contributor

plafer commented Sep 10, 2024

Originally posted by @bobbinth in #1482 (comment)

Not for this PR, but I wonder if there is a way to refactor this so that all decorator-related data is in one section. This way, if we wanted to drop decorators from the serialized binary, we could just truncate this section without doing any extra processing.

@plafer plafer added enhancement New feature or request good first issue Good for newcomers labels Sep 10, 2024
@yasonk
Copy link

yasonk commented Sep 25, 2024

I haven't looked into the serialization code in detail, but just to clarify, the intent is to make the serialization format look like this?

//! The serialization format of MastForest is as follows:
//!
//! (Metadata)
//! - MAGIC
//! - VERSION
//!
//! (lengths)
//! - nodes length (`usize`)
//!
//! (procedure roots)
//! - procedure roots (`Vec<MastNodeId>`)
//!
//! (raw data)
//! - Node data
//! - String table
//!
//! (info structs)
//! - MAST node infos (`Vec<MastNodeInfo>`)
//!
//! (All Decorator data)
//! - decorators length (`usize`)
//! - Decorator data
//! - decorator infos (`Vec<DecoratorInfo>`)
//! 
//! (before enter and after exit decorators)
//! - before enter decorators (`Vec<(MastNodeId, Vec<DecoratorId>)>`)
//! - after exit decorators (`Vec<(MastNodeId, Vec<DecoratorId>)>`)

@bobbinth
Copy link
Contributor

I think it is a bit more complicated than that because some decorator data is also stored in the "Node data" section and also strings used by decorators are stored in the "String table" (though, I don't remember this too well now).

But the general idea is correct - we want to move everything decorator-related to the end of the file to make removing decorator data (which is going to be primarily used for debug purposes) as straight-forward as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants