Skip to content

Feature/nio#23

Open
Col-E wants to merge 11 commits into
masterfrom
feature/nio
Open

Feature/nio#23
Col-E wants to merge 11 commits into
masterfrom
feature/nio

Conversation

@Col-E

@Col-E Col-E commented Jul 1, 2023

Copy link
Copy Markdown
Collaborator

No description provided.

@Col-E Col-E added the enhancement New feature or request label Jul 1, 2023
@Col-E

Col-E commented Jul 1, 2023

Copy link
Copy Markdown
Collaborator Author

Current failure VM trace:

jdk/internal/loader/URLClassPath$JarLoader$1.run()Ljava/lang/Void;
jdk/internal/util/jar/JarIndex.getJarIndex(Ljava/util/jar/JarFile;)Ljdk/internal/util/jar/JarIndex;
java/util/jar/JarFile.getJarEntry(Ljava/lang/String;)Ljava/util/jar/JarEntry;
java/util/jar/JarFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry;
java/util/jar/JarFile.isMultiRelease()Z
java/util/jar/JarFile.checkForSpecialAttributes()V
java/util/jar/JarFile.getBytes(Ljava/util/zip/ZipEntry;)[B
java/util/zip/ZipFile.getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;
java/util/zip/ZipFile$ZipFileInflaterInputStream.<init>(Ljava/util/zip/ZipFile;Ljava/util/zip/ZipFile$ZipFileInputStream;Ljava/util/zip/ZipFile$CleanableResource;I)V
java/util/zip/ZipFile$CleanableResource.getInflater()Ljava/util/zip/Inflater;
java/util/zip/Inflater.<init>(Z)V
java/util/zip/Inflater.init(Z)J

The InflaterNatives class only handles initIDs. We either need to implement those, or hook Zip files in a different way on JDK 9+

Col-E added 4 commits July 1, 2023 02:10
…ring

Not yet complete, see note in JarFileNatives about current shortcomings
Ideally we will instead implement the inflater natives, but that's a lot of math I don't want to do right now and this works.
@Col-E

Col-E commented Jul 1, 2023

Copy link
Copy Markdown
Collaborator Author

Went with a different approach for hooking ZipFile handles on JDK 9+

Then I hit a wall with Inflater natives still in some jar file handling... so to work around that I made a getInputStream invoker. Its not the greatest solution, but it lets me focus on the actual NIO integration, as now the VM stacktrace is finally hitting something relevant:

dev/xdark/ssvm/dummy/FileToString.readReadmePath()Ljava/lang/String;
dev/xdark/ssvm/dummy/FileToString.read(Ljava/nio/file/Path;)Ljava/lang/String;
java/nio/file/Files.readAllBytes(Ljava/nio/file/Path;)[B
java/nio/file/Files.newByteChannel(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/nio/channels/SeekableByteChannel;
java/nio/file/Files.newByteChannel(Ljava/nio/file/Path;Ljava/util/Set;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/channels/SeekableByteChannel;
sun/nio/fs/WindowsFileSystemProvider.newByteChannel(Ljava/nio/file/Path;Ljava/util/Set;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/channels/SeekableByteChannel;
sun/nio/fs/WindowsChannelFactory.newFileChannel(Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;J)Ljava/nio/channels/FileChannel;
sun/nio/fs/WindowsChannelFactory.open(Ljava/lang/String;Ljava/lang/String;Lsun/nio/fs/WindowsChannelFactory$Flags;J)Ljava/io/FileDescriptor;
sun/nio/fs/WindowsNativeDispatcher.CreateFile(Ljava/lang/String;IIJII)J
sun/nio/fs/WindowsNativeDispatcher.CreateFile0(JIIJII)J <--- Not yet implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant