◐ Shell
clean mode source ↗

GH-104584: Remove `ip_offset` and simplify `EXIT_TRACE` by brandtbucher · Pull Request #108961 · python/cpython

We don't need to keep ip_offset in a local, since it's known statically during trace construction. The only time that we don't know it is when pushing a frame for an unknown code object, so modify _PUSH_FRAME to set the prev_instr of the frame being pushed (this doesn't have any overhead, since it was always being followed by a SAVE_IP anyways). Otherwise, we just set the operand of SAVE_IP to the actual pointer that should be stored.

Also, EXIT_TRACE behaves the same as an unconditional goto deoptimize. Changing it to just do that instead makes things simpler, since all returns from tier two happen at labels (rather than tied up in the uop handlers).