Improving OpenJDK for FreeBSD

Harald Eilertsen harald+jdklists at volse.no
Fri Feb 14 09:18:02 UTC 2025


Hi David,

Thanks for your feedback!

On Fri, Feb 14, 2025 at 02:37:55PM +1000, David Holmes wrote:
> Thanks for that - much appreciated. I hadn't realized FreeBSD port would
> cover x86_64, PPC and Aarch64.

I'm not sure how important the PPC support is. My main focus is Aarch64
and x86_64. If that makes things easier, I can drop the PPC support for
now, and get back to it if there's a need for it later.

I also agree with you both on the amount of makefile changes, and the
ifdefs. In particular, I think there's room for refactoring to reduce
the amount of conditionally compiled code, especially for the larger
sections in the mac/bsd sources.

The makefile (and autoconf) changes reflect the differences between how
the different UNIXes are organized at the file system and library level,
but there's also a number of changes that just makes the compiler and
linker flags identical for the BSD's and Linux. (A notable difference is
how to link with pthread.)

>                                                              - which shows
> the other BSD ports are incomplete and can't fully function ... so maybe we
> should dispense with the illusion that there is some support for them?

As mentioned, my focus in only on FreeBSD, so I'm fine with dropping the
parts that are only relevant for the others for now. It should still
make a better foundation for a port to the other BSD's along the same
lines as the full BSD port has been maintained up until now.

> What is the relationship between __OpenBSD__ , __FreeBSD__ and
> _ALLBSD_SOURCE? The mixed usage is quite confusing.

It is confusing!

_ALLBSD_SOURCE identifies all the BSD platforms _including_ __APPLE__.
_BSDONLY_SOURCE identifies all the BSD platforms _except_ __APPLE__.

__OpenBSD__, __NetBSD__ and __FreeBSD__ are the system provided defines
identifying each specific OS.

In addition there's `BSD` that's defined at least in parts of the
hotspot code, that I think correspond to _BSDONLY_SOURCE.

Personally I'm in favour of dropping the _ALLBSD_SOURCE, and renaming
the _BSDONLY_SOURCE to just __BSD__, or even just using the already
defined BSD from hotspot.

> Overall the amount of changes for hotspot were less than I had expected, but
> I was surprised by some of them. There may be scope for additional code
> sharing if we can shuffle things around (...)

Perhaps that's a place to start? Identify parts that by moving them to a
common place would reduce the diff for the FreeBSD port?


Harald Eilertsen
--
Eilertsens Kodeknekkeri
https://kodeknekkeriet.net


More information about the jdk-dev mailing list