bpo-46841: Move the cache for `LOAD_GLOBAL` inline. by markshannon · Pull Request #31575 · python/cpython
A few things:
* The magic number needs to be bumped every time we do this.
👍
* I thought we decided to use `_Py_CODEUNIT` everywhere you're using `uint16_t` now (it may also be worth adding `_Py_TWOCODEUNITS` and `_Py_FOURCODEUNITS` aliases for `uint32_t` and `uintptr_t`, respectively).
Hmm, I'd prefer not. Versions, for example, are 32 bit value, not 2 code units. If the size of the _Py_CODEUNIT were to change, we would still want versions to be 32 bit numbers.
So, the structs should be defined in terms of code units, but the read/write helpers should be in terms of width.
Maybe we should give up on the pretense that the size of the code unit can be easily changed, and replace _Py_CODEUNIT with the standard type uint16_t?