[herd] Improvements for vmsa+ifetch - #1940
Draft
artkhyzha wants to merge 2 commits into
Draft
Conversation
psafont
reviewed
Jul 31, 2026
Comment on lines
+436
to
+453
| Label.Map.fold (fun _ addr acc -> addr::acc) prog [] | ||
| |> List.filter (fun addr -> | ||
| (addr mod Pseudo.page_size = 0) | ||
| && (is_on_exported_page (addr2va addr) || is_on_relevant_page (addr2va addr)) | ||
| ) | ||
| in | ||
| let page_size pa = | ||
| let (_,code) = IntMap.find pa code_segment in | ||
| List.fold_left (fun acc (a,_) -> | ||
| acc + (if pa <= a && a < pa + Pseudo.page_size then 1 else 0) | ||
| ) 0 code | ||
| in | ||
| let check = | ||
| match page_addrs with | ||
| | [] -> () (* no checks to perform *) | ||
| | pa::page_addrs -> begin | ||
| let eta = page_size pa in | ||
| List.iter (fun a -> |
Contributor
There was a problem hiding this comment.
Would you be interested in taking some functions in the list and map libraries that make the intention clearer in the code?
In particular:
These can be adapted into this code like so:
Suggested change
| Label.Map.fold (fun _ addr acc -> addr::acc) prog [] | |
| |> List.filter (fun addr -> | |
| (addr mod Pseudo.page_size = 0) | |
| && (is_on_exported_page (addr2va addr) || is_on_relevant_page (addr2va addr)) | |
| ) | |
| in | |
| let page_size pa = | |
| let (_,code) = IntMap.find pa code_segment in | |
| List.fold_left (fun acc (a,_) -> | |
| acc + (if pa <= a && a < pa + Pseudo.page_size then 1 else 0) | |
| ) 0 code | |
| in | |
| let check = | |
| match page_addrs with | |
| | [] -> () (* no checks to perform *) | |
| | pa::page_addrs -> begin | |
| let eta = page_size pa in | |
| List.iter (fun a -> | |
| Label.Map.values prog | |
| |> Seq.filter (fun addr -> | |
| (addr mod Pseudo.page_size = 0) | |
| && (is_on_exported_page (addr2va addr) || is_on_relevant_page (addr2va addr)) | |
| ) | |
| in | |
| let page_size pa = | |
| let (_,code) = IntMap.find pa code_segment in | |
| Misc.List.count (fun (a, _) -> pa <= a && a < pa + Pseudo.page_size) code | |
| in | |
| let check = | |
| match Seq.uncons page_addrs with | |
| | None -> () (* no checks to perform *) | |
| | Some (pa, page_addrs) -> begin | |
| let eta = page_size pa in | |
| Seq.iter (fun a -> |
Contributor
|
Is the first commit only fixing a bug, or are there also enhancements? It would be good to explain in the commit message which bug is being fixed, and if there are unrelated enhancements, separate them from the bugfix. |
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.
No description provided.