Thoughts about static linking and reducing size of binaries

Bryce McKinlay bryce@albatross.co.nz
Thu Mar 15 15:00:00 GMT 2001


Edgar Villanueva wrote:
> Actually towerj and jove both take this approach.
>> So, it should be feasible.
>> They both take an iteretive approach to staticaly compiling a java
> application.
> Every time you load a class it's logged when in debug mode. This log
> file is then fed to the build environment to choose which classes to
> link.

It might be difficult to ensure safety in situations where you have
something like:
if (something_really_weird_happened)
 throw new FooException();
The throw branch might never be taken in a typical run, and FooException
therefore never loaded but you presumably want the program to be able to
catch it instead of crashing in case it does occur when the application is
deployed. Do you know how towerj and jove deal with this sort of thing?
Still, this is a technicality and I think that if the compiler gets the
underlying ability to replace certain classes with some kind of
weak/undefined reference in static compiled output, we can worry later
about the exact technique used to decide what classes do and don't go in.
This gets back to the need for whole package/whole program compilation. I'm
thinking it is too difficult to do this portably at the linker level - but
when we write a front-end that can do whole-program static compilation and
optimization, we can make it a lot smarter about what does and does not go
into a static binary.
regards
 [ bryce ]


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /