util: Automatically load the java .so in the gem5 ops wrapper.

The java wrapper which provides access to the gem5 ops is implemented
using JNI in a .so file which needs to be loaded before the class can be
used. Rather than expecting the caller to do that, we can use a static
block in the class definition. We know that will be called at the right
time, and it's one less detail (arguably an implementation detail) that
the caller won't have to worry about.

Change-Id: I2b4b18ebb12030ea6f4e6463c6cd512afed74cfd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28177
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-10-22 20:00:57 -07:00
parent 666b7904e6
commit aaf7678670
2 changed files with 6 additions and 7 deletions

View File

@@ -42,6 +42,10 @@ package gem5;
*/
public class Ops {
static {
System.loadLibrary("gem5Ops");
}
public native void arm(long address);
public native void quiesce();
public native void quiesce_ns(long ns);