上QQ阅读APP看书,第一时间看更新
Code inlining control
We will look into the concept of code inlining later in this chapter, in the section, Optimizing method calls, so this text will serve just as an introduction.
By setting the value of Code inlining control, you define the default behavior for the complete project. The possible values for that setting are On, Off, and Auto. This default value can be changed in the code by inserting {$INLINE ON}, {$INLINE OFF}, or {$INLINE AUTO} into the source.
The INLINE state can be set to a different value at a place where the inlined method is defined and a place where it is used (called). This creates six possible combinations.
When we look at the method definition, INLINE has the following meaning:
- INLINE ON: If the method is marked with the inline directive (more on that later), it will be marked as inlineable
- INLINE AUTO: Same as INLINE ON, with the addition that any routine not marked with inline will still be marked inlineable if its code size is less than or equal to 32 bytes
- INLINE OFF: The routine will not be marked as inlineable even if it is marked with inline
At the place of use, INLINE has a different meaning:
- INLINE ON: If a called method is marked as inlineable, it will be expanded inline (at the place of call) if possible
- INLINE AUTO: Same as INLINE ON
- INLINE OFF: The routine will not be expanded inline, even if it is marked inlineable