-
Notifications
You must be signed in to change notification settings - Fork 12
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
Extracting Depedent functions #20
Conversation
05eba2f
to
977fae3
Compare
977fae3
to
e386b44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I have a couple of minor comments inline.
src/sail_json_backend/json.ml
Outdated
| Pat_exp (P_aux (P_tuple pl, _), e) | ||
| Pat_when (P_aux (P_tuple pl, _), e, _) -> | ||
debug_print ("id_of_dependent: " ^ id); | ||
let operandl = List.concat (List.map string_list_of_pat pl) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this line is needed. operandl
is not used in the subsequent code in this stanza.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry totally missed it.
src/sail_json_backend/json.ml
Outdated
@@ -659,5 +669,12 @@ let defs { defs; _ } = | |||
print_endline " \"extensions\": ["; | |||
let extension_list = Hashtbl.fold (fun k v accum -> v :: accum) extensions [] in | |||
print_endline (String.concat ",\n" (List.sort_uniq String.compare (List.concat extension_list))); | |||
print_endline " ],"; | |||
|
|||
print_endline " \"dependent_functions\": ["; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the set of functions here are not all dependencies, let's change the key here to something more generic like "functions" (in some ways, these are "independent functions", but I think "functions" is nicely generic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the hashtable name for it, should i rename that too? That would conflict with the already defined 'functions' table(which hosts the 'function clause execute'). Should that be renamed to something else too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would conflict with the already defined 'functions' table
I certainly overlooked that. I'm really tempted to rename the older table from "functions" to, say, "executes" (not terribly excited by that name, though).
If you are willing, could you create a first patch which does that rename, then add your changes as separate patch(es) on top of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure i understand correctly, I should just rename print_endline " \"dependent_functions\": [";
at first. And then work on renaming things like prior functions
fields to let's say execute
etc..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion. I suggest creating a "first patch" which renames the existing "functions" Hashtbl
to something more apt, like "executes", or "semantics", or "rtl". (As you can see, I'm having trouble coming up with a perfect name.)
Then, you can have a second patch (or more, if needed) that adds your new "functions" Hashtbl
that collects all of the other function bodies (without a name collision on "functions").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thanks for the clarification.
e386b44
to
7a57196
Compare
Let me know if this looks any good. @ThinkOpenly |
39d598d
to
608c7dd
Compare
I like that there is a single commit that renames "functions" to "executes". Are you planning to squash together the rest of the patches? I was expecting the final set of commits to look something like:
|
608c7dd
to
b845aa1
Compare
Apologies for the delay, it slipped my mind entirely. |
Here's what I was thinking. You currently have 4 commits:
I propose rebasing/reordering/squashing to produce 2 commits:
|
b845aa1
to
06c8804
Compare
06c8804
to
6c7c9d1
Compare
|
Fixes: ThinkOpenly/sail-riscv#17
This currently extracts the dependent function(not exactly: it extracts all the
function
defs) into a new hashtable.