bpo-42927: Inline cache for slots#24216
Conversation
Sorry, something went wrong.
|
Something is wrong, we are reaching ther |
Sorry, something went wrong.
|
Okay, assuming the tests pass, this is the version I'm sending for review. |
Sorry, something went wrong.
|
It seems test_ssl on macOS failed, but the other test failures have been resolved. Is that test flaky? |
Sorry, something went wrong.
Given the nature of this change and the fact that the error says:
I would say is unrelated. I have restarted manually the tests. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit b725a65 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
|
LGTM! Let's do a buildbot pass to make sure there are no reference leaks. |
Sorry, something went wrong.
|
Seems we are missing something because some of the buildbots are crashing with segmentation faults. For instance: https://buildbot.python.org/all/#/builders/459/builds/69 The failures seem to be in test_inspect and test_zipfile |
Sorry, something went wrong.
|
Hm. I think this may happen when |
Sorry, something went wrong.
The problem was that sometimes a hint of -1 could be set, meaning the dict lookup failed. My code mistook that for a slot offset. The fix is simple, because slot offsets can never be 0, so ~offset can never be -1. I also cleaned up some comments and a variable name.
|
Here's the fix. @pablogsal how do I trigger a buildbot run? I can't find that in the devguide. |
Sorry, something went wrong.
You can add the "run with buildbots" label to the PR and the checks should start appearing at the bottom together with Travis and the other CI. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 4c2eb69 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @gvanrossum for commit 17c8a95 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
|
Looks like only 2 buildbots failed.
This seems a better result than before. |
Sorry, something went wrong.
|
I realized there's another optimization for this case. The code always starts with Is that worth exploring? It might be hard to prove there's no slowdown for the paths that do need the name. I could put this off to another PR -- if slots become more popular because of this PR we can add it later. :-) |
Sorry, something went wrong.
|
I’m just going to land this if there are no objections by tonight.
|
Sorry, something went wrong.
|
@gvanrossum: Please replace |
Sorry, something went wrong.
This is a modification of the
LOAD_ATTRinline cache that landed a few months ago (PR 22803).The design overloads the
hintfield: if it is negative, it indicates a slot. Slots are created using__slots__, but some builtin types that usePyMemberDescrObjectdescriptors (with the type set toT_OBJECT_EX) will also benefit.I've tried to keep the code style similar to the existing
LOAD_ATTRcache (happy path first) but I had to make some compromises, e.g. the cache initialization code can no longer skip everything iftp_dictoffsetis zero (since it will be zero for classes with only slots).https://bugs.python.org/issue42927