You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: _INIT_CALL_BOUND_METHOD loses too much information/_RECORD_BOUND_METHOD not implemented #148438
It seems _RECORD_BOUND_METHOD exists in bytecodes.c but is not implemented in optimizer_bytecodes.c This means _INIT_CALL_BOUND_METHOD fails to get probable method and does not continue optimizing the trace.
The problem with not doing this is that the _PUSH_FRAME at the call site for the bound method decides to hit bottom because it sees no code object :(. So any trace with a call to a bound method does not get optimized after the call. This is pretty bad...
In _CHECK_METHOD_VERSION, we promote the value to a constant one if func_version matches (we need to leave the guard in though). We promote it using sym_set_const after getting the sym_get_probable_value.
Finally, _EXPAND_METHOD will expand the method same as what it does in bytecodes.c, and sym_new_const the callable and self.
There should be a test that tests if we manage to optimize through a call to a bound method (e.g. A.b()). The trace inside the b should be optimized, and the optimizer should not stop midway.
Activity
Fidget-Spinner commentedon Apr 12, 2026
@NekoAsakura would you like to take this on please (also, I know I've been giving you a lot of issues recently, but it's only because you're good :).
The idea is to change _RECORD_BOUND_METHOD to record the actual bound callable:
In _CHECK_METHOD_VERSION, we promote the value to a constant one if func_version matches (we need to leave the guard in though). We promote it using sym_set_const after getting the sym_get_probable_value.
Finally, _EXPAND_METHOD will expand the method same as what it does in
bytecodes.c, andsym_new_constthe callable and self.There should be a test that tests if we manage to optimize through a call to a bound method (e.g.
A.b()). The trace inside thebshould be optimized, and the optimizer should not stop midway.NekoAsakura commentedon Apr 12, 2026
NP! Keep them coming. Having a clear direction is much better than fumbling about, and I'm properly enjoying getting to know JIT through these PRs.
pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT
Merge branch 'main' into pythongh-148438/record-bound-method
pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT
pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT
pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT
Merge branch 'main' into pythongh-148438/record-bound-method
Merge branch 'main' into pythongh-148438/record-bound-method
gh-148438: implement `_RECORD_BOUND_METHOD` in JIT (GH-148457)
Revert "pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT (pyt…
pythongh-148438: implement `_RECORD_BOUND_METHOD` in JIT (pythonGH-14…