Gcc Cobol improves `MOVE NumericDisplay TO COMP-3` performance.
The GCC Cobol compiler optimizes the `MOVE NumericDisplay TO COMP-3` operation, significantly improving its execution speed.
The GCC Cobol compiler now executes MOVE NumericDisplay TO COMP-3 statements more quickly. This speedup comes from introducing a specialized mh_numdisp_to_packed function in move.cc and enabling __gg__char_national in parse.y. The change improves the efficiency of converting character-based numeric data to a packed-decimal format, a common operation in Cobol programs.
In Details
This commit to the cobol front end of GCC substantially improves the performance of converting NumericDisplay data to COMP-3 (packed decimal) format. The change introduces a new function, mh_numdisp_to_packed, in gcc/cobol/move.cc, which centralizes and optimizes the conversion logic from character-based numeric strings to a packed BCD representation. Concurrently, the __gg__char_national function is enabled in parse.y and defined in libgcobol/intrinsic.cc to assist with character handling, especially for national character sets during the conversion. This optimization re-arch…
For Context
Cobol is an older programming language still widely used in business systems, and GCC (the GNU Compiler Collection) can compile Cobol code. One common operation in Cobol is MOVE, which copies data from one memory location to another, potentially converting its format. This update focuses on making the MOVE NumericDisplay TO COMP-3 operation much faster. NumericDisplay data stores numbers as a sequence of characters, much like how you'd type them (e.g., "123"). COMP-3 (packed decimal) is a more compact and efficient way to store numbers, where each digit often takes up only half a byte of memory. This change optimizes the conversion process itself, making the GCC Cobol compiler generate faster code when your program needs to change numbers from their character representation to the packed decimal format. This can lead to noticeable performance improvements in many existing Cobol applications.