GH-126910: avoid reading the FP for getting the SP#146521
GH-126910: avoid reading the FP for getting the SP#146521Fidget-Spinner merged 2 commits intopython:mainfrom
Conversation
There was a problem hiding this comment.
To anyone reading this:
The TLDR it seems is that __builtin_frame_address forces the frame pointer to be materialized per-function as it requires reading the FP! This is obviously bad, as that means we get the FP prologue on every function that has this, which corrupts the real FP in the JIT code (the one from the shim).
Diego and I spent 1 hour pairing to find out this problem only by analyzing the generated asm. I am going to write a lightweight assembly verifier to make sure we don't regress on this and guarantee that don't corrupt the FP on the JIT anymore. This also ensures unwinders using FP will always properly work with the JIT.
|
@Fidget-Spinner, would marking the function that calls the intrinsic as “noinline” work? IIUC the issue is that we’re inlining the intrinsic into JIT code. |
I'm inclined to not do that, as the JIT stencils will need to point to another extern call which will slow down this supposedly cheap check. |
|
@brandtbucher it seems you're right and we need to @diegorusso This is the patch I have |
|
This is needed for #146071