Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
IBM Enterprise COBOL compiler optimisation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Martin Ward

New User


Joined: 20 Mar 2007
Posts: 2
Location: Durham

PostPosted: Thu Mar 22, 2007 4:40 pm    Post subject: IBM Enterprise COBOL compiler optimisation
Reply with quote

I work to develop automated technology for migrating assembler to C and COBOL.

One of our customers is migrating to mainframe COBOL and is getting very poor performance from the COBOL we generate (CPU usige is nearly 10 times higher than for the assembler). The COBOL code looks pretty good, but looking at the output of IBM's COBOL compiler there are a lot of unnecessary instructions being generated.

For example, R5 and R6 are two fullwords, defined as PIC S9(9) COMP. The simple ADD statement:

ADD R5 TO R6

compiles into this code:

001416 ADD
00070A 5840 A060 L 4,96(0,10) R5
00070E 8E40 0020 SRDA 4,32(0)
000712 5800 A068 L 0,104(0,10) R6
000716 8E00 0020 SRDA 0,32(0)
00071A 1A04 AR 0,4
00071C 1E15 ALR 1,5
00071E 47C0 B4C2 BC 12,1218(0,11) GN=81
(000726)
000722 5A00 C004 A 0,4(0,12) SYSLIT AT +4
000726 GN=81 EQU *
000726 5010 A068 ST 1,104(0,10) R6

It converts the fullword values to doublewords (in four registers),
adds the high order fullwords, adds the low order fullwords and finally stores the low order fullword in the result! icon_rolleyes.gif

Is there some way to get the compiler to just do a simple fullword
load, add, store? I would expect to see something like:

L 4,96(0,10) R5
A 4,104(0,10) R6
ST 4,104(0,10) R6

... but with proper register allocation eliminating a lot of the load and store instructions.

The code for:

MOVE LINK-TMP-BIGDATA-1(1:R5) TO LINK-TMP-BIGDATA-2(1:R5)

is even worse, generating a huge block of code (including an MVCL instruction) ending up with a call to a support function IGZCVMO to do the actual move!

Why can't it just generate a simple MVCL?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Mar 22, 2007 4:49 pm    Post subject:
Reply with quote

Not sure which, bot I think some of the compiler options might affect the math behavior.
Have you got the optimizer active?
Back to top
View user's profile Send private message
Martin Ward

New User


Joined: 20 Mar 2007
Posts: 2
Location: Durham

PostPosted: Thu Mar 22, 2007 5:50 pm    Post subject:
Reply with quote

Compiler options included: AWO, ARITH(COMPAT), AWO, DATA(31), OPTIMIZE(STD), NUMPROC(NOPFD), TRUNC(OPT), NOSSRANGE, NOTEST, NOTHREAD.

OPTIMIZE(FULL) is the same as OPTIMIZE(STD) except that it also deletes unreferenced data items (which we don't want to do, since we want to preserve the data layout: data is accesed via pointers).

Is there any difference between TRUNC(OPT) and TRUNC(BIN) for binary computations?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Mar 22, 2007 6:03 pm    Post subject:
Reply with quote

Personally, I prefer TRUNC(BIN), why not change it and compare the PMAPs?
BTW, it doesn't really delete, it just doesn't include unreferenced data items in the load module. If at son=me later date, the program is modified to reference one, it magically reappears.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us