You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
struct _Py_UopsSymbol {
int flags; // 0 bits: Top; 2 or more bits: Bottom
PyTypeObject *typ; // Borrowed reference
PyObject *const_val; // Owned reference (!)
unsigned int type_version; // currently stores type version
};
which is both hard to use and inefficient. This awkwardness is effectively blocking 2 PRs: python/cpython#119478 and python/cpython#121002 as I am not willing to risk introducing bugs.
All operations would take the form of a switch statement. Using an enum for the tag would allow the C compiler to generate warnings when a case was forgotten.
E.g.
Currently the symbol structure looks like this:
which is both hard to use and inefficient. This awkwardness is effectively blocking 2 PRs: python/cpython#119478 and python/cpython#121002 as I am not willing to risk introducing bugs.
We should change the symbol to a tagged union:
Each of the subtypes would start with
uint8_t tag;
and should be no larger than 16 bytes (on a 64bit machine).E.g.
All operations would take the form of a switch statement. Using an
enum
for the tag would allow the C compiler to generate warnings when a case was forgotten.E.g.
This is nothing novel, just good engineering practice.
The text was updated successfully, but these errors were encountered: