Skip to content

Commit

Permalink
Add another version of load method
Browse files Browse the repository at this point in the history
  • Loading branch information
xxDark committed Jul 26, 2022
1 parent dbb8ddc commit 9c9ed25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'dev.xdark'
version '1.9.0.2'
version '1.9.0.3'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ public void init(VirtualMachine vm) {
InstanceJavaClass librariesClass = (InstanceJavaClass) vm.findBootstrapClass("jdk/internal/loader/NativeLibraries");
findEntryClass = librariesClass;
findBuiltinLibClass = librariesClass;
vmi.setInvoker(librariesClass, "load", "(Ljdk/internal/loader/NativeLibraries$NativeLibraryImpl;Ljava/lang/String;Z)Z", ctx -> {
MethodInvoker doLoad = ctx -> {
ctx.setResult(load.test(ctx) ? IntValue.ONE : IntValue.ZERO);
return Result.ABORT;
});
};
if (!vmi.setInvoker(librariesClass, "load", "(Ljdk/internal/loader/NativeLibraries$NativeLibraryImpl;Ljava/lang/String;Z)Z", doLoad)) {
if (!vmi.setInvoker(librariesClass, "load", "(Ljdk/internal/loader/NativeLibraries$NativeLibraryImpl;Ljava/lang/String;ZZ)Z", doLoad)) {
throw new IllegalArgumentException("Unable to locate NativeLibraries#load method");
}
}
vmi.setInvoker(librariesClass, "unload", "(Ljava/lang/String;ZJ)V", ctx -> {
VMHelper helper = ctx.getHelper();
Locals locals = ctx.getLocals();
Expand Down

0 comments on commit 9c9ed25

Please sign in to comment.