status of inter-class inlining in Java?

Nathanael Nerode neroden@twcny.rr.com
Fri Jul 16 08:08:00 GMT 2004


Consider the following sort of potential situation in libgcj:

class System {
  public static final foo() {
    B.foo();
  }
}

class VMSystem {
  static final foo() {
    ...
  }
}

Preferably VMSystem.foo should be inlined into System.foo during compilation.
(This would make it reasonable to merge a bunch more with Classpath, and
would more generally help with the indirection penalty caused by the rampant
forwarding methods used in much of Java.)

>From what I can tell, however, this doesn't seem to happen.  I suppose this
is because the VMSystem class might theoretically change after compilation
of the System class; the two are compiled separately.

Is it reasonable to consider using -combine to build parts of the libraries
with intermodule optimization?  Would this work?  Is there an analogue when
building the .class files?

(It would clearly be impossible, memory-wise, to compile the whole library
at once. But significant gains could still be had, most likely, by compiling
collections of particularly interwined classes this way.)

So is this worth looking into?

-- 
There are none so blind as those who will not see.



More information about the Java mailing list