Skip to content

JNI methods update#118

Merged
mkitti merged 20 commits intomasterfrom
adambrewster-jni-methods
May 5, 2020
Merged

JNI methods update#118
mkitti merged 20 commits intomasterfrom
adambrewster-jni-methods

Conversation

@mkitti
Copy link
Member

@mkitti mkitti commented May 3, 2020

I updated #29 and untangled the modules.

There is now an independent JNI submodule within JavaCall that does not depend on JavaCall or any other module. JavaCall does depend on the JNI submodule.

Most of the ccall references can now be made by calling a generate Julia method in the JNI module. This also exposes more JNI function calls which will help future development.

The generator script has been updated, modified and documented

@mkitti mkitti requested a review from aviks May 3, 2020 04:48
Copy link
Collaborator

@aviks aviks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for taking this on!

ppjvm = Array{Ptr{JavaVM}}(undef, 1)
ppenv = Array{Ptr{JNIEnv}}(undef, 1)
vm_args = JavaVMInitArgs(JNI_VERSION_1_6, convert(Cint, length(opts)),
vm_args = JavaVMInitArgs(JNI.JNI_VERSION_1_8, convert(Cint, length(opts)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our minimum JVM version with this? Should probably document it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would go along with Java 8, although as far as I can tell there really is not a difference between 1_6 and 1_8 in terms of the JNI, so maybe we should revert this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is documented here: https://docs.oracle.com/javase/9/docs/specs/jni/functions.html

As you previously noted, this correspondence is missing here in the Java 8 notes:
https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#GetVersion


include("jnienv.jl")

global jnifunc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should make these globals Refs now? JavaCall started when that feature did not exist in Julia, but maybe its worth doing now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with b50fc15

src/JNI.jl Outdated

# === Below Generated by make_jni2.jl ===

#export GetVersion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe get rid of the commented exports in the generated code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with c041f1d

@mkitti
Copy link
Member Author

mkitti commented May 4, 2020

I am tempted to move some of the initialization code and related structs into the JNI module. We could also move some of the globals there as well and turn them in Ref. This could be done after this is merged in.

@mkitti mkitti merged commit 66538df into master May 5, 2020
@mkitti mkitti deleted the adambrewster-jni-methods branch March 21, 2022 06:45
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.

2 participants