Ada: Fixes extra formal mismatch.
This commit corrects a condition that determines when to add finalization collection extra formals to BIP functions in the Ada compiler.
The Ada compiler’s handling of BIP (Bounded-size, Immutable, Pure) functions was corrected by fixing the criterion for adding extra formals related to finalization collection. This ensures that the compiler accurately determines when these additional parameters are necessary, preventing mismatches in function signatures. This change addresses a subtle correctness issue in how the Ada runtime interacts with compiled code during finalization.
In Details
Ada's BIP functions are a specific optimization target within the compiler, focusing on functions with bounded-size, immutable, and pure characteristics. Finalization collection refers to the process of cleaning up resources associated with objects. This fix targets exp_ch6.adb, specifically the Needs_BIP_Collection function, which is responsible for determining if additional parameters for finalization are required when generating code for BIP functions. An incorrect condition here would lead to ABI mismatches or incorrect runtime behavior related to resource management.
For Context
Compilers translate human-readable code into machine instructions. During this process, they often perform optimizations and manage how programs handle resources, like memory. In Ada, there are special 'BIP functions' which are designed to be very efficient. When these functions are generated, the compiler sometimes needs to add extra 'formal' parameters – essentially hidden arguments – to help with the 'finalization collection' process. This process is like garbage collection, ensuring that any resources used by the program are properly cleaned up. This commit fixes a bug where the compiler wasn't correctly deciding when to add these extra parameters for BIP functions, which could lead to subtle errors in how the program runs and manages its resources.