gh-131798: fold super method lookups in JIT#148231
gh-131798: fold super method lookups in JIT#148231kumaraditya303 merged 10 commits intopython:mainfrom
Conversation
|
I see a 10% speedup on richards_super with this PR! Mean +- std dev: [richards_super_main] 28.8 ms +- 0.5 ms -> [richards_super_fold] 26.1 ms +- 0.5 ms: 1.10x faster |
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Looks good, just one stylistic nit. Thanks!
| return sym_new_not_null(ctx); | ||
| } | ||
| /* Normal case: obj_type must be a subtype of su_type */ | ||
| if (!PyType_IsSubtype(obj_type, su_type)) { |
There was a problem hiding this comment.
Note to self: this is not same as subclasscheck/instancecheck, which can call arbitrary code.
|
Please fix the merge conflicts. LOAD_CONST_UNDER_INLINE_BORROW was removed as it's a duplicate of _INSERT_1_LOAD_CONST_INLIE_BORROW #148235 |
Fixed. |
| _Py_BloomFilter_Add(dependencies, su_type); | ||
| PyType_Watch(TYPE_WATCHER_ID, (PyObject *)obj_type); | ||
| _Py_BloomFilter_Add(dependencies, obj_type); | ||
| return sym_new_const_steal(ctx, lookup); |
There was a problem hiding this comment.
Note to self: need steal version because _PySuper_Lookup returns a strong reference, unlike _PyType_Lookup
|
Please pull in main and regen cases. Thank you. |
|
Can we have a test for the case where the superclass changes after optimization, to make sure that we de-opt properly? |
|
Added test and fixed merge conflicts. |
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Thanks for adding the test
Uh oh!
There was an error while loading. Please reload this page.