Re: Possible to write compiler to Java VM?

macrakis@osf.org (Stavros Macrakis)
9 Feb 1996 16:52:52 -0500

          From comp.compilers

Related articles
[22 earlier articles]
Re: Possible to write compiler to Java VM? dewar@cs.nyu.edu (1996-01-31)
Re: Possible to write compiler to Java VM? rfg@monkeys.com (1996-02-01)
Re: Possible to write compiler to Java VM? ok@cs.rmit.edu.au (1996-02-01)
Re: Possible to write compiler to Java VM? gmckee@cloudnine.com (1996-02-02)
Re: Possible to write compiler to Java VM? darius@phidani.be (Darius Blasband) (1996-02-04)
Re: Possible to write compiler to Java VM? salomon@silver.cs.umanitoba.ca (1996-02-09)
Re: Possible to write compiler to Java VM? macrakis@osf.org (1996-02-09)
Re: Possible to write compiler to Java VM? shellgate!rgh@uu4.psi.com (Richard G. Hash) (1996-02-09)
Re: Possible to write compiler to Java VM? gmckee@cloudnine.com (1996-02-12)
Aliasing in ISO C (was: Re: Possible to write compiler to Java VM?) rfg@monkeys.com (1996-02-13)
Re: Possible to write compiler to Java VM? ncohen@watson.ibm.com (1996-02-13)
Re: Aliasing in ISO C stevec@pact.srf.ac.uk (1996-02-14)
Re: Aliasing in ISO C rfg@monkeys.com (1996-02-16)
[3 later articles]
| List of all articles for this month |
From: macrakis@osf.org (Stavros Macrakis)
Newsgroups: comp.lang.java,comp.compilers,comp.lang.ada
Date: 9 Feb 1996 16:52:52 -0500
Organization: OSF Research Institute
References: 96-01-037 96-01-130 96-02-051
Keywords: C, design

Our moderator said:


      [This is again straying too far from compilers; we all know how easy
      it is to write awful C code, but I don't see that it has much direct
      bearing on compiler construction. Feel free to show that I'm mistaken
      if I am....]


Actually, there is a very direct bearing. There are several C
features which make garbage collection difficult (although not
impossible, as shown by the conservative collectors on the one hand
and the interpretive C approach on the other), notably casts, untagged
unions, and arrays without well-defined run-time lengths. There are
also several features that make certain optimizations pretty much
impossible, namely the possibility of almost arbitrary aliasing.
Moreover, the low level of the language means that, although it is
very easy to generate OK code for C, it is hard to optimize operations
on higher-level structures, such as multidimensional arrays, and
generate excellent code, especially on machines whose architecture is
very different (e.g. distributed memory MIMD) from the flat byte
address space, monoprocessor model implicit in C.


These are the same features that can make program understanding,
verification, and maintenance difficult.


Ada doesn't have many of these problems. On the other hand, compilers
have to work much harder both for semantic analysis and for good code
generation. But the features that cause these optimization
difficulties are features that increase safety (e.g. range checking).


There are some unsafe features in Ada other than the explicit ones.
For instance, aliasing is "erroneous" (thus allowing efficient
Fortran-style optimization of array code in subroutines), but no
runtime checking is required.


-s
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.