-
Notifications
You must be signed in to change notification settings - Fork 1k
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
remove WindowsDirectory #11772
Comments
I've no idea who uses this thing but I'm open to removing this - it does complicate things a bit. |
+1 |
I kinda feel that going forwards, we would not do things this way with C code, but instead look to use the new FFI interfaces being added to openjdk if we really need to call native stuff... |
If there are no objections, I'll handle the removal - there are some gradle scripts involved there that will also benefit from the cleanup. |
Project Panama is the way to go, no need for FFI or anything like that. You can create a MethodHandle that downcalls into libc/kernel.dll. I have an example in some talk. |
This is how to call var cLinker = Linker.nativeLinker();
// Using a MethodHandle
MethodHandle getpidMH = cLinker.downcallHandle(cLinker.defaultLookup().lookup("getpid").get(),
FunctionDescriptor.of(JAVA_INT));
int pid = (int) getpidMH.invokeExact();
System.out.printf("MethodHandle calling getpid() (%d)\n", pid); |
yeah, sorry when i said FFI i meant panama (its an FFI to me). |
That's pretty neat. |
We should apply this to main, but I think there's no harm to backport to 9.x, right? It's not a stable API and there is a safe replacement. |
+1 |
Let's remove it. Actually the whole code is not tested at all. The removed Testcase extends LuceneTestCase and not BaseDirectoryTestcase. The only thing it does is to instantiate a Directory and an IndexOutput (!!) that is not even triggering custom code, because the native code is an IndexInput. |
Applied on 9x and main. |
Description
Having native code complicates the gradle build and causes bugs.
The Direct-IO directory no longer needs native code, it uses JDK APIs. So the only thing left is WindowsDirectory.
I'm not sure this thing is really faster than the JDK. If i remember, the synchronization that causes the issues was in windows. Honestly, users should use MmapDirectory on windows IMO.
So maybe net/net it is better for our windows support to remove this thing?
The text was updated successfully, but these errors were encountered: