Uh oh!
There was an error while loading. Please reload this page.
GH-131798: Skip self/NULL checks for some known non-methods - #132278
GH-131798: Skip self/NULL checks for some known non-methods#132278brandtbucher wants to merge 3 commits into
self/NULL checks for some known non-methods#132278Conversation
markshannon
commented
Apr 8, 2025
What about this: defcall_x(a, b):
returna.x(b)
classC: passc=C()
c.x=typecall_x(c, 1); call_x(c, 1)
f=types.MethodType(type, 3)
classD:
x=fd=D()
call_x(d, "string") |
brandtbucher
commented
Apr 8, 2025
I'll try, but I'm pretty sure those are fine, since At any rate, I'll add a test. |
brandtbucher
commented
Apr 8, 2025
@markshannon, I went ahead and added a bunch of tests for weird method patterns like that. |
markshannon
commented
Apr 9, 2025
I'm still reluctant to make this change, as it makes the behavior of individual instructions depend on implicit context. deff(x, a, b):
returnx(a, b)currently compiles as but it could be correctly compiled as: which would not work with this PR. |
markshannon
commented
Apr 9, 2025
IIRC, we use do just something like that. When compiling |
CALL_TYPE_1,CALL_STR_1,CALL_TUPLE_1,CALL_LEN, andCALL_ISINSTANCEwill never call a method descriptor, which means that we can just assert thatself_or_nullisNULLinstead of checking and "adjusting" the arguments each time.CALL_BUILTIN_CLASSshould never call a method descriptor, but I'm not sure that we can gurantee it. So I've just made this aDEOPT_IFinstead.