[fpc-devel] Internal jump instructions for longer conditional jumps

Florian Klämpfl florian at freepascal.org
Mon Apr 20 22:11:25 CEST 2020


Am 20.04.20 um 16:44 schrieb Martin:
> FPC sometimes generates jump instructions as follows. (Not always bound 
> to "IF" but that is the example I found
> 
> IF something then begin {long code} end;
> 
> The conditional asm jump does not jump all the way to the code after the 
> "end".
> Instead it points to an unconditional jump, that (according to line 
> info) is at the end of some other line.

This might be some artifact introduced by the optimizer. Problem is, the 
jumps are generated at a certain point and then the optimizer starts to 
"mess" with them. During this, it might be that line info is mixed up.

> 
> Such "jump pads" (?) seem common (gdb seems to know about them).
> 
> I try to detect them in fpDebug.
> Which assumptions are reasonable?
> 
> - How long can a series of such "jump forwarders" be.
>    Can the unconditional jump, go to another unconditional jump, before 
> eventually hitting the line that the pascal code would go to?
>    How many to expect max, before getting suspicious?

Unlimited in theory.

> 
> - If such jumps are within line info, they should not be at the start of 
> a line?

Do you have some example code which shows this (together with the needed 
optimizer switches)?


More information about the fpc-devel mailing list