[jnienv-gen] Add possible C#9 function pointer backend #938
+3,507
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: 926e4bc
Context: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/function-pointers
Context? #666
Commit 926e4bc allowed
jnienv-gen
to emit multiple differentJNIEnv invocation strategies at the same time, allowing
tests/invocation-overhead
to try them "all at once" for side-by-side comparisons.
Add support for a new JNIEnv invocation strategy which relies on
C#9 Function Pointers, a'la:
This could allow for performance better than "JIPinvokeTiming",
as it avoids P/Invoke overheads to a set of
java_interop_*
Cfunctions (926e4bc), while also avoiding the overheads involved
with using
Marshal.GetDelegateForFunctionPointer()
as used by"JIIntPtrs".
…but it doesn't necessarily provide better performance:
(Compare and contrast with 926e4bc, circa 2015!)
Of particular note is that the Average Invocation time for
JIFunctionPointersTiming takes 7% longer than JIPinvokeTiming.
Though that's slightly reversed when a Release build of
invocation-overhead.dll
is used:With a Release build, the Average Invocation time for
JIFunctionPointersTiming takes 97% of the time as JIPinvokeTiming,
i.e. is 3% faster.
We may or may not continue investigation of C#9 Function Pointers
for
JNIEnv
binding purposes. We will preserve this code forfuture investigation.