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

libnet and libnio #409

Merged
merged 72 commits into from
Sep 7, 2023
Merged

libnet and libnio #409

merged 72 commits into from
Sep 7, 2023

Commits on Aug 12, 2023

  1. Add libnet and libnio.

    Need to devise a way to get the platform specific headers from IKVM.Java. This requires new IKVM.Net.SDK support, and to split up IKVM.Java into platform specific versions. Which introduces our ref-assembly problem. Needs to be solved.
    wasabii committed Aug 12, 2023
    Configuration menu
    Copy the full SHA
    1ec891f View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2023

  1. Added net.dll and nio.dll. Building many files, though many are exclu…

    …ded since they don't exactly match the headers generated by IKVM.Java. Some important utiltiies are available, however.
    
    For instance, Net.socket0, for creating sockets, can now be used.
    FileDispatcherImpl will be an important one to get building, but it doesn't build just yet.
    ServerSocketchannelImpl does, SocketDispatcher, SocketChannelImpl, LinuxWatchService.c builds. UnixNativeDispatch
    Trying to figure out how to materialize a .NET framework socket out of a handle.
    wasabii committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    814de7d View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2023

  1. Add a setFd and setHandle method to FileDescriptor, so IOUtil and fri…

    …ends can be used to set the FD from the call to socket0(). Core makes this easy, as it will take an existing handle. Framework needs to invoke the SocketInformation ctor, with information provided by a duplicate socket. Mono is unimplemented. But, if on Unix, we can probably pack some stuff into SocketInformation. Leave that up to the future.
    
    Fix a few JNI calls.
    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    2f5d2e4 View commit details
    Browse the repository at this point in the history
  2. Enable other runtimes.

    Update Clang version to release.
    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    8d75fff View commit details
    Browse the repository at this point in the history
  3. Remove Net.java.

    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    1628512 View commit details
    Browse the repository at this point in the history
  4. Merge develop.

    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    ef520bc View commit details
    Browse the repository at this point in the history
  5. Remove win81-arm. This is deprecated on .NET Core 5+ anyways. There i…

    …s technically still Windows machines with Framework out there with ARM32.... but, I think the chances of them using IKVM are zero.
    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    c1b23d7 View commit details
    Browse the repository at this point in the history
  6. Remove explit inclusion of libpthread. Not needed in latest glibc, an…

    …d not available in musl.
    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    ba0daca View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4364f12 View commit details
    Browse the repository at this point in the history
  8. Change line feeds back?

    Always use LoadLibraryEx on Windows. NativeLibrary seems to have some uncertainty about when it tries to do path searches and stuff.
    wasabii committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    515d26d View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2023

  1. Use LoadLibraryExW explicitely. NativeLibrary from .NET Core just com…

    …plicated things needlessly between Framework/Core.
    
    Rename libjava to libikvm. I hate this. But, .NET Core produces a java.dll file, which is loaded into the process using LoadLibrary, even though it's not native. And screws up dependency resolution for net.dll and nio.dll. dotnet/runtime#90839
    Will research the single file thing. Need to figure out how to apply it to everything in files to publish.
    wasabii committed Aug 19, 2023
    Configuration menu
    Copy the full SHA
    f658b59 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8de41f5 View commit details
    Browse the repository at this point in the history
  3. Remove some weird properties.

    wasabii committed Aug 19, 2023
    Configuration menu
    Copy the full SHA
    4cc070a View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2023

  1. Move loading of 'jvm' up into JNINativeInterface.

    Just call Load a second time. Same result.
    libnio needed a blank JNI_OnLoad. Not sure on this one. Doesn't exist in OpenJDK.
    Wrap dlopen() in libjvm. P/Invoke wasn't capable of resolving symbol properly on Linux, with libdl being deprecated in Ubuntu > 22.
    wasabii committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    6fb7b33 View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2023

  1. Use proper address family based on socket.

    Enable native initIDs method.
    Add a datagram test to the Java lang tests.
    Add a test to check that adhoc send fails when connected.
    Add some tests for bind with null values.
    wasabii committed Aug 27, 2023
    Configuration menu
    Copy the full SHA
    4f4fd51 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2023

  1. Enable native isIPv6 detection.

    Add a test for joining IPv6 multicast groups.
    Skip unaligned long compare and swap tests on ARM[64]. Crashes with SIGBUS or similar. ARM doesn't support unaligned atomics.
    Add missing socket functions ot jvm.cpp.
    wasabii committed Aug 28, 2023
    Configuration menu
    Copy the full SHA
    3b24828 View commit details
    Browse the repository at this point in the history
  2. No need for separate dl* functions, since JVM_LoadLibrary, etc, provi…

    …de the same functionality.
    
    Fix test for osx-arm64.
    wasabii committed Aug 28, 2023
    Configuration menu
    Copy the full SHA
    c81f1d6 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2023

  1. Move osx opts to targets. Change install_name to @loader_path/lib$(Ta…

    …rgetName).dylib, which should allow linking libs to resolve from relative paths? Maybe.
    wasabii committed Aug 29, 2023
    Configuration menu
    Copy the full SHA
    a5c7cb3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e51a2ee View commit details
    Browse the repository at this point in the history
  3. Implement JVM_GetLastErrorString, needed by FileDispatcher.

    Use native FileDispatcher. We had to make a local copy of FileDispatcher.c in order to use lock0, since the signatures differ between solaris/windows versions. This is a minor fork, and gets locking working... maybe on OS X too?
    Remove lock0/release0 implementation from C#, use C version.
    wasabii committed Aug 29, 2023
    Configuration menu
    Copy the full SHA
    091a9a5 View commit details
    Browse the repository at this point in the history
  4. Repeat.

    wasabii committed Aug 29, 2023
    Configuration menu
    Copy the full SHA
    73bf17f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3e5e321 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2023

  1. Remove unused project.

    wasabii committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    4551d9f View commit details
    Browse the repository at this point in the history
  2. So, libjava will be known as libiava, one off. We need libikvm name f…

    …or non-java related IKVM native functionality apparently.
    wasabii committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    b65935b View commit details
    Browse the repository at this point in the history
  3. Reintroduce libikvm, containing only ikvm related things, and no depe…

    …ndencies on OpenJDK related things. dl functions moved here. This is to prevent the bootstrapping issue with being forced to load libjvm itself using DllImport: the path of libjvm has to follow Java library load rules. libikvm follows .NET loading rules.
    wasabii committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    5ead323 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2023

  1. Split IKVM.Image out into IKVM.Image.runtime packages, which include …

    …the native OpenJDK libraries. Unified the logic for building .runtime images into IKVM.Image/IKVM.Image.runtime.targets. We reuse IkvmImageItem processing, but still pack.
    
    This puts the native libraries exclusively in the image. Which will let us eliminate our search path processing for runtimes/native/*. The sun boot path can now be set to the image path, while the user lib path can be set to runtimes/ or the application dir. Need to do that still.
    wasabii committed Sep 1, 2023
    Configuration menu
    Copy the full SHA
    80515b4 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2023

  1. JVM_GetInterfaceVersion needs implementation.

    NativeLibrary once again using NativeLibrary where available. This makes more sense now that we ensure full resolution before invoking.
    NativeLibrary has to bootstrap ikvm.dll on Windows without Mono by calling LoadLibrary directly, since the .NET SDK has the potential for putting the DLL files under runtimes/rid even under Framework. But sometimes it doesn't.
    boot path replaced with Image path.
    user path replaced with .NET paths.
    DestinationSubDirectory still needed for files without extensions.
    We preload jvm.dll through System.loadLibrary, so that it resolves out of JVM system paths. But, then we also load it by hand in JNI to get the JNI trampoline functions.
    Ensure we finalize all the manually loaded native libraries.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    77a1877 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    af505b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8699053 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1c95514 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    592aa38 View commit details
    Browse the repository at this point in the history
  6. Use BFS instead.

    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    889b861 View commit details
    Browse the repository at this point in the history
  7. Allow duplicate items on publish, since depends into image tree has d…

    …uplicates.
    
    Add CopyToOutput on a number of PublishProjectReferences.
    Remove conditional IncludeProjectReferences. Should not be required.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    87b21ed View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b2666d9 View commit details
    Browse the repository at this point in the history
  9. TryLoad instead of Load.

    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    fea708a View commit details
    Browse the repository at this point in the history
  10. Path scan on all OS, in case.

    Allow loader a first chance on PreLoad.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    8a11093 View commit details
    Browse the repository at this point in the history
  11. Variable.

    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    6e8dbd1 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    254b6c1 View commit details
    Browse the repository at this point in the history
  13. missed.

    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    bdbdce8 View commit details
    Browse the repository at this point in the history
  14. Hide some JNI related stuff from FIRST_PASS/IMPORTER/EXPORTER.

    Make Tools tests project tolerate duplicate items.
    Try to load existing libjvm by checking ClassLoader.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    33339aa View commit details
    Browse the repository at this point in the history
  15. Fetch from systemNativeLibraries collection. Do preload outside Ensur…

    …e, which prevents accessing non initialized fields.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    8bac907 View commit details
    Browse the repository at this point in the history
  16. Add an empty libawt for binding.

    MSBuild.Tasks.Tests ignore duplicates.
    wasabii committed Sep 2, 2023
    Configuration menu
    Copy the full SHA
    3d9d0e5 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2023

  1. Configuration menu
    Copy the full SHA
    03b9abd View commit details
    Browse the repository at this point in the history
  2. Change rpath on OS X to just be @loader_path, which I guess is correct.

    Fix native lib name unmapping.
    wasabii committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    80d2e5a View commit details
    Browse the repository at this point in the history
  3. Space.

    wasabii committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    7fa3056 View commit details
    Browse the repository at this point in the history
  4. Preload JVM in JNIVM.

    Call System.loadLibrary in JniTests. Unsure about this one.
    Native.cs no longer needed in tests. Should use default loading logic.
    wasabii committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    bc8bad0 View commit details
    Browse the repository at this point in the history
  5. Moved loading of JNI libraries out to libjvm. Ensure libjvm sets up L…

    …C_PATH to @loader_path, and names itself @rpath/libjvm.dylib.
    
    We preload libjvm using NativeLibrary (or libikvm), against a full path.
    wasabii committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    4c241b3 View commit details
    Browse the repository at this point in the history
  6. Switch from using DllIMport for libjvm. Order? Preloading? Who knows.…

    … Regardless, DllImport couldn't find it, even after a successful preload. Linux behaves same as OSX in that regard. Just use out NativeLibrary to pull out symbols.
    wasabii committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    32c1777 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2023

  1. Add native FileDescriptor stuff. Unify setFd and setHandle. Add suppo…

    …rt for initializating based on file based FD or handle (using libikvm to detect if a handle is a file or socket). Add initIDs back to our local fork. We might be pretty close to discarding this fork and adding fields/properties through map.xml.
    
    Replace RandomAccessFile.open0 with native code. Maybe this will impact OS X locking?
    Ensure libjava (libiava) is loaded before any JNI call. This isn't loaded by any OpenJDK code that I can find. Seems to be built-in/internal. But, we need it to be loaded to bind JNI methods, and we don't wnat to edit OpenJDK Java files.
    isnanf() doesn't exist in MUSL. Manually define to isnan().
    Move LibIkvm to separate file.
    wasabii committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    8408e2c View commit details
    Browse the repository at this point in the history
  2. BootstrapAssemblyClassLoader renamed to RuntimeBootstrapAssemblyClass…

    …Loader. In here we prepopulate nativeLibraries with libjava (libiava). We do that on the boostrap class loader, instead of just in time, to avoid recursion with string comparison stuff that also relies on libjava.
    
    libjava itself needed to be loaded through libjvm (it is a JNI library).
    wasabii committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    91ea85f View commit details
    Browse the repository at this point in the history
  3. RandomAccessFile.open0 needs to take care of VFS lookups. So, here we…

    … implement it using mJNI, intercept VFS calls, and then forward to native open0 implementation using JNIFrame by hand. Works fine.
    
    Add Flush wherever FileDispatcherImpl calls write, since that seems to actually matter.
    wasabii committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    15ddd49 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2023

  1. Configuration menu
    Copy the full SHA
    86e9bb6 View commit details
    Browse the repository at this point in the history
  2. Add a NativeLibraryHandle class, which is a SafeHandle. Holds the han…

    …dle to the loaded library, and handles proper finalization. Ensures finalizers run after everything else.
    
    Might have to do something similar for libJVM's LoadLibrary call.
    wasabii committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    631be5f View commit details
    Browse the repository at this point in the history
  3. Add a unit test to check setLength.

    Throw IOException properly on unauthorized exception.
    wasabii committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    2ae7b17 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ac8ab6d View commit details
    Browse the repository at this point in the history
  5. Return.

    wasabii committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    74c7608 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9f0e7f8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    72e489b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    811aa95 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f050071 View commit details
    Browse the repository at this point in the history
  10. Include IKVM.Image-bin output into dist-image.

    Importer tests should have runtime libs.
    Update Core, which fixes PublishProjectReferences to not ignore nested directories.
    wasabii committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    3cd775b View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2023

  1. Bad

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    b3a9a0c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    face7ae View commit details
    Browse the repository at this point in the history
  3. Add missing nuget packages.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    2df45b4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fd7140d View commit details
    Browse the repository at this point in the history
  5. Broken OSX test.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    8063e3b View commit details
    Browse the repository at this point in the history
  6. Exclude another test.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    a87c7c1 View commit details
    Browse the repository at this point in the history
  7. Move test to langtools.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    6a4f8cc View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3696e13 View commit details
    Browse the repository at this point in the history
  9. Revert position of stream on failure to lock.

    Dispose in proper order in tests.
    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    d4c221a View commit details
    Browse the repository at this point in the history
  10. JNI changes.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    fe0dce6 View commit details
    Browse the repository at this point in the history
  11. Clean up.

    wasabii committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    194ce62 View commit details
    Browse the repository at this point in the history