[Info-vax] Dave Cutler, Prism, DEC, Microsoft, etc.
Michael Moroney
moroney at world.std.spaamtrap.com
Fri Nov 6 14:02:44 EST 2009
"Tim E. Sneddon" <tim.sneddon at bigpond.com> writes:
>Bob Gezelter wrote:
>> In any event, the use of MACRO-32 is not the impediment. It has been
>> proven twice (e.g., ALPHA, Itanium) that a compiler can be
>> straightforwardly constructed to convert MACRO-32 in to the native
>I think that might be a bit of a stretch of the meaning of
>straightforward.
It certainly is. There are lots and lots of "tricks" used on VAX
assembly code that the Macro-32 compiler on Alpha/Itanic won't tolerate.
(Believe me, I know from experience)
>> write a MACRO-32 -> C translator, which would then "solve" the initial
>> problem of getting onto a new architecture. Admittedly, such a
>> bootstrapping approach has efficiency issues, but they can be dealt
>> with.
>I think that might be a pretty *huge* generalisation there. Source
>to source translating is not generally a big task (depending on the
>languages), but certainly going from machine level to a high level
>language is. I think there would be much more than some "efficiency
>issues". There especially needs to be careful consideration of the
>target architecture's calling standard and how it compares to the
>source. As I am sure you are aware writing code in assembly allows
>the coder to do all sorts of neat "tricks" that just cannot be
>replicated by a high level language.
One of the biggies is accessing portions of the stack not written by
the current routine. About the simplest example is messing with the
return address such as this:
JSB FOO
...
FOO:
...
ADDL #4,SP ; throw away return value
RSB ; return to the caller's caller
This returns not to the instruction after the JSB, but to the caller of
the routine that called FOO. Not uncommon in some code. Other code often
has "parameters" embedded in the code stream after the JSB instruction,
the called routine fetches the parameters and manipulates the return
address to return to the instruction after the parameters, not to the
first parameter itself.
>Actually, a recent post by VAXman is the perfect example. It sites
>a piece of code that passes information through registers R1-R3.
>How do you translate that to a HLL like C using a compiler and
>without significant hand-made changes? You couldn't even move that
>to BLISS without a special linkage definition that would need to
>be hand constructed. How can you pass out-of-band information on
>an architecture that doesn't have enough registers?
I won't bore everyone with dozens of examples of code snippets that
won't reverse translate into C or something, and aren't even accepted by
the Itanic Macro-32 compiler.
More information about the Info-vax
mailing list