gh-148380: remove all uses of _PyType_LookupByVersion in optimizer_bytecodes.c#148394
gh-148380: remove all uses of _PyType_LookupByVersion in optimizer_bytecodes.c#148394NekoAsakura wants to merge 9 commits intopython:mainfrom
_PyType_LookupByVersion in optimizer_bytecodes.c#148394Conversation
…imizer_bytecodes.c`
Oh dear, thanks for pointing that out. That's the one for I suggest we wait for #148378 to be done and then do that? |
|
Right, hold off then. Give me a kick once #148378 lands :) |
| PyObject *type = sym_get_probable_value(owner); | ||
| if (type != NULL && ((PyTypeObject *)type)->tp_version_tag == type_version) { | ||
| if (type == sym_get_const(ctx, owner)) { | ||
| ADD_OP(_NOP, 0, 0); |
There was a problem hiding this comment.
Btw, It think this is bugged on main, there needs to be a watcher installed on the type for this path similar to _GUARD_TYPE_VERSION. would you like to open a PR to fix it?
There was a problem hiding this comment.
Sure! Which issue should I link to?
There was a problem hiding this comment.
Thank you. I think it's fine to open a new issue describing the bug.
|
The other PR is merged. I think you're already in the mist of changing _GUARD_TYPE_VERSION in #148528. So it's just _CHECK_ATTR_CLASS for this PR then. |
…imizer_bytecodes.c`
Sorry, but why can't we replace RECORD_TOS_TYPE with RECORD_TOS? RECORD_TOS records more information than RECORD_TOS_TYPE after all. |
Fair, I didn't check at the time whether |
Python/optimizer_bytecodes.c
Outdated
There was a problem hiding this comment.
This needs to be changed to
assert(this_instr[-1].opcode == _RECORD_TOS_TYPE || this_instr[-1].opcode == _RECORD_TOS);
|
Hmm I suspect the new thing we're bumping up against is #148439 Unfortunately, I do not know if that's actually the root cause or hiding another bug. |
|
I am investigating. |
|
I think it is a bug in deopts. Let me draft a issue. |
I couldn't add
_RECORD_TOStoLOAD_ATTR_CLASS_WITH_METACLASS_CHECKsince the recording slot's already taken by_RECORD_TOS_TYPE.cpython/Tools/cases_generator/analyzer.py
Lines 1135 to 1150 in e36f8db
So there's a minor optimisation regression on the metaclass path, but not much we can do about it.
As for naming, it's a right mix in the file, so I just went with what felt consistent.