-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
GH-111485: Generate instruction and uop metadata #113287
GH-111485: Generate instruction and uop metadata #113287
Conversation
e219a26
to
39f070d
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.
A big step forward! After this it's time to kill dead code. (Maybe use coverage.py to find what's unused, it works pretty well with this codebase.)
When I try to build after ./configure --with-pydebug --enable-pystats
I get an error; that file is missing #include "pycore_uop_metadata.h"
:
Python/specialize.c:247:21: error: use of undeclared identifier '_PyOpcode_uop_name'; did you mean '_PyOpcode_OpName'?
names = _PyOpcode_uop_name;
^~~~~~~~~~~~~~~~~~
out.emit(f"#define {uop.name} {next_id}\n") | ||
next_id += 1 | ||
|
||
out.emit(f"#define MAX_UOP_ID {next_id-1}\n") |
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 realize with a name like this we sort of need this to be the last valid one rather than the first one beyond, but in the general 0-based scheme of things this feels jarring (and you have to remember to add 1 to compute the table size in optimizer.c). So may I please for a name and value that suggest/use next_id
instead of next_id-1
? E.g. UOP_ID_LIMIT
.
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.
The meaning of MAX_UOP_ID
is clear, But the meaning of UOP_ID_LIMIT
is not (at least not to me).
The -1
and +1
is a bit clunky, but I think it is preferable to loosing clarity.
We could change the name to MAX_UOP_ID_PLUS_ONE
, but that is just clunky in a different way.
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.
LGTM.
This PR moves the table generators to the new architecture.