tool(cleanup): use names not IDs for PDs - #590
Merged
Merged
Conversation
As part of this, use Rc<str> instead of String/&str in places so that we can cheaply have owned-strings in HashMap keys without needing to allocate more and more string data. This will be necessary for the Multikernel version of the Microkit as it will be implemented by building a system/spec for each core, which makes the indices invalid when embedded in e.g. channels or otherwise. This also means that you can declare channels before PDs, instead they were forced to be placed in the SDF after the PDs due to the way the parsing worked. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
HashMaps have inconsistent ordering across platforms so this can cause slight behaviour differences; this is enough to map tests pass/fail based on order of names. We'd be able to remove all uses of HashMaps if the rust-seL4 ObjectId implemented Ord, but let's not for now. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
dreamliner787-9
approved these changes
Aug 11, 2026
| } | ||
|
|
||
| for pd in pds.iter() { | ||
| if pds.iter().filter(|x| pd.name == x.name).count() > 1 { |
Collaborator
There was a problem hiding this comment.
Personally I would use a HashSet then return error on collision. This linear scan is a bit slow if the user have a lot of PDs when we get around to raising MAX_PDS. This is rather inconsequential in the grand scheme of things (capDL steps, then compression etc) so up to you if you want to change it.
Collaborator
Author
There was a problem hiding this comment.
Yeah, this could be refactored to be a bit smarter. This code previously existed.
Collaborator
Author
There was a problem hiding this comment.
I'll tack on an extra commit.
Collaborator
Author
There was a problem hiding this comment.
... Actually, no, what I really should do is change pd_flatten to be a HashMap and then can move the error there, but that gets more complicated.
This is a little more flexible than &String. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
dreamliner787-9
approved these changes
Aug 12, 2026
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.
As part of this, use Rc instead of String/&str in places so that we can cheaply have owned-strings in HashMap keys without needing to allocate more and more string data.
This will be necessary for the Multikernel version of the Microkit as it will be implemented by building a system/spec for each core, which makes the indices invalid when embedded in e.g. channels or otherwise.
This also means that you can declare channels before PDs, instead they were forced to be placed in the SDF after the PDs due to the way the parsing worked.