[fpc-pascal] Does the compiler make prodigious use of use ENTER instruction?

Marco van de Voort fpc at pascalprogramming.org
Tue Dec 12 17:51:19 CET 2023


Op 12-12-2023 om 17:48 schreef Anthony Walter via fpc-pascal:
> Iwas reading this article today on the Microsoft website about the 
> mysterious x86 ENTER instruction. The article states that it's primary 
> purpose is to support Pascal and similar compilers to allow for 
> preserving local variables on the stack when using with nested functions.
>
> Here is the article:
>
> https://devblogs.microsoft.com/oldnewthing/20231211-00/?p=109126
>
> Do any of the compiler devs know if Pascal programs for the x86 
> instruction set are using ENTER and its second argument to the best 
> possible effect? I am curious.
>
No, and if they do, they don't do in the way they are meant to. These 
are very old instructions and the intended use has a nesting limit (of 
32 levels iiirc).  Because of that limit, modern compilers don't use them.

Some forms of enter and leave are use as peephole optimizations.




More information about the fpc-pascal mailing list