Skip to content

Commit

Permalink
[unsafe] remove even more unused Unsafe methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wkgcass committed Aug 18, 2023
1 parent eed5aa4 commit 0a763b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions base/src/main/java/io/vproxy/base/util/unsafe/SunUnsafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@ public static MemorySegment allocateMemory(long size) {
public static void freeMemory(long address) {
U.freeMemory(address);
}

public static void copyMemory(long dst, long src, int len) {
U.copyMemory(src, dst, len);
}
}
7 changes: 2 additions & 5 deletions test/src/test/java/io/vproxy/poc/XDPPoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.vproxy.base.util.Consts;
import io.vproxy.base.util.LogType;
import io.vproxy.base.util.Logger;
import io.vproxy.base.util.unsafe.SunUnsafe;
import io.vproxy.vfd.EventSet;
import io.vproxy.vpacket.*;
import io.vproxy.xdp.*;
Expand Down Expand Up @@ -102,10 +101,8 @@ private void handleReadable() {

Logger.alert("new chunk: " + chunk2);

SunUnsafe.copyMemory(
umem.getBufferAddress() + chunk2.pktaddr,
umem.getBufferAddress() + chunk.pktaddr,
chunk.pktlen);
umemSeg.asSlice(chunk2.pktaddr, chunk.pktlen)
.copyFrom(umemSeg.asSlice(chunk.pktaddr, chunk.pktlen));
xsk.writePacket(chunk2);
}

Expand Down

0 comments on commit 0a763b2

Please sign in to comment.