From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public From: torbenm@diku.dk (Torben AEgidius Mogensen) Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/02 Message-ID: <60vj9p$7mg@vidar.diku.dk>#1/1 X-Deja-AN: 277268570 Sender: torbenm@thor.diku.dk References: <3431A2DB.4273@EasyInternet.net> <34326556.2216DC70@virginia.edu> <5l90wd2sbj.fsf@tequila.systemsz.cs.yale.edu> <60uek7$fon$1@lyra.csx.cam.ac.uk> <60ui2q$33a$1@cdn-news.telecom.com.au> Organization: Department of Computer Science, U of Copenhagen Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec pcm@vus002.telecom.com.au (P Murray) writes: >Nick Maclaren (nmm1@cus.cam.ac.uk) wrote: >: For efficient use of modern architectures, we need languages in which we >: programmers can express what we want to say in a fashion that can be >: converted to the sort of instruction stream that executes fast. And >: the current trends are in exactly the opposite direction. >Any suggestions on what such a language would look like? Hopefully >it will not look like ASM. Would it be possible to modify C/C++ in >such a way as to allow this? A possibility is SML using the region-based memory model. You would still do pointer cahsing, but the regions model keep a fairly good locality (elements of the same list stay close, even when other data is allocated in-between). In SML you also avoid most of the aliasing problems of C/C++. The technology still needs a few years to be competitive with C. One problem is that the polymorphic type system in SML introduces extra indirections (boxing). This can be solved if you compile the entire program in one job, as the polymorphism can be eliminated when all uses are known. Though, theoretically, this can give an exponetial blow-up in code size, experiments show that the code expansion is usually small. You can use the regions model on C-like languages, but you would have to give up on a lot of the 'dirty' features of C, such as type casting and varargs. >And finally, could anyone recommend ways to code in C/C++ that >avoid these problems and allow the optimiser to produce the >most efficient code? I assume virtual function calls would >be out, as well as all forms of aliasing. It is not enough that you avoid aliasing. The compiler must be able to recognize that there is none. And this is not often possible, especially if you use separate compilation. If a language is designed such that aliasing doesn't occur or only does so in easily identifiable contexts (e.g. array lookups), the compiler can use this assumption safely, even without complex and inaccurate analysis. Torben Mogensen (torbenm@diku.dk)