Re: The quest for the optimal calling convention; a model for specifying multiple calling conventions (longish)

"John R. Strohm" <strohm@airmail.net>
11 Feb 2003 01:19:10 -0500

          From comp.compilers

Related articles
The quest for the optimal calling convention; a model for specifying m jsykari@gamma.hut.fi (Antti Sykari) (2003-01-12)
Re: The quest for the optimal calling convention; a model for specif fjh@cs.mu.OZ.AU (2003-01-17)
Re: The quest for the optimal calling convention; a model for specifyi jsykari@kosh.hut.fi (Antti Sykari) (2003-01-25)
Re: The quest for the optimal calling convention; a model for specifyi strohm@airmail.net (John R. Strohm) (2003-01-26)
Re: The quest for the optimal calling convention; a model for specifyi rodney.bates@wichita.edu (Rodney M. Bates) (2003-01-27)
Re: The quest for the optimal calling convention; a model for specif strohm@airmail.net (John R. Strohm) (2003-01-29)
Re: The quest for the optimal calling convention; a model for spe rodney.bates@wichita.edu (Rodney M. Bates) (2003-02-05)
Re: The quest for the optimal calling convention; a model for specifyi strohm@airmail.net (John R. Strohm) (2003-02-11)
| List of all articles for this month |

From: "John R. Strohm" <strohm@airmail.net>
Newsgroups: comp.compilers
Date: 11 Feb 2003 01:19:10 -0500
Organization: Compilers Central
References: 03-01-065 03-01-070 03-01-126 03-01-164 03-01-169 03-01-172 03-02-007
Keywords: design, storage
Posted-Date: 11 Feb 2003 01:19:10 EST

"Rodney M. Bates" wrote:
> All true. But the situation I was complaining about
>
> 1) Happens even in the absence of interrupts, other threads, etc., and


True.


> 2) Can be fixed without outlawing aliasing or non-local references,
> by just specifying in the langauge, what the parameter transmission
> mechanism is.


Maybe so, but allowing aliasing and/or non-local references breaks a
lot of other things.


The problem with allowing aliasing and/or non-local references is that
it destroys all possibilities for optimization AND verification,
because the most fundamental assumption under serious optimization is
that variables don't change unless the programmer changes them.


Consider the following contrived code fragment in C


void foo(int *a, int *b)
{
    *a = 1;
    *b = 2;
    if (*a == 1) {
        printf("Win\n");
    } else {
        printf("LOSE BIGTIME!\n");
    }
}


If the language outlaws aliasing, this immediately simplifies to


void foo(int *a, int *b)
{
    *a = 1;
    *b = 2;
    printf("Win\n");
}


However, if aliasing is allowed, and we do


        foo(&baz, &baz);


then we don't know what will be printed and we may not know what value baz
will have afterwards.


The same things happen with non-local references. If we call a
procedure in the middle of another procedure, the value of ALL
non-local variables become unknown, and no optimization can proceed
across the procedure call. On the other hand, if non-local references
are outlawed, then only those variables that may be altered by the
procedure call can possibly be affected by the call, and the compiler
can keep the rest of his optimizations alive.


In short, allowing aliasing and non-local references is a BAD THING.


Post a followup to this message

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