IBM Support

LI77980: INEFFICIENT LOAD FROM CONSTANT AREA

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Inefficient load from constant area on strcpy, memcpy, strncpy
    when copying string constant.
    Suggest to replace the constant area loads with constant
    constant construction using immediate instructions.
    
    Sample:
    void strcpy1638E(char *out)
    {
       strcpy(out, "1638E");
    }
    
    Compiler generates:
         | 000000                           PDEF
    strcpy1638E(char *)
         | 000000                           AKA
    strcpy1638E__FPc
        9|                                  PROC      out,gr3
        0| 000040 ld       E8820008   1     L8
    gr4=.+CONSTANT_AREA(gr2,0)
      398| 000044 lwa      E804000A   1     L4A
    gr0=+CONSTANT_AREA(gr4,8)
      398| 000048 lhz      A084000C   1     L2Z
    gr4=+CONSTANT_AREA(gr4,12)
      398| 00004C stw      90030000   1     ST4A
    (char)(gr3,0)=gr0
      398| 000050 sth      B0830004   1     ST2Z
    (char)(gr3,4)=gr4
       12| 000054 bclr     4E800020   1     BA        lr
    
    This causes constant area growth or utilizing TOC. And loads
    are dependant on constant area load.
    

Local fix

  • Use direct instructions to replace strcpy.
    void opt1638E(char *out)
    {
       const unsigned short c16 = '1' << 8 | '6';
       const unsigned short c38 = '3' << 8 | '8';
       const unsigned short cE  = 'E' << 8;
       ((unsigned short *)out)[0] = c16;
       ((unsigned short *)out)[1] = c38;
       ((unsigned short *)out)[2] = cE;
    }
    

Problem summary

  • PROBLEM DESCRIPTION: Inefficient load from constant area on
    strcpy, memcpy, strncpy when copying string constant. This fix
    will replace the constant area loads with constant construction
    using immediate instructions.
    
    USERS AFFECTED: Users who use functions like strcpy, memcpy and
    strncpy etc. to copy a string literal into a memory area.
    

Problem conclusion

  • This fix will optimize loads of the tail of string literals
    into immediate instructions to get performance improved.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77980

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-04-30

  • Closed date

    2014-04-30

  • Last modified date

    2014-04-30

  • APAR is sysrouted FROM one or more of the following:

    IV56281

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

  • RC10 PSY

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
16 October 2021