Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native AWT #528

Merged
merged 47 commits into from
May 26, 2024
Merged

Native AWT #528

merged 47 commits into from
May 26, 2024

Conversation

wasabii
Copy link
Contributor

@wasabii wasabii commented May 24, 2024

New native libraries: libawt, libawt_headless, libawt_lwawt, libawt_xawt, libfontmanager, libfreetype, libjawt, libjnf, libjpeg, liblcms, libmlib_image, libosxui.

Notable:

libawt is the basic AWT library. The Windows version has the full implementation contained in it. On Linux, minor parts are included in libawt, and libawt_xawt or libawt_headless are loaded depending on whether in headless mode or not. On OSX libawt_lwawt is used.

Font support is done using freetype. This library is distributed with IKVM for Windows and OS X, but the Linux version relies on the platform freetype being present and linkable.

We are using static fontconfig files from Windows on each OS for now. This can be fixed later, but the files need to be generated at build time from templates.

Local imageio/jpeg stuff is removed. Replaced with libjpeg. The entirety of the peices of local AWT stuff are gone.

LoadLibrary now inherits the caller ID. This needs more review: I think we can use the complete LoadLibrary implementation in native code now to replace all this. But more research should be done.

mlib_image is a static library, and ends up embedded into the other deps.

OSX uses a Framework named JavaNativeFoundation. This does not exist on arm64, which seems to be the main reason JDK8 isn't available for newer Macs natively. JNF however was open sourced. We incorporate this source for ARM64 only. Still uses built in version for x64. Another Framework, JavaRuntimeSupport, is missing a method, which we implement as a DEFINE that points to an inline version.

Add AWT and Swing and Java2D.
ref assembly will be a copy of Windows for now, until we can figure out what to do
Set up AWT/Printing properties based on OS.
Ensure classes appropriate.
…ill need to be included in Image as well eventually to build fontconfig.bcf.

Make UNICODE;_UNICODe default for windows builds.
After Unicode switch, make sure we marshal platform encoding, whatever that is (LPTSTR).
Enable libjpeg.
…nternally needs to handle conversion to/from that.
Fix a few deps.
… into OpenJDK. Few more OPenJDK things.

Fix up project files for other libs for OSX.
Include a bunch of fixed .h files that have i64 suffix.
… used by lwawt. Unsure what's up with upstream with this. We do this by using a PreprocessorDirective to rewrite JRSCopyOSVersion to JRSCopyOSVersion2, which is then implemented statically to return 10.15, since it only cares whether it's snow leopard or below.

Get FreeType and Fontmanager building.

Add mapfiles to a few AWT projects.

Get libawt_headless building and included.
… potentially going to call OnLoad which needs to capture the caller context class. After looking through this, we might be able to dump JNINativeLoader and exclusively use ClassLoader.c code for this. Needs more study. This would be a big reduction in code though. It handles WIn32 name mangling, all of that, on it's own.

Unsafe.freeMemory can just return if null pointer, according to unsafe.cpp.
…ing some symbols off because of it. Win32 shold only export things with attributes. Linux should use mapfiles. I'm not sure what's supposed to work with OSX. But we shall see.
@wasabii wasabii merged commit 6c8c0a3 into develop May 26, 2024
136 checks passed
@wasabii wasabii deleted the awt branch May 26, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant