Skip to content

Commit

Permalink
Another variant of UnixNativeDispatcher.init
Browse files Browse the repository at this point in the history
  • Loading branch information
xxDark committed Jun 5, 2022
1 parent 9b9ec9d commit eaaaa77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import dev.xdark.ssvm.mirror.InstanceJavaClass;
import dev.xdark.ssvm.util.VMHelper;
import dev.xdark.ssvm.value.ArrayValue;
import dev.xdark.ssvm.value.IntValue;
import lombok.experimental.UtilityClass;

import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -35,6 +36,10 @@ public void init(VirtualMachine vm) {
return Result.ABORT;
});
vmi.setInvoker(unixDispatcher, "init", "()V", MethodInvoker.noop());
vmi.setInvoker(unixDispatcher, "init", "()I", ctx -> {
ctx.setResult(IntValue.ZERO);
return Result.ABORT;
});
InstanceJavaClass linuxDispatcher = (InstanceJavaClass) vm.findBootstrapClass("sun/nio/fs/LinuxNativeDispatcher");
if (linuxDispatcher != null) {
vmi.setInvoker(linuxDispatcher, "init", "()V", MethodInvoker.noop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ final class VolatileArrayAccess implements VolatileBufferAccess {

VolatileArrayAccess(ByteBuffer buffer) {
array = buffer.array();
offset = UnsafeUtil.ARRAY_BYTE_BASE_OFFSET + + buffer.position() + buffer.arrayOffset();
offset = UnsafeUtil.ARRAY_BYTE_BASE_OFFSET + buffer.position() + buffer.arrayOffset();
}

@Override
Expand Down

0 comments on commit eaaaa77

Please sign in to comment.