Considerations and Restrictions When Using Advanced Argument Optimization
Considerations and Restrictions When Using Advanced Argument Optimization
Considerations and Restrictions When Using Advanced Argument Optimization
When ARGOPT(*YES) is specified during program creation, advanced argument optimization is applied. In general, this will improve the performance of most procedure calls within the program. However, you need to consider the following items before deciding to use advanced argument optimization:
-
Interaction with pragma-based argument optimization:
Argument optimization enabled with ARGOPT(*YES) and argument optimization enabled by the #pragma argopt directive, which is supported by the C and C++ compilers, are both redundant and complementary.
If you already have #pragma argopt in your code, leave it in there, and also use ARGOPT(*YES). You can remove the redundant #pragma argopt’s later, or keep them in there.
If you do not have #pragma argopt in your code, using ARGOPT(*YES) will generally help. If you call procedures through a function pointer, you might want to think about using #pragma argopt for those cases, as advanced argument optimization does not optimize calls through a function pointer. Virtual function calls in C++ are examples of function pointer calls.
For more information about the #pragma argopt directive, see ILE C/C++ Compiler Reference
.However, unlike the pragma-based argument optimization, which requires manual insertion of #pragma directives into the source code, advanced argument optimization requires no source code changes and is applied automatically. In addition, advanced argument optimization can be applied to programs created in any language, while the pragma-based solution is only for C and C++.
While the #pragma argopt directive can be applied to function pointers, advanced argument optimization does not automatically optimize virtual function calls and calls through a function pointer. Therefore, for optimizing indirect calls, the argopt pragma is useful when used in this complementary way with advanced argument optimization.
-
16-byte pointers:
16-byte space pointer parameters benefit the most from argument optimization. Space pointers point to data object types, such as characters, numbers, classes and data structures. Examples of space pointers in C and C++ include char* and int*. However, parameters declared with other types of 16-byte pointers that are unique to IBM® i, such as pointers that point to system objects, are not optimized by argument optimization. Open pointer parameters such as void* pointers in C and C++, which are based on incomplete types, are also not optimized.
-
DTAMDL(*LLP64):
C and C++ applications that consist of modules created with DTAMDL(*LLP64) benefit less from argument optimization than those created with the default DTAMDL(*P128). In the former case, pointers to data are 8 bytes long, and these are always passed between procedures using the most efficient mechanisms. In the latter case, pointers to data are 16 bytes long, which are prime candidates for argument optimization.
-
Target release:
Programs created with ARGOPT(*YES) must also be created with target release V6R1M0, or later.
To take full advantage of advanced argument optimization, modules bound into programs created with ARGOPT(*YES) should be created with target release V6R1M0 or later, as calls into or calls originated from functions defined in modules created before V6R1M0 are ignored by advanced argument optimization.
-
Longer program creation time:
When ARGOPT(*YES) is specified during program creation, additional analysis is performed across all of the modules in the program. For programs that consist of hundreds or thousands of modules, creation time can be significantly longer.
Similarly, when you use the Update Program (UPDPGM) or Update Service Program (UPDSRVPGM) commands to update a program that is created with ARGOPT(*YES), the amount of time to complete the update can be longer because of the extra analysis that might be required to ensure that all cross-module calls are updated. If there are no changes to procedure interfaces, this extra time is typically short.
-
Interaction with special calling conventions:
Advanced argument optimization is not applicable to dynamic program calls. In addition, C and C++ functions that are defined with the _System keyword are not candidates for advanced argument optimization.
-
Interaction with program profiling:
You can use advanced argument optimization and program profiling at the same time.
-
Interaction with interprocedural analysis (IPA):
The cross-module analysis and optimizations performed by IPA are redundant with advanced argument optimization. Therefore, when you use IPA, it is not necessary to use advanced argument optimization.