Old Java PRs

Jeff Sturm jsturm@one-point.com
Mon May 12 18:11:00 GMT 2003


On Mon, 12 May 2003, Andrew Haley wrote:
>  > Unless I misunderstand this PR, it is fixed by the new inliner (except for
>  > the bytecode frontend, which still does not emit whole functions as
>  > trees).
>
> It isn't.  The new inliner still will not inline functions until they
> have been expanded.

Unfortunately the PR doesn't include a test case.  This is what I tried:

$ cat A.java
class A {
    int _y;
    final int x() {
        return y() + 1;
    }
    final int y() {
        return _y;
    }
}

$ gcj -O3 -S -g0 -fno-exceptions -fomit-frame-pointer A.java

$ more A.s
...
_ZN1A1xEv:
.LFB2:
        subl    $12, %esp
.LCFI0:
        movl    16(%esp), %eax
        movl    %eax, (%esp)
        call    _ZN1A1yEv
        incl    %eax
        addl    $12, %esp
        ret

Reversing the declaration order of x and y, I get:

_ZN1A1xEv:
.LFB3:
        movl    4(%esp), %eax
        movl    4(%eax), %eax
        incl    %eax
        ret

So it looks as though you're right, though I could swear I've seen this
work before.  My understanding of the tree inliner is that it does not
require expanding the inlined bodies to RTL, but I don't remember the
details.

Jeff



More information about the Java mailing list