Xref: utzoo comp.arch:6853 comp.lang.c:13598 comp.lang.misc:2055 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!wasatch!utah-gr!uplherc!esunix!bpendlet From: bpendlet@esunix.UUCP (Bob Pendleton) Newsgroups: comp.arch,comp.lang.c,comp.lang.misc Subject: Re: Universal Disassemblers vs. Universal MIILs Message-ID: <1029@esunix.UUCP> Date: 26 Oct 88 20:27:31 GMT References: <6152@june.cs.washington.edu> Organization: Evans & Sutherland, Salt Lake City, Utah Lines: 58 From article <6152@june.cs.washington.edu>, by pardo@june.cs.washington.edu (David Keppel): > I claim that I can distribute C code to my programs and it is > completely useless. I gave an example of this quite a while back. > I need to do things such as: > > * Rename all variables. > * Hoist (inline) functions. > * Do loop transformations (e.g. for() loop to a goto loop). > * Strip out all comments. > * Run the preprocessor to remove #ifdefs (Is this the same > value "4" that appeared in the line before, or are they > unrelated?) > * Avoid standard libraries. Why? > * Do code motion. > * Delcare wasted variables, dead code, unoptimize code that > an optimizer can put back together again later, ... Again why? > Essentially, preform all the optimizations that I can on the C source, > and steal liberally from the Obfusacted C Code Contest. Ignoring the deliberate obfuscation this gives you source code that a fairly dumb compiler can convert to reasonably good object code. One trouble with it is that it is portable, but not machine independent. It can only become machine dependent by establishing a standard for the sizes of all data types and the semantics of Cs "defined to be undefined" operator/operand pairs. The MIIL cannot be C because C is not machine independent. Another problem with using C as an MIIL is that the only subroutine calling conventions and scoping rules that can be efficiently represented in C are those of C. the scoping rules and subroutine linking mechanisms of languages like MODULA-2 and LISP do not map well onto C. Maybe this discussion will get a little farther if we drop the "Intermediate Language" part of MIIL and try looking at it as a MISDL (Machine Independent Software Distribution Language). Is it safe to even try to talk about a machine independent dialect of C? With extensions that provide low level mechanisms to allow several different subroutine linking and scoping rules to be implemented efficiently? BTW, a quick pass with an editor to convert all your hard to read names into short names like i1 for ints and c3 for chars makes your example a lot easier to read. It's the macro expansions that make it hard to follow. Bob P. -- Bob Pendleton, speaking only for myself. An average hammer is better for driving nails than a superior wrench. When your only tool is a hammer, everything starts looking like a nail. UUCP Address: decwrl!esunix!bpendlet or utah-cs!esunix!bpendlet