IcedTea Bootstrap Process

Gary Benson gbenson at
Tue Jan 20 02:57:27 PST 2009

Greg Lewis wrote:
> On Mon, Jan 19, 2009 at 09:17:45AM +0000, Gary Benson wrote:
> > Kurt Miller wrote:
> > > True. At some point we will get to OpenJDK6 too. For now I'm
> > > following the standard practice of following current/HEAD/tip to
> > > increase the likelihood of our work making it in the main
> > > tree. If it turns out that Sun isn't interested in merging BSD
> > > support into the main tree I would expect that we will change
> > > our focus to OpenJDK6.
> > 
> > How are the BSD changes split between HotSpot and the class
> > library?
> The HotSpot changes are more extensive since we need to create a
> whole BSD hierarchy to mirror the Linux and Solaris ones.  However,
> the code itself is often very similar if not identical to Linux or
> Solaris.

That's pretty much how it is for Zero too.

> The big sticking point here, as Kurt has already mentioned, is time.
> I think it would be great to get BSD support into IcedTea, but I'm
> not sure that I have time to commit to making it happen.  For me,
> the main focus will probably continue to be OpenJDK7 and keeping the
> BSD port of that up to date.  That is the minimum bar we need to
> meet to be able to get our changes merged into mainline.
> Having said that, IcedTea has some benefits, the primary one being
> the Zero port which will give us support for extra architectures
> (all?  of which are supported by at least one BSD variant I
> believe).  So what I'd really like to evaluate is how hard that
> would be to port to BSD.  Where do I need to look at in the IcedTea
> tree to get a handle on this?  Should I just look at the ppc
> specific directories in HotSpot?  Presumably there is also some
> shared code between the different architectures that Zero supports
> though?

Some shared code?  Zero is *all* shared code :D There is a bit in
os_linux_zero.cpp [1] to handle ia64's wacky stack, a bit in
os_linux_zero.hpp [2] to provide 64-bit atomic copy on 32-bit pcc,
and some bits in atomic_linux_zero.inline.hpp [3] to provide atomic
operations on m68k and arm, but the remaining 6000 lines or so are
plain old C++, with the odd conditional here and there to cope with
differences in endianness and word size.

Zero is basically a CPU port; to the makefiles, when you build with
Zero your $ARCH is "zero" rather than "x86" or "sparc" or whatever.
If you check out a copy of IcedTea (6 or 7) you'll see a ports
directory, the contents of which are symlinked into the OpenJDK tree
at the start of the build.  Aside from a couple of patches, the vast
majority of zero is here:


To port Zero to BSD, what you basically need to create is this:


There's something like 1300 lines of code in there, but pretty much
all of it can just be copied straight from the Linux directory.
You could get a nice starting point with something like:

  for i in ports/hotspot/src/os_cpu/linux_zero/vm/*; do
      j=`echo $i | sed 's/linux_zero/bsd_zero/'`
      sed 's/linux_zero\.cpp/bsd_zero.cpp/' < $i > $j

os_linux_zero.cpp may need a little more work but hopefully not much.

> Also, what progress has been made getting Zero into the main
> OpenJDK7 sources (which is an approved project as I understand it)?

It's an approved project, but I haven't started using its repo yet.
There are two reasons why.  One is that there are a bunch of cpu-
specific patches in IcedTea that Zero needs, and I need to take a
week to sit down, check they're necessary, file bugs, and submit
patches and make testcases for them all.  (This is a lot easier
now that IcedTea6 is using the latest HotSpot.)  The other reason
is that Zero is a bit too slow for me to want to develop it without
the ecj-bootstrap stuff in IcedTea; once Shark is good enough to
develop with (and it so very nearly is) I'll get to switching over.
It's taken much longer than I anticipated because I've taken some
time out of Shark development to work on getting a Zero build to
pass the TCK.



[1], from line 307
[2], from line 37
[3], from lines 28 and 103

More information about the bsd-port-dev mailing list