In case you haven’t heard yet, Sun has open sourced Java under a version of the GPL. This includes the Java HotSpot virtual machine. I checked out the code for the vm used in the jdk1.6.0 and the first thing that I noticed is that it is written in C++, not C. For some reason I had always assumed it was written in pure C, but I guess it does make sense to implement a vm for an Object Oriented language in an OO language.
Onto compiling the HotSpot. Compiling a 1.6.0 jdk was relatively painless, it compiled in less than an hour (using OpenSuSE 10.2 on a Core2Duo laptop that was “Designed for Windows XP”) Here is a quick and dirty how-to, Read the HotSpot FAQ for more detailed information.
Note that gnu dev tools should be installed like g++, gcc, gnumake.
1. Download (or check out via Subversion) HotSpot code
2. Edit hotspot/build/linux/Makefile:
change the following line: $(LINK_VM) -Wl,–verbose $(LFLAGS_VM) 2>&1 > /dev/null | \
to: $(LINK_VM) -Wl,–verbose $(LFLAGS_VM) 2>&1 | \
In other words, remove the redirection into /dev/null
3. Edit osse-build-linux-i586 script to point to the bootstrap and source JDK’s, they are allowed to be the same.
4. Make the osse-build-linux-i586 script executable: %>chmod +x osse-build-linux-i586.sh
5. Run the osse-build-linux-i586 script
The time to run a successful build will vary depending on the speed of your machine.