eric@snark.UUCP (Eric S. Raymond) (09/29/88)
The comp.arch discussion thread "Re: Software distribution" seems to me to have drifted off into a lot of pointless theologizing. Let's try for a reality check. Let's start by asking the question: 1) What properties distinguish a MLL from a HLL? That is: how do I look at the semantics, performance, and portability of a set of languages and sort the MIILs from the HLLs? Next: 2) Are the portability goals for which MIILs are designed achievable at all, given the diversity of today's architectures? and, finally 3) If the answer to 2 is 'yes', *can those goals be achieved with lower complexity and cost than an HLL compiler?* If the answer to 3 is 'no', as I suspect, then I submit that we already have as good an MIIL as we're ever going to get. It's called 'C'. -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: ...!{uunet,att,rutgers}!snark!eric = eric@snark.UUCP Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718
yba@arrow.bellcore.com (Mark Levine) (10/01/88)
You have built some questionable assumptions into your reality check, and need to define your acronyms: MLL -- is this a machine level language? MIIL -- is this a machine independent intermediate language, and if so, at what level of expressive power, and is it any different than the MLL? How? I beleive in such a thing as a MOL, a machine oriented language, and in a high level machine oriented language which is portable. It is possible to do MUCH better than C. Eleazor bar Shimon, once and future Carolingian yba@sabre.bellcore.com
stodghil@svax.cs.cornell.edu (Paul Stodghill) (10/01/88)
Talk about esoteric. Geez. I have been interested in Machine Independent Intermediate Languages for 2 years now, I have yet to see any literature of substance. Not to say that it doesn't exist, just that I haven't been able to find it. Does anyone have any pointer to papers on the subject? Please Email to me directly. - Paul Stodghill stodghil@cs.cornell.edu
eric@snark.UUCP (Eric S. Raymond) (10/02/88)
In article <898@sword.bellcore.com>, yba@arrow.UUCP (Mark Levine) writes: > You have built some questionable assumptions into your reality > check, and need to define your acronyms: Sorry, I typoed. > MLL -- is this a machine level language? That 'MLL' should have read 'MIIL'. > MIIL -- is this a machine independent intermediate language, > and if so, at what level of expressive power, and is > it any different than the MLL? How? Good question -- in fact, it's precisely the question I was trying to ask with respect to HLLs. I think more acronym confusion can be best avoided if I re-pose my three questions with this correction. They are: 1) What properties distinguish a MIIL from a HLL? (That is: how do I look at the semantics, performance, and portability of a set of languages and sort the MIILs from the HLLs?) 2) Are the portability goals for which MIILs are designed achievable at all, given the diversity of today's architectures? 3) If the answer to 2 is 'yes', *can those goals be achieved with lower complexity and cost than an HLL compiler?* The whole debate so far has been about 2). I am trying to suggest that the critical question is actually 3), that the answer to 3) appears to be 'no', and that the notion of MIIL is therefore fundamentally rather pointless, because it distracts us from the *important* questions about designing portability into HLLs. > I beleive in such a thing as a MOL, a machine oriented language, and > in a high level machine oriented language which is portable. It is > possible to do MUCH better than C. Fine. I don't so believe (I've seen too many bizarre architectures) but I have an open mind. Show me! -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: ...!{uunet,att,rutgers}!snark!eric = eric@snark.UUCP Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718
djones@megatest.UUCP (Dave Jones) (10/04/88)
From article <e2uEl#2ORJzO=eric@snark.UUCP>, by eric@snark.UUCP (Eric S. Raymond): > > 1) What properties distinguish a MIIL from a HLL? > The HLL should be easy for humans to write. The MILL should be in the form most easily generated by compiler frontends, which is to say, it should be Polish form, not infix. Probably postfix-Polish is best. If you are going to have different compilers for HHL work and MIIL work, you might as well have two different languages, so... Now, I'll answer a question you did not ask: Namely, how should an MIIL compiler operate differently from an HLL compiler? a. The HIIL compiler may assume that its input is correct, provided that a check-sum is correct (or on very dependable systems, providing that a "magic number" is correct). It need not spend valuable cpu cycles checking on correctness. b. The HIIL compiler should not do any "optimization" which could possibly affect program operation in any way. In particular, it should always evaluate expressions in the order in which it is told to evaluate them. That leaves many C compilers right out. It should do no global optimizations. (Global optimizations are machine-independent, and should be performed on the MIIL form or on an earlier form, before the MIIL compiler sees it.) > > 2) Are the portability goals for which MIILs are designed achievable > at all, given the diversity of today's architectures? > I know from experience that a completely general solution is tough. Most of the problems come from screwy pointer-formats. Still, you can come up with something that works for "reasonable" architectures. > 3) If the answer to 2 is 'yes', *can those goals be achieved with > lower complexity and cost than an HLL compiler?* > I think probably so. Certainly one can design an MIIL which is easier to generate code for (in the front-end) than currently popular HLL's. > The whole debate so far has been about 2). I am trying to suggest that the > critical question is actually 3), that the answer to 3) appears to be 'no', > and that the notion of MIIL is therefore fundamentally rather pointless, > because it distracts us from the *important* questions about designing > portability into HLLs. As a practical matter, I can't agree. As we speak, I am writing an HLL compiler. I wish I had a good MIIL and some cross-compilers for it. Current implementations of C will not do because, 1) Generating C code is a pain in the butt (c.f. Cfront). 2) C cross compilers do not exist for the machines in question. 3) Current C compilers for the target machine are too slow to use interactively in a read-compile-load-run loop ("executing data"). Admittedly, the second two reasons are not due to the nature of C itself, but rather to the nature of current compilers. I had rather see more work go into new MIIL's, and indeed, new HLL's rather than seeing yet another batch of C compilers. Nobody is going to do new C compilers tuned to be used as MIIL compilers. For marketing reasons, the new compilers will all do ANSII prototypes and lots of optimization. Even if it is possible to define a language which will serve as both an HLL and an MIIL, (an "MIHLL"), it sure would be nice to have the MIIL to boot strap it with. Perhaps the MIIL would turn out to be a subset of the HLL with "checking turned off", I dunno.
itcp@ist.CO.UK (News reading a/c for itcp) (10/04/88)
From article <e2uEl#2ORJzO=eric@snark.UUCP>, by eric@snark.UUCP (Eric S. Raymond): > 2) Are the portability goals for which MIILs are designed achievable > at all, given the diversity of today's architectures? > > 3) If the answer to 2 is 'yes', *can those goals be achieved with > lower complexity and cost than an HLL compiler?* > > The whole debate so far has been about 2). I am trying to suggest that the > critical question is actually 3), that the answer to 3) appears to be 'no', > and that the notion of MIIL is therefore fundamentally rather pointless, > because it distracts us from the *important* questions about designing > portability into HLLs. There are two independent goals for a MIIL, the original one that started this discussion, namely a `single universal distribution medium' that didn't entail giving away source. As this was being discussed in what is essentially a UNIX environment the assumption was that to all intents and purposes the MIIL only had to serve for C programs. Here compiler costs are not really a consideration - but I feel it remains to be shown that obfuscated C source could not serve this purpose. I have another interest in MIIL and that is as a Language independent intermediate code to promote the design and disemination of new programming languages. Clearly it would be acceptable for the MILL implementation cost to exceed the cost of a single HLL compiler, so long as it was cheaper than two HLL compilers. If it were more expensive than that I would seriously doubt its reliability and maintainability. [Usual disclaimer: this represents only my hastily assembled opinion and spelling, and not necessarily anyonelse's] Tom (itcp@uk.co.ist)
yba@arrow.bellcore.com (Mark Levine) (10/04/88)
In article <853@goofy.megatest.UUCP> djones@megatest.UUCP (Dave Jones) writes: >From article <e2uEl#2ORJzO=eric@snark.UUCP>, by eric@snark.UUCP (Eric S. Raymond): >Even if it is possible to define a language which will serve as both >an HLL and an MIIL, (an "MIHLL"), it sure would be nice to have the MIIL >to boot strap it with. Perhaps the MIIL would turn out to be a >subset of the HLL with "checking turned off", I dunno. An old bootstrapping technique I have seen used well is to have a "virtual machine", say a single stack machine, which you implement on each target using whatever the best tools on the target allow. The bootstrap compiler produces output in the virtual machine's instruction set, and you write your code generator in the HLL of the compiler itself, followed by compiling the compiler. If you happen to produce RISC machines and put your virtual machine into real hardware, you get to skip some steps.... Cross-compilers are replaced by implementing the virtual machine (which is kept deliberately simple). Is there resistance to the idea of writing the language first, then seeing what it takes to execute it efficiently, and _then_ designing the hardware? It seems designers are still fond of assembler, and providing many ways to do operations for a compiler writer who only needs one fast way. On the other hand, the LISP machines and the SCHEME chip don't seem to be setting the world on fire. What does the current folklore hold? I have never really talked with a RISC designer about languages. I have this fear they would all want to do an ADA machine first :-). Eleazor bar Shimon, once and future Carolingian yba@sabre.bellcore.com
pardo@june.cs.washington.edu (David Keppel) (10/04/88)
djones@goofy.megatest.UUCP (Dave Jones) writes: >[ the HIIL compiler should(n't)... ] Uh, great, now we have: HLL, HIIL, MIIL. What's HIIL? >[ global optimizations are machine-independent ] I think that there are probably a *lot* of global optimizations that *are* machine dependent. Proof by authority: William Wulf said so. Proof by trivialization: certain global variables may have their concrete type assigned based on machine depndencies, and these in turn will affect local computation; the concrete type assignment may in some cases be available only after certain kinds of global analysis[*]. Eventually you take a hit. [*] Consider a language that supports two types of integers, a hardware-supported type and an arbitrary-precision type. The variable may be declared with values outside the hardware type for some machines, inside the hardware type for other machines. Even knowing whether the *declaration* fits may not be enough. If the declaration doesn't fit the machine type and the *usage* is always within the machine type (which may be determined in at least some cases by looking at every assignment to the variable), then failure to do this (machine-dependent) global optimization will cause the compiler to allocate the arbitrary-preciesion type, which will generally be far less efficient. ;-D on ( Suboptimal reality ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo
eric@snark.UUCP (Eric S. Raymond) (10/06/88)
Aha! Finally, an apologia for the MIIL comcept that makes sense... In article <853@goofy.megatest.uucp>, djones@megatest.UUCP (Dave Jones) writes: > From article <e2uEl#2ORJzO=eric@snark.UUCP>, by me: > > 1) What properties distinguish a MIIL from a HLL? > > > The HLL should be easy for humans to write. > The MILL should be in the form most easily generated by compiler > frontends, which is to say, it should be Polish form, not > infix. Probably postfix-Polish is best. I consider this a detail. Front-ending is *not* the hard part in HLL compilation; front ends are easy to write, and easy to port. Code generation is the hard part. Eliminating the front end, by itself, doesn't pare away enough complexity and cost to justify the MIIL concept. > Now, I'll answer a question you did not ask: Namely, how should > an MIIL compiler operate differently from an HLL compiler? > > a. The HIIL compiler may assume that its input is correct, Again, this is a *front end* issue, and front ends are the *easy* part. Code generators (which are, typically, IL-to-native-code translators) don't typically error-check their input stream, either! Here's a gedankenexperiment for you. Let's suppose we *had* a "universal" MIIL; now, I write a HLL front end in it, and I ship that with uMIIL. Do I have a universal HLL compiler? Given that assumption, yes I do. What this demonstrates is that, aside from an essentially fixed *one-time* cost to write an HLL front-end, the cost and complexity of writing a uHLL is the *same* as that of writing a uMIIL! (BTW, please forgive the proliferation of jargon but I am *not* going to wear out my typing finger on "universal machine-independent intermediate language" again) Now, what's wrong with this picture? Again, *we left out the hard part* -- which is designing the uMIIL/code generator and then implementing it on the billyuns and billyuns of bizarre boxes out there. > b. The HIIL compiler should not do any "optimization" which > could possibly affect program operation in any way. So how's this different from an HLL with the optimization turned off? > > 2) Are the portability goals for which MIILs are designed achievable > > at all, given the diversity of today's architectures? > > > I know from experience that a completely general solution is tough. > Most of the problems come from screwy pointer-formats. Still, you > can come up with something that works for "reasonable" > architectures. Certainly. It's called 'C'. No flames about C's problems, please. I know it's not perfect. But the *fact* is that it is now filling the niche in the computer science ecology that you're describing -- and you haven't advanced any compelling reasons to abandon its HLLness in favor a search for a hypothetical uMIIL. > > 3) If the answer to 2 is 'yes', *can those goals be achieved with > > lower complexity and cost than an HLL compiler?* > > > I think probably so. Certainly one can design an MIIL which > is easier to generate code for (in the front-end) than currently > popular HLL's. Let's assume you can. So what? Front-ending (I guess I have to repeat this again) is *not the real problem*! As long as you have to write a nontrivial code generator anyhow (and you will, for any hardware that doesn't closely match the virtual machine defined by the uMIIL) the complexity and cost of that back end is going to completely swamp the cost of hauling along and using an HLL front end. > As a practical matter, I can't agree. As we speak, I am writing an > HLL compiler. I wish I had a good MIIL and some cross-compilers for it. > Current implementations of C will not do because, > > 1) Generating C code is a pain in the butt (c.f. Cfront). Maybe your translation methods need work. Have you tried treating your new-HLL parse tree as data and doing rewrites on subtree pattern matches until you get legal C? That way C gets to do the grotty parts like symbol table and name space maintenance. Use LISP for this if you can, then compile the LISP. > 2) C cross compilers do not exist for the machines in question. Given what I've shown above, why do you consider uMILL 'cross-compilers' to be significantly easier/more feasible? (and do you see why this is the right question now?) > 3) Current C compilers for the target machine are too slow to > use interactively in a read-compile-load-run loop ("executing data"). An implementation detail, as you yourself observed. > Even if it is possible to define a language which will serve as both > an HLL and an MIIL, (an "MIHLL"), it sure would be nice to have the MIIL > to boot strap it with. Perhaps the MIIL would turn out to be a > subset of the HLL with "checking turned off", I dunno. Ah. Now *that's*, in my opinion, the right lesson to draw from thinking about MIILs -- that we need more don't-try-to-second-guess-me switches on our HLL compilers. -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: ...!{uunet,att,rutgers}!snark!eric = eric@snark.UUCP Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718 -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: ...!{uunet,att,rutgers}!snark!eric = eric@snark.UUCP Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718
lamaster@ames.arc.nasa.gov (Hugh LaMaster) (10/06/88)
In article <e4ITv#4cfCcm=eric@snark.UUCP> eric@snark.UUCP (Eric S. Raymond) writes: >I consider this a detail. Front-ending is *not* the hard part in HLL >compilation; front ends are easy to write, and easy to port. Code generation >is the hard part. Eliminating the front end, by itself, doesn't pare away >enough complexity and cost to justify the MIIL concept. > > > > Well, certain steps like vectorization and certain other optimizations logically fall before production of the MIIL and are language dependent. These parts of the front end must be hard, judging by the number of bugs associated with production compilers in this area. So, in some cases there is a significant amount of work to writing a language dependent front end. Therefore, there is a significant potential benefit to using a MIIL if you can make it work. -- Hugh LaMaster, m/s 233-9, UUCP ames!lamaster NASA Ames Research Center ARPA lamaster@ames.arc.nasa.gov Moffett Field, CA 94035 Phone: (415)694-6117
yba@arrow.bellcore.com (Mark Levine) (10/10/88)
In article <358@istop.ist.CO.UK> itcp@ist.CO.UK (News reading a/c for itcp) writes: >I have another interest in MIIL and that is as a Language independent >intermediate code to promote the design and disemination of new programming >languages. Clearly it would be acceptable for the MILL implementation >cost to exceed the cost of a single HLL compiler, so long as it was cheaper >than two HLL compilers. If it were more expensive than that I would seriously >doubt its reliability and maintainability. > Eariler in this discussion I mentioned MARY. After recently talking to the fellow who taught it to me, I should add that he is working on the third generation of the language, and that to make this "new programming language" available, the target for the compiler is C. Given that most new machines these days get C as part of the initial language suite, even though it is not all things to all of us, perhaps (I was wrong and) we already have a _de facto_ MIIL. If the machine model under a particular C compiler is doing the "Wrong" thing (ala the discussion of Burroughs segments), you would have to have assembler escapes or your own code generator to get around it. This still sounds like a cheaper way to get started than porting a virtual machine. Perhaps the better topic is how much it costs to do better than C, rather than whether one can. In the context of the quoted article, I would consider C not to be an HLL. In the same context, let me agree with earlier postings and ask what are the objections to calling C the MIIL in question and saying it is already done and has zero new costs? Certainly an interesting way to distribute reliability and maintainability costs. Perhaps also a good reason to be locked into a "standard" C. Eleazor bar Shimon, once and future Carolingian yba@sabre.bellcore.com
db@lfcs.ed.ac.uk (Dave Berry (LFCS)) (10/10/88)
In article <e4ITv#4cfCcm=eric@snark.UUCP> eric@snark.UUCP (Eric S. Raymond) writes: >Certainly. It's called 'C'. > >No flames about C's problems, please. I know it's not perfect. But the *fact* >is that it is now filling the niche in the computer science ecology that you're >describing -- and you haven't advanced any compelling reasons to abandon its >HLLness in favor a search for a hypothetical uMIIL. C isn't the only language filling this niche. LISP is another. C is presumably better for languages where efficiency is a prime concern, and LISP for those requiring garbage collection, etc. The choice is also affected by the availability of implementations for the desired hardware; LISP would presumably be a better choice for a LISP machine. As an aside, I've heard both disparagingly described as "portable assemblers" (and I've heard their proponents take that as a compliment). Dave Berry, Laboratory for Foundations of Computer Science, Edinburgh. db%lfcs.ed.ac.uk@nss.cs.ucl.ac.uk <Atlantic Ocean>!mcvax!ukc!lfcs!db
cik@l.cc.purdue.edu (Herman Rubin) (10/12/88)
In article <831@etive.ed.ac.uk>, db@lfcs.ed.ac.uk (Dave Berry (LFCS)) writes: > In article <e4ITv#4cfCcm=eric@snark.UUCP> eric@snark.UUCP (Eric S. Raymond) writes: ..................... > C isn't the only language filling this niche. LISP is another. C is > presumably better for languages where efficiency is a prime concern, > and LISP for those requiring garbage collection, etc. The choice > is also affected by the availability of implementations for the desired > hardware; LISP would presumably be a better choice for a LISP machine. > > As an aside, I've heard both disparagingly described as "portable assemblers" > (and I've heard their proponents take that as a compliment). Neither C nor LISP can be described correctly as a portable assembler. A portable assembler should have the property that anything which the machine can do can be relatively easily described in the language in such a way that the resulting object code does what the programmer, understanding the machine instructions, timing, and limitations, wants it to do, and how he wants it done. Thus a portable assembler must be able to produce efficient versatile code. It should also be easy to write, with any construct that the programmer feels useful relatively easy to insert. I would find such a gadget very useful. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet, UUCP)
eric@snark.UUCP (Eric S. Raymond) (10/12/88)
In <912@sword.bellcore.com>, yba@sabre.bellcore.com (Mark Levine) writes: > [...] the target for the compiler is C. Given that most new machines > these days get C as part of the initial language suite, even though it is > not all things to all of us, perhaps (I was wrong and) we already have a > _de facto_ MIIL. [...] Perhaps the better > topic is how much it costs to do better than C, rather than whether one can. Precisely the point I have been trying to make. And, on a related topic: Peter ("Have you hugged your wolf today?") deSilva seems to think the point of a uMIIL is to provide a medium for selling software, a way for it to be distributed in machine-independent form that nosy hackers can't read and modify. Excuse me, but I thought the security problem in for-sale software was to guard it from unauthorized *copying* and *use*, not unauthorized *understanding*! A uMIIL does nothing for the real problem, since by definition it has to be easy to copy and run on lots of machines. -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: ...!{uunet,att,rutgers}!snark!eric = eric@snark.UUCP Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718
gwyn@smoke.ARPA (Doug Gwyn ) (10/13/88)
In article <970@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes:
-A portable assembler should have the property that anything which the machine
-can do can be relatively easily described in the language in such a way that
-the resulting object code does what the programmer, understanding the machine
-instructions, timing, and limitations, wants it to do, and how he wants it
-done.
I defy you to come up with one that can be used for all of:
IBM System/38, Burroughs B6700, Motorola MC68000, Intel iAPX432.
Yet C and LISP are (barely) doable for all these architectures.
diamond@csl.sony.JUNET (Norman Diamond) (10/14/88)
In article <831@etive.ed.ac.uk>, db@lfcs.ed.ac.uk (Dave Berry (LFCS)) writes: (About C and Lisp...) > As an aside, I've heard both disparagingly described as "portable assemblers" > (and I've heard their proponents take that as a compliment). Both languages' inventors created them expressly to be assemblers with a portable syntax. The description is not disparaging at all. Only certain critics who intend the description to be disparaging in fact reveal their gross ignorance. The phrase "portable assembler" is unfortunately ambiguous. This has led users to expect C PROGRAMS to be as portable as the language's SYNTAX. Since their demands have been listened to, C is losing its original capabilities. Anyone who wants to write portable PROGRAMS should use another language. Lisp pretty well fits the bill of machine-independence, despite its original purpose of assisting the coding of machine-language (not assembler-language) programs. -- ------------------------------------------------------------------------------- The above opinions are my own. | Norman Diamond If they're also your opinions, | Sony Computer Science Laboratory, Inc. you're infringing my copyright. | diamond%csl.sony.jp@relay.cs.net
gwyn@smoke.BRL.MIL (Doug Gwyn ) (10/28/88)
In article <10037@socslgw.csl.sony.JUNET> diamond@csl.sony.JUNET (Norman Diamond) writes: >The phrase "portable assembler" is unfortunately ambiguous. This has >led users to expect C PROGRAMS to be as portable as the language's >SYNTAX. Since their demands have been listened to, C is losing its >original capabilities. I'm not aware of any capabilities that have been lost. >Anyone who wants to write portable PROGRAMS should use another language. I have to take strong exception to this. C probably offers more support for writing significant portable programs than any other language. It has a nice balance of standardization and flexible accommodation of variant machine architectures and environments.
guy@auspex.UUCP (Guy Harris) (10/29/88)
>Both languages' inventors created them expressly to be assemblers with >a portable syntax. ... > >The phrase "portable assembler" is unfortunately ambiguous. This has >led users to expect C PROGRAMS to be as portable as the language's >SYNTAX. You mean users like Dennis Ritchie, Steve Johnson, etc.? Those foolish people; had they known that C programs were really assembler-language programs, they would never have tried to make them work on multiple machines.... To quote from Johnson's "C Program Portability": As soon as C compilers were available on other machines, a number of programs, some of thm quite substantial, were moved from UNIX to the new environments. In general, we were quite pleased with the ease with which programs could be transferred between machines. It goes on to say that the difficulties they ran into in porting were: 1) As the language evolved, compilers changed so there were incompatibilities between the compilers due to features that had made it into one compiler but not into another yet. 2) The machines ran different operating systems. The latter was described as the most serious difficulty, and led them to note "gee, UNIX is written in C, how about porting *it* to other machines" - a decision whose ramifications most of us can testify to.... >Since their demands have been listened to, C is losing its >original capabilities. For example? >Anyone who wants to write portable PROGRAMS should use another language. You may believe this, but there are a vast number of people whose experience indicates that it is simply not true. Given that, you may want to re-evaluate your belief.... (Remember, BTW, that "is-portable" is not a Boolean predicate; not all programs may be portable to completely arbitrary architectures, although the range of architectures that support C and UNIX is fairly impressive.)