Uh oh!
There was an error while loading. Please reload this page.
bpo-43693: Eliminate unused "fast locals". - #26587
Conversation
bedevere-bot
commented
Jun 7, 2021
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 4acf0254591d1e6bcc526cb7b111faaeaf0dd1a0 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
4acf025 to
1d20538Comparebedevere-bot
commented
Jun 8, 2021
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 1d2053878ed6a02ebc5ad727a095255bad29b679 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
ericsnowcurrently
commented
Jun 9, 2021
FYI, the "test-with-buildbots" run shows failures on two of the Windows 10 buildbots. (The refleaks buildbot issue is unrelated.) The failures are consistent in test_clinic, test_peg_generator, and test_tools, and are all founded in
These definitely seem related to this PR so I'm going to investigate. (I'll debug the issue as soon as I have VS and the cpython repo set up on my Windows laptop.) |
ericsnowcurrently
commented
Jun 9, 2021
So far I haven't been able to reproduce the failures showing up on those two buildbots. I was able to build on Windows and run the tests but got no failures. |
gvanrossum
commented
Jun 9, 2021
Same here. |
ericsnowcurrently
commented
Jun 9, 2021
Hmm, I'm pretty sure the problem is that I forgot to bump the .pyc magic number, though I would have expected more failures. Perhaps buildbots clear all the cached .pyc files except in the Tools directory? |
gvanrossum
commented
Jun 9, 2021
via email
That sounds like a very good theory. …On Wed, Jun 9, 2021 at 11:52 AM Eric Snow ***@***.***> wrote:
Hmm, I'm pretty sure the problem is that I forgot to bump the .pyc magic
number, though I would have expected more failures. Perhaps buildbots clear
all the cached .pyc files *except* in the Tools directory?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26587 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWCWMQJKR5EMZ6PFSN24QDTR6Z6NANCNFSM46IUPKLA>
.
-- --Guido van Rossum (python.org/~guido) |
1f0fdce to
92f62e7Compareericsnowcurrently
commented
Jun 9, 2021
Yep, it looks like on Windows we only delete .pyc files under Lib/ (before running the tests). See PCbuild/rt.bat. |
gvanrossum
commented
Jun 9, 2021
Perhaps we should not delete any pic files, just to expose this kind of bug? At least in some test runs? Else this might have gone through... |
ericsnowcurrently
commented
Jun 9, 2021
Yeah, I think you're right. |
bedevere-bot
commented
Jun 9, 2021
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 92f62e7b85088b6250adbaf70a0e3e56e4c1f0c3 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
ericsnowcurrently
commented
Jun 9, 2021
Those two buildbots are happy with this PR now. 😄 |
markshannon
commented
Jun 10, 2021
I've just had a play with this: >>>deftest(arg=0, escapes_arg=1):
... local=2
... escapes=3
... another_local=4
... definner():
... returnescapes, escapes_arg
... >>>dis.dis(test)It looks like variables are still being shuffled around. I would expect this: What is the point of _varname_from_oparg? >>>fori, nameinenumerate(test.__code__.co_varnames):
... assertname==test.__code__._varname_from_oparg(i)What would be more useful is a method to get the kind of the variable. |
ericsnowcurrently
commented
Jun 10, 2021
Yeah, I noticed that too. Currently in compile.c (in |
ericsnowcurrently
commented
Jun 10, 2021
I was exposing
Mostly, I don't care about the specific name. I was trying to avoid something like
That's what @gvanrossum was talking about yesterday. We could add |
ericsnowcurrently
commented
Jun 10, 2021
FYI, neither of those two issues relates to this PR. 😄 They were introduced in my previous PRs. |
gvanrossum
commented
Jun 13, 2021
I’m waiting for,this to land. Mark, are there any specific things you need to see changed? |
markshannon
commented
Jun 14, 2021
Yes, we shouldn't be shuffling around the variables. The order of the variables in In 3.10 all cells came after all other locals. Inefficient, but predictable. Currently they are in no clear order, which is likely to be error prone. It also suggests to me that something is wrong in the compiler; |
markshannon
commented
Jun 14, 2021
Actually, it looks like cell variables only appear in
We want to treat all cells the same, regardless of whether they are a parameter or not. |
ericsnowcurrently
commented
Jun 14, 2021
@markshannon, I see what you mean now. I'm not opposed to putting cells in their "natural" position. I looked at doing that when I first started working on all this. However, at the time I didn't see any easy way to do so. It would require changes in the compiler and symtable code that I wasn't sure were worth making at the time. I do agree that we can look at doing so later. |
92f62e7 to
b5ef8e1Compareericsnowcurrently
commented
Jun 14, 2021
FYI, I plan on merging this first thing in the morning (my morning anyway). |
markshannon
left a comment
There was a problem hiding this comment.
A few changes needed. Specifically _PyFrame_OpAlreadyRan() should be removed.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Jun 15, 2021
When you're done making the requested changes, leave the comment: |
gvanrossum
commented
Jun 15, 2021
(I should just add that I had always assumed that a "regular" variable could never be a cell. But the existence of the |
bedevere-bot
commented
Jun 15, 2021
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit bdb12a7 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Currently, if an arg value escapes (into the closure for an inner function) we end up allocating two indices in the fast locals even though only one gets used. Additionally, using the lower index would be better in some cases, such as with no-arg `super()`. To address this, we update the compiler to fix the offsets so each variable only gets one "fast local". As a consequence, now some cell offsets are interspersed with the locals (only when an arg escapes to an inner function). https://bugs.python.org/issue43693
Currently, if an arg value escapes (into the closure for an inner function) we end up allocating two indices in the fast locals even though only one gets used. To address this, we update the compiler to fix the offsets so each variable only gets one "fast local". As a consequence, now some cell offsets are interspersed with the locals (only when an arg escapes to an inner function).
https://bugs.python.org/issue43693