Skip to main content

AOT compiler for Java update 10

19 replies [Last post]
bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

This is a question to the java team. But all welcome to answer too :) .

why not add AOT compiler to java, this will close the gap between it and .net regarding speed of execution.

another thing that makes java not a number one choice for desktop apps is the fact that you need the jre on the target platform or the user has to install it or you have to bundel it with your app. Why not have option in the jdk to generate native executable for target platform , that way easy deployment. i believe with AOT you can accomplish this task too, just have the exe ready for deployment with libs needed ,without needing the jre.

gcj has somthing like that , unfortunatly gcj is far from ready.

Thanks,
Bilal El Uneis

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

looking at the jvm hotspot notes, i see that to build it on linux you shouldnt have issues, but on windows you need M$ compiler. why couldnt sun just use gcc for building jvm, gcc is available for almost all platforms.

i hope that jdk is now open source that some hackers will try and port its code to be compiled using gcc on windows , gcc on apple, gcc on unix .. gcc everywhere.

i read somewhere that the fact that jdk is now open source, it is just matter of time before it is made nativly compiled and will compile nativly on linux dist. hope that is the case on windows too soon , or at least gives u that option to generate either class file or native.

im sure also that the fact jdk is open now JET can make their tools even greater, i have used jet before, the evaluation version ofcourse. Very impressive. But as a developer i like My stuff open sourced and Free if possible. :D

Bilal El Uneis

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> looking at the jvm hotspot notes, i see that to build
> it on linux you shouldnt have issues, but on windows
> you need M$ compiler. why couldnt sun just use gcc
> for building jvm, gcc is available for almost all
> platforms.
Well, maybe because it needs to be done first and also mains maintaining another build configuration.

> i hope that jdk is now open source that some hackers
> will try and port its code to be compiled using gcc
> on windows , gcc on apple, gcc on unix .. gcc
> everywhere.
As far as I know openjdk is, or will be in a short time, buildable with the free visual studio express - which means you get the compiler for free.
Sure gcc is nice and open, but anyway, Windows is closed so what does a open compiler change?

> i read somewhere that the fact that jdk is now open
> source, it is just matter of time before it is made
> nativly compiled and will compile nativly on linux
> dist. hope that is the case on windows too soon , or
> at least gives u that option to generate either class
> file or native
> impressive. But as a developer i like My stuff open
> sourced and Free if possible. :D

Be honest, you simply don't want to pay for it ;)
So to be able to get something free, either people are working on it for free or somebody sponsors this development.

Sun is not really interested to get a native compiler, because it could eventually even hurt their java platform, so who should do it -> why don't you start instead of suggesting "the open source hackers" what to do ;)

Please don't take an offense, lg Clemens

bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

no offense taken bro. if i could and if i have the time to do it i would. but im always busy with my work "Software developer" ;) + im doing another project on my free time which i will post soon on the java.sun forum , it is in pure java which i will soon port to .net using C# when i have time :D and post on forum too.

but maybe some one who has time and skills will read this one day and say "hey i can do this" .. ;)

Bilal El Uneis

dleskov
Offline
Joined: 2003-06-27
Points: 0

> i guess we should wait and see what GCJ does and if
> awt and swing and other libraries in jdk 1.4 - 1.5
> are going to be there anytime soon.

My [b]biased[/b] opinion is that Sun has pretty much killed both GCJ and Classpath by releasing OpenJDK under the GPL. I recall reading about some key contributor leaving those projects in favor of OpenJDK, though I could not immediately find the link.

It took us many person-months of engineering work to fully support J2SE 5.0 and Java SE 6, even though we use the licensed Sun's implementation of the standard library in Excelsior JET (except of course for some low-level classes). Now with OpenJDK readily available, I doubt many people would be interested in dubbing the Sun's work instead of innovating or porting OpenJDK to the new platform.

> i know that gcj can be used with swt for now and
> there is Java native Compiler on sourceforge etc..

Java Native Compiler is just a graphical front-end to GCJ.

Dmitry Leskov
Excelsior LLC

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Hi Dmitry,

Please don't get me wrong what I said about JET.
JET is great to solve some sort of problems, but for some not. My statements should just highlight that native compilation is not the solution of all of java's performance problems.

lg Clemens

dleskov
Offline
Joined: 2003-06-27
Points: 0

> Please don't get me wrong what I said about JET.
> JET is great to solve some sort of problems, but for
> some not. My statements should just highlight that
> native compilation is not the solution of all of
> java's performance problems.

Sure, we never claimed our product is a silver bullet. It has its strengths and weaknesses compared to the conventional JRE, question is whether for your particular app the strengths outweigh the weaknesses.

Actually, most of so called "Java performance problems" are the result of so called "Java developers" having no idea about performance. If you think the natural way of finding the maximum and minimum element of an array is to clone it, sort the clone, and take its first and last element, there is no doubt you are going to face those performance problems.

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> Actually, most of so called "Java performance
> problems" are the result of so called "Java
> developers" having no idea about performance. If you
> think the natural way of finding the maximum and
> minimum element of an array is to clone it, sort the
> clone, and take its first and last element, there is
> no doubt you are going to face those performance
> problems.
Oha ;)

Good luck with JET development ... maybe after university, some day, I can afford it ;)

lg Clemens

dleskov
Offline
Joined: 2003-06-27
Points: 0

> Good luck with JET development ... maybe after university, some day, I can afford it ;)

Have you seen http://www.excelsior-usa.com/jetfree.html ?

Dmitry

matzon
Offline
Joined: 2003-06-10
Points: 0

> executables like jet that doesnt need jre installed
> and cant be reveresed engineered. this should appeal
> for desktop application developers and big companies
> that want to protect their code.

o rly? - that comes of rather naive. You might want to look into decompilers for native code before stating that.

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> o rly? - that comes of rather naive. You might want
> to look into decompilers for native code before
> stating that.

Yes, its almost impossible - very much like it is with C++.

lg Clemens

bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

i guess we should wait and see what GCJ does and if awt and swing and other libraries in jdk 1.4 - 1.5 are going to be there anytime soon.

i know that gcj can be used with swt for now and there is Java native Compiler on sourceforge etc..

Bilal El Uneis

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

The main problem is the large size of the java class libraries - libgcj.so is already very large, even if its absed on Classpath - but porting GCJ to compile OpenJDK would multiply that size. (have a look at ikvm where the classpath version is ~6mb and OpenJDK's ~25mb).

Keep in mind that a typical swing application, compiled with GCJ and statically linked (so that code which is not used is not included in the resulting binary) will weight 15-40mb native code. I doubt that loading 25mb from disk is any faster than starting the client-jvm and watch hotspot's warmup...

lg Clemens

bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

You have a point lg, yet once the program starts up then it is machine code speed from there on. Also the fact it is machine code = very hard to reverse engineer.

Bilal El Uneis

Message was edited by: bilal_el_uneis

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Yes you are right. Native code is the solution to all of java's problems, somehow I just missed that.

bilal_el_uneis
Offline
Joined: 2006-12-10
Points: 0

Yes i have heard and used it before , what im talking about is implementing that as an option in the jdk, forget about AOT, and lets talk about generating pure executables like jet that doesnt need jre installed and cant be reveresed engineered. this should appeal for desktop application developers and big companies that want to protect their code.

also that will close the gap between java and other langages, it can be interpeted, just in time, and fully compiled.

Openions.

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> this should appeal
> for desktop application developers and big companies
> that want to protect their code.
Well, but the question is then why not simply use JET?
It does everything you mentioned, and is not that expensive - it costs almost "nothing" for large companies.

> also that will close the gap between java and other
> langages, it can be interpeted, just in time, and
> fully compiled.
Really? Or would it throw up compatibility problems (old packages which don't run on new linux distributions, ...) and mislead companies to only support the most important OSs?

However the largest problem would be that that only few computers which would have a runtime installed because almost all java programs are "statically" compiled?
Imagine how much java installations exist just because people would like to use Azureus or LimeWire - and now imagine what would happen if those packages would habe distributed pre-compiled.

I had startup-performance problems with JET which I was only able to solve with very agressive executable compression (which enlarges memory useage), just because the executable generated by JET are so large, to get it deployable a lot of hand-optimization and tuning was needed. So from a startup-performance point I doubt this would help a lot.

lg Clemens

dleskov
Offline
Joined: 2003-06-27
Points: 0

> I had startup-performance problems with JET which I
> was only able to solve with very agressive executable
> compression (which enlarges memory useage), just
> because the executable generated by JET are so large,
> to get it deployable a lot of hand-optimization and
> tuning was needed. So from a startup-performance
> point I doubt this would help a lot.

I would greatly appreciate if you could email a summary of your quest to java at excelsior-usa.com. Your input would enable us to improve our product.

Excelsior JET used in default mode may indeed slow down the cold start of a [b]small[/b] application compared to the JRE. However, for [b]large[/b] applications we have observed up to 2x startup time reduction, and you only need to do two things for that:

- Enable the Global Optimizer
- Use the Executable Image Optimizer

Even though you will end up with a large executable, only a minor part of it will be loaded upon startup, so there will be less disk I/O compared to a conventional JRE. And the larger you application is, the greater the startup time improvement will be.

Dmitry Leskov
Excelsior LLC

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

Really, this has been discussed up and down - internal SUN studies found out that AOT compilation does not help a lot when it comes to startup-time (keep in mind the compiled code has to be loaded from the _slow_ harddrive), furthermore performance of AOT-compiled code will be lower than hotspot-server compiled code and under some circumstances even slower than hotspot-client.
Furthermore I doubt this could be done in the few months till the update10 release.

If you really need it I also recommend Excelsior JET which is a great and impressive tool.

lg Clemens

ratoo
Offline
Joined: 2007-08-27
Points: 0