-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[mypyc]Implement CallC IR #8880
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
Conversation
JukkaL
left a comment
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.
Overall looks good! Left some comments, mostly about naming. Naming is one of the most important factors that affects the readability of code, so it makes sense to think carefully about it. (It's also okay to later rename things if we come up with better names.)
mypyc/primitives/registry.py
Outdated
|
|
||
| # TODO: comment, we don't need error_kind since C functions are all ERR_MAGIC | ||
| # however, other fields may need further investigation | ||
| LLOpDescription = NamedTuple( |
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.
This name doesn't fit the current implementation. Can you propose a new name that communicates that this specifically describes how to call a C function?
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 am using CFunctionDescription in the updated commits.
JukkaL
left a comment
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.
Thanks for updates! Just a few more naming ideas and comment about a comment, otherwise looks great.
JukkaL
left a comment
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.
Thanks, looks great now!
|
Thanks for the review! |
relates mypyc/mypyc#709
This PR adds a new IR op
CallCto replace somePrimitiveOpthat simply calls a C function. To demonstrate this prototype,str.joinprimitive is now switched fromPrimitiveOptoCallC, with identical generated C code:Test driver code
generated C code(for the helper function, identical before/after):
Some objectives need to be completed after some discussion.
OpDescrptionand newLLOpDescrption, do we need fields includingis_var_arg,steals,is_borrowed?(Not supported in this PR yet, but we will gradually update the design when we encounter ops that require such changes)