× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Hans
Sent: Saturday, May 24, 2003 6:38 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: VARPG Codegen (was threading in rpg)

>Steve: You suffer from several misunderstandings on the subject, so I may
>have to address each statement individually to try to make the issues
>clear.

>Steve Richter wrote:
>> Is W-Code lower level than MI?

>Yes. Much lower level. Think of loads and stores. The fact that W-Code is
>much lower level than MI is one of the reasons it can be optimized much
>more aggressiveley.

Wait a minute!  Wouldnt it be that the more the optimizer knows about the
task that is to be performed, the better it will be able produce well
optimized code?  For example, cant the copy of one data struct to another be
optimized better than a long series of w-code load and store instructions?
When copying the data structs, the optimizer can determine that only the
packed decimal flds have to be copied individually while the char and int
flds can be strung together as a single bit blt type instruction.  And the
copy of the packed flds can possibly be done in parallel.

>> Did W-Code do away with compare and branch of MI and
>> replace with a nested
>> IF .... End pair?

>Think low-level operations, like TJP and FJP (jump if true, jump if false
>respectively). That is, you push a logical value on the stack, and branch
>based on that value. Just like many low-level CPU architectures.

>For example, where you'd have a "CMPNV A,B/EQ(LAB1)LT(LAB2);" instruction
in
>MI, you'd have something in W-Code that would look like:

>LOD A
>LOD B
>EQU
>TJP LAB1
>LOD A
>LOD B
>LES
>TJP LAB2

>And that's what the W-Code would look like if A and B had the same numeric
>datatypes. With mixed types, you'd also have to throw in the data
>conversions, which gets really messy when you get to character values. A
>simple CPYBLA(P) MI would expand to dozens of W-Code instructions. So in
>reality, this simple example makes W-Code look nicer than it really is.
>W-Code was designed to be generated by compilers, not to be programmed by
>humans.

Interesting to know, but it sounds like a waste of the compiler writers
time. Shouldnt the RPG compiler writer be dealing with issues like database
file io, varying string fields and mult occur data structures then
reinventing the translation of "a = b" to w-code wheel?

In my opinion, the wizards who invented the S/38 were more on track to
common sense hardward independence and efficient HLL translation to machine
code with the relatively high level MI.

>> C is pretty flexible in that it provides all the primitive data types +
>> function calls and scoping.  So I will stand by my assertion that it
would
>> be worthwhile to have C as a common denominator option because of the
>> availablity of the C compiler on all platforms.

>And you would be wrong.

I agree, but for a different reason. :)  "C" does not provide native support
for all the data type used in different languages.  Zoned and packed decimal
fields dont exist in C.

Thanks for the info on w-code.

-Steve



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.