GH-111485: Generate instruction and uop metadata#113287
GH-111485: Generate instruction and uop metadata#113287markshannon merged 55 commits intopython:mainfrom
Conversation
e219a26 to
39f070d
Compare
gvanrossum
left a comment
There was a problem hiding this comment.
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.
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.
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.
This PR moves the table generators to the new architecture.