[comp.lang.misc] Assembly vs HLL debate

billw@navajo.STANFORD.EDU (William E. Westfield) (12/24/86)

People have repsonded to my message (compilers use expenisve function
calls, etc) by saying "gee, use a good compiler, it will code functions
inline and optimize calling sequences as well as an assembly
programmer".  I say Hah!  Does anyone know of even one example of such
a compiler?  In line functions ought to be pretty machine independent,
and since one of the claimed virtues of HLLs is transportability,
please specify a compiler (or set of compatable compilers) that runs on
several different machines, say 8086, 68000, and Vax...  (gee, you mean
that my wonderful program that runs almost as fast as assembly on my
vax runs 10 times slower on your sun?  That's too bad - Its not MY
fault, wait for a better compiler...)

I might just as well say that all programs should be written in
structured, transportable assembler, discounting the fact that such a
thing doesn't exist.


Another response (to my explantion of how a PUSH function written
in Pascal might work), was essentially "dont use pascal, use a
language where the stack can be directly manipulated by source
statements" (I think LisP was suggested).  Get serious.  This is
a HLL vs ASM debate, not a Lisp vs Pascal debate.  Very few HLLs
allow direct manipulation of the stack.  Like it or not, Pascal is
a popular HLL that implements all those things that the HLL advocates
claim are important (range and type checking, data and program
structures, and so on).  To throw it out just because PUSH and POP
are so inefficient is ridiculous.  I was just pointing out this
was a common slow-down for HLLs...

BillW

rentsch@unc.UUCP (Tim Rentsch) (12/29/86)

In a previous article William E. Westfield writes:
> People have repsonded to my message (compilers use expenisve function
> calls, etc) by saying "gee, use a good compiler, it will code functions
> inline and optimize calling sequences as well as an assembly
> programmer".  I say Hah!  Does anyone know of even one example of such
> a compiler?

The Mesa compiler does check calls to inline functions to see if the
call-by-value semantics can be met by name substitution, and passes
arguments by compile-time textual substitution.  C++ has inline
functions which I understand are pretty good, but I don't know how
good.



> In line functions ought to be pretty machine independent,
> and since one of the claimed virtues of HLLs is transportability,
> please specify a compiler (or set of compatable compilers) that runs on
> several different machines, say 8086, 68000, and Vax...  (gee, you mean
> that my wonderful program that runs almost as fast as assembly on my
> vax runs 10 times slower on your sun?  That's too bad - Its not MY
> fault, wait for a better compiler...)

C++ does run on VAXen and 680x0 (probably 80x86, anyone done a
port?), and the inline function part is independent of the machine
architecture, as it should be.  Since the C++ front end is
independent of the actual C compiler, one can plug in a different
compiler, with better code optimizer, without affecting the language.

At least with an HLL there is the hope of getting an application to
run on a new machine, and (eventually) run quickly.  With an
assembler there is not.  How many of you have seen 68000 assemblers
which produced VAX code?  



> I might just as well say that all programs should be written in
> structured, transportable assembler, discounting the fact that such a
> thing doesn't exist.

Right.  But a structured, transportable HLL can exist (some would
say does exist).  



> Another response (to my explantion of how a PUSH function written
> in Pascal might work), was essentially "dont use pascal, use a
> language where the stack can be directly manipulated by source
> statements" (I think LisP was suggested).  Get serious.  This is
> a HLL vs ASM debate, not a Lisp vs Pascal debate.  Very few HLLs
> allow direct manipulation of the stack.

Good point.  Very few (but not zero!)  HLL's have an escape mechanism
which allows low-level manipulation of machine state.  This lack can
be considered a deficiency (some would call it an asset) of some
HLL's.  Myself, I consider it a deficiency, except for the questions
of (a) how should the mechanism be incorporated into the language,
and (b) under what circumstances should that mechanism be used,
which questions are research topics and should be explored before
they are answered by casting in concrete a language design.



> Like it or not, Pascal is
> a popular HLL that implements all those things that the HLL advocates
> claim are important (range and type checking, data and program
> structures, and so on).  To throw it out just because PUSH and POP
> are so inefficient is ridiculous.  I was just pointing out this
> was a common slow-down for HLLs...

Pascal is a popular HLL, but it does not "implement all ..." etc.
Just to name two, (1) support in Pascal for top-down programming is
lousy (since procedures must be defined before they are called), and
(2) no "data structure + operations" concept, as for example
clusters in Clu, or classes in Simula and C++.  Pascal should be
thrown out, but not because PUSH and POP are slow.  But, perhaps
surprisingly, the same considerations for which Pascal should be
superseeded will also be the considerations which provide for
faster alternatives to PUSH and POP.



> BillW

Personal note:  Bill, I enjoyed your posting, even though I
disagreed with most of it.  You do an excellent job of presenting
points without personally attacking the people on the other side.
Keep up the good work!  (And, even though I disagree, I'm an old
assembly language hacker myself.  Those of you who haven't
experienced the joy of writing Macro-10 assembler, just haven't
lived!)

cheers,

txr

shebs@utah-cs.UUCP (Stanley Shebs) (12/29/86)

In article <1250@navajo.STANFORD.EDU> billw@navajo.STANFORD.EDU (William E. Westfield) writes:

>Another response (to my explantion of how a PUSH function written
>in Pascal might work), was essentially "dont use pascal, use a
>language where the stack can be directly manipulated by source
>statements" (I think LisP was suggested).  Get serious.  This is
>a HLL vs ASM debate, not a Lisp vs Pascal debate.  Very few HLLs
>allow direct manipulation of the stack.

As the author of the mentioned response, let me say that you missed the
point (and misquoted me - but that's ok, because I wasn't saying things
quite right anyway!).  I was thinking more of particular language
implementations rather than the languages themselves.  Specifically,
Portable Standard Lisp *does* allow you to manipulate the stack
directly, along with many other low-level things.  The compiler has
some capability for on-the-fly augmentation as well, so you can add
new transformation and code generation patterns.  Unfortunately, there
are dozens of caveats associated with this kind of hackery, so it's
only used in our Lisp's internals  (PSL is all written in PSL, including
heap and stack manipulations).  Part of our current research involves
making those capabilities available to the ordinary programmer.
I suppose it could all be done in Pascal, but the language needs more
augmentation (with kinds of declarations etc) than Pascalers would probably
approve.  Lisps are not quite so hamstrung in that respect.

Of course compilers like I'm describing are not available off-the-shelf,
but if all the assembly-language hackers were to redirect their energies
towards writing compilers instead of still more assembly programs, we
would have really great compilers in a year or two...

>BillW

							stan shebs

throopw@dg_rtp.UUCP (Wayne Throop) (01/03/87)

> billw@navajo.STANFORD.EDU (William E. Westfield)
> People have repsonded to my message (compilers use expenisve function
> calls, etc) by saying "gee, use a good compiler, it will code functions
> inline and optimize calling sequences as well as an assembly
> programmer".  I say Hah!  Does anyone know of even one example of such
> a compiler?  In line functions ought to be pretty machine independent,
> and since one of the claimed virtues of HLLs is transportability,
> please specify a compiler (or set of compatable compilers) that runs on
> several different machines, say 8086, 68000, and Vax...

So, specify an assembler that does so.  Saying that "Your HLL example
must be transportable, while my assembly examples need not be" is quite
a double-standard.

--
If you must compare apples and oranges, do not use redness and
smoothness as your criteria... unless, of course, you are trying to
mislead.
                                --- Padlipsky
-- 
Wayne Throop      <the-known-world>!mcnc!rti-sel!dg_rtp!throopw