From 337698b408d7bb49cb2a8bbd4282846a29f728c2 Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Thu, 13 Sep 2018 16:56:44 +0100 Subject: [PATCH] Added ARM support for UnsafeMemory, https://github.com/OpenHFT/OpenHFT/issues/23 --- .../map/impl/stage/data/ZeroBytesStore.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) mode change 100644 => 100755 src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java old mode 100644 new mode 100755 index 66e48eeb9..e3c2e4d51 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java @@ -23,7 +23,6 @@ import net.openhft.chronicle.core.OS; import org.jetbrains.annotations.Nullable; import java.nio.BufferOverflowException; -import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; public enum ZeroBytesStore implements BytesStore { @@ -40,22 +39,22 @@ public enum ZeroBytesStore implements BytesStore { } @Override - public byte readVolatileByte(long offset) throws BufferUnderflowException { + public byte readVolatileByte(long offset) { return 0; } @Override - public short readVolatileShort(long offset) throws BufferUnderflowException { + public short readVolatileShort(long offset) { return 0; } @Override - public int readVolatileInt(long offset) throws BufferUnderflowException { + public int readVolatileInt(long offset) { return 0; } @Override - public long readVolatileLong(long offset) throws BufferUnderflowException { + public long readVolatileLong(long offset) { return 0; } @@ -128,20 +127,29 @@ public enum ZeroBytesStore implements BytesStore { } @Override - public long addressForRead(long offset) throws UnsupportedOperationException { + public long addressForRead(long offset) { return offset; } @Override - public boolean compareAndSwapInt(long offset, int expected, int value) - throws BufferOverflowException, IllegalArgumentException { - throw new UnsupportedOperationException(); + public boolean compareAndSwapInt(long offset, int expected, int value) { + if (expected != 0 || value != 0) + throw new UnsupportedOperationException(); + return true; } @Override - public boolean compareAndSwapLong(long offset, long expected, long value) - throws BufferOverflowException, IllegalArgumentException { - throw new UnsupportedOperationException(); + public void testAndSetInt(long offset, int expected, int value) { + if (expected != 0 || value != 0) + throw new UnsupportedOperationException(); + } + + + @Override + public boolean compareAndSwapLong(long offset, long expected, long value) { + if (expected != 0 || value != 0) + throw new UnsupportedOperationException(); + return true; } @Override