| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
I think this can go in just like this.
Sorry, something went wrong.
| if (oparg & 1) { stack_pointer[-1 - (oparg & 1 ? 1 : 0)] = null; } | ||
| stack_pointer[-1] = v; | ||
| stack_pointer[-1 - (oparg & 1 ? 1 : 0)] = res; | ||
| if (oparg & 1) { stack_pointer[-(oparg & 1 ? 1 : 0)] = null; } |
There was a problem hiding this comment.
Theoretically this could be slightly less performant than the original (not that it matters, and the C compiler might see right through this).
Sorry, something went wrong.
| @@ -1616,7 +1616,7 @@ dummy_func( | |||
| PyObject *dict = PEEK(oparg + 1); // update is still on the stack | |||
There was a problem hiding this comment.
Maybe we could make the DSL less of a lie, e.g. using
inst(DICT_MERGE, (dict, unused[oparg-1], update -- dict, unused[oparg-1])) {
?
(I guess the peeks in the error handling code suggest it's even more complicated.)
Sorry, something went wrong.
There was a problem hiding this comment.
I figured the presence of the PEEK was an indicator that someone had tried that already. Maybe not, though... let me see!
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe it was an oversight. Maybe the code generator didn't use to handle this case.
I tried what I suggested and it seems to work. I didn't try to figure out what to do for the error handling (probably some more dummies below dict).
Sorry, something went wrong.
| }; | ||
|
|
||
| inst(LOAD_SUPER_ATTR, (unused/1, global_super, class, self -- res2 if (oparg & 1), res)) { | ||
| inst(LOAD_SUPER_ATTR, (unused/1, global_super, class, self -- attr, self_or_null if (oparg & 1))) { |
There was a problem hiding this comment.
self_or_null is unused, so replace with unused?
Sorry, something went wrong.
There was a problem hiding this comment.
Putting unused here breaks things. Since this is named it's set to NULL in the generated code... if it's called unused, it just ignores it and now there's a garbage value there.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh sneaky. I think you found a hole in the code generator. If you want it to (conditionally) push NULL you should initialize it, not depend on the default initialization. IIRC the default initialization is there only to avoid C compiler warnings.
Sorry, something went wrong.
| }; | ||
|
|
||
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- res2 if (oparg & 1), res)) { | ||
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- attr, self_or_null if (oparg & 1))) { |
There was a problem hiding this comment.
Ditto.
Sorry, something went wrong.
|
|
||
| inst(INSTRUMENTED_CALL, ( -- )) { | ||
| int is_meth = PEEK(oparg+2) != NULL; | ||
| int is_meth = PEEK(oparg + 1) != NULL; |
There was a problem hiding this comment.
Yes!
Sorry, something went wrong.
|
How about some buildbot runs? |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit fd6607f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit fd6607f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit a5a2d8f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit a5a2d8f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
|
No new buildbot failures. |
Sorry, something went wrong.
There was a problem hiding this comment.
A bunch of minor style issues, but nothing blocking.
Sorry, something went wrong.
| int total_args = oparg; | ||
| if (is_meth) { | ||
| callable = method; | ||
| if (self_or_null) { |
There was a problem hiding this comment.
This is perfectly correct, but could you make this consistent with the other NULL checks and use self_or_null != NULL to make it clear to the reader that this is a NULL check not a test of a boolean/int flag.
Sorry, something went wrong.
| int argcount = oparg; | ||
| if (is_meth) { | ||
| callable = method; | ||
| if (self_or_null) { |
There was a problem hiding this comment.
ditto
Sorry, something went wrong.
| int total_args = oparg; | ||
| if (is_meth) { | ||
| callable = method; | ||
| if (self_or_null) { |
There was a problem hiding this comment.
ditto
Sorry, something went wrong.
| int total_args = oparg; | ||
| if (is_meth) { | ||
| callable = method; | ||
| if (self_or_null) { |
There was a problem hiding this comment.
likewise
Sorry, something went wrong.
| int total_args = oparg; | ||
| if (is_meth) { | ||
| callable = method; | ||
| if (self_or_null) { |
There was a problem hiding this comment.
and here
Sorry, something went wrong.
| inst(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (unused/1, unused/2, callable, self_or_null, args[oparg] -- res)) { | ||
| int total_args = oparg; | ||
| if (is_meth) { | ||
| if (self_or_null) { |
There was a problem hiding this comment.
another
Sorry, something went wrong.
| int is_meth = method != NULL; | ||
| int total_args = oparg; | ||
| if (is_meth) { | ||
| if (self_or_null) { |
There was a problem hiding this comment.
almost the last one
Sorry, something went wrong.
| int is_meth = method != NULL; | ||
| int total_args = oparg; | ||
| if (is_meth) { | ||
| if (self_or_null) { |
There was a problem hiding this comment.
the last one
Sorry, something went wrong.
There was a problem hiding this comment.
Actually, you missed one. But don't worry, I got it. ;)
Sorry, something went wrong.
| } | ||
|
|
||
| inst(LOAD_ATTR_METHOD_WITH_VALUES, (unused/1, type_version/2, keys_version/2, descr/4, self -- res2 if (1), res)) { | ||
| inst(LOAD_ATTR_METHOD_WITH_VALUES, (unused/1, type_version/2, keys_version/2, descr/4, self -- attr, self_or_null if (1))) { |
There was a problem hiding this comment.
This isn't self_or_null, it's just self.
Sorry, something went wrong.
| }; | ||
|
|
||
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- res2 if (oparg & 1), res)) { | ||
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- attr, unused if (oparg & 1))) { |
There was a problem hiding this comment.
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- attr, unused if (oparg & 1))) { | |
| inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- attr, unused if (0))) { |
Sorry, something went wrong.
| } | ||
|
|
||
| inst(LOAD_ATTR_PROPERTY, (unused/1, type_version/2, func_version/2, fget/4, owner -- unused if (oparg & 1), unused)) { | ||
| inst(LOAD_ATTR_PROPERTY, (unused/1, type_version/2, func_version/2, fget/4, owner -- unused, unused if (oparg & 1))) { |
There was a problem hiding this comment.
| inst(LOAD_ATTR_PROPERTY, (unused/1, type_version/2, func_version/2, fget/4, owner -- unused, unused if (oparg & 1))) { | |
| inst(LOAD_ATTR_PROPERTY, (unused/1, type_version/2, func_version/2, fget/4, owner -- unused, unused if (0))) { |
Sorry, something went wrong.
Summary: This reflects the changes in python/cpython#107788. The changes to the relevant `LOAD_` instructions are mostly covered by updating `LoadMethodResult` to have a non-default constructor in 3.14+ which normalizes the content. Reviewed By: alexmalyshev Differential Revision: D80667929 fbshipit-source-id: 2d62f1850056792695faf8d9ceea61a0b4b31253
| Back | FazBrowse Home | New Git URL |
Instead of supporting both [callable, self, args...] and [NULL, callable, args...], change CALL's stack to be [callable, self_or_null, args...]. This always puts the desired callable at the same location on the stack, simplifying (or removing) the resulting shuffles and adjustments necessary for the shared code paths that follow.
This also changes CALL_FUNCTION_EX, DICT_MERGE, LOAD_ATTR, LOAD_GLOBAL, LOAD_SUPER_ATTR to support the new stack layout. In some cases, I've also changed the names of the stack items for consistency within a family.
As a side-effect of the new layout, LOAD_ATTR_PROPERTY and LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN (which are both implemented as inlined calls) don't support pushing an additional item to the stack for a following CALL (oparg & 1) anymore. I think this is fine, since it seems rare to call a "method" that's looked up in this manner.