Use Espresso instead of the Java Virtual Machine. How to parse native methods? #8283
-
When using the above code, theJava Virtual Machine will parse it in C code. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
For this specific one, there is an espresso-specific "substitution". In general though, for native methods, espresso supports JNI and will load and link to native libraries like any other jvm implementation. Espresso can use Truffle NFI or Sulong for loading the native libraries. When using NFI, it'll call the native code in the usual way. If you have a version of the library with bitcode, it can be executed by Sulong. You can check out the NativeAccess interface an its implementations. |
Beta Was this translation helpful? Give feedback.
For this specific one, there is an espresso-specific "substitution".
You can see it in Target_java_lang_System.java. When a substituted method is called, espresso will run the code of the substitution in the host jvm.
In general though, for native methods, espresso supports JNI and will load and link to native libraries like any other jvm implementation. Espresso can use Truffle NFI or Sulong for loading the native libraries. When using NFI, it'll call the native code in the usual way. If you have a version of the library with bitcode, it can be executed by Sulong.
You can check out the NativeAccess interface an its implementations.