mirror of
https://github.com/corda/corda.git
synced 2025-06-24 02:04:12 +00:00
add test for sun.misc.Unsafe functionality
This commit is contained in:
@ -10,8 +10,16 @@
|
||||
|
||||
package avian;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
public abstract class Machine {
|
||||
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
|
||||
public static native void dumpHeap(String outputFile);
|
||||
|
||||
public static Unsafe getUnsafe() {
|
||||
return unsafe;
|
||||
}
|
||||
|
||||
}
|
||||
|
49
classpath/sun/misc/Unsafe.java
Normal file
49
classpath/sun/misc/Unsafe.java
Normal file
@ -0,0 +1,49 @@
|
||||
package sun.misc;
|
||||
|
||||
public final class Unsafe {
|
||||
private void Unsafe() { }
|
||||
|
||||
private static final Unsafe Instance = new Unsafe();
|
||||
|
||||
public static Unsafe getUnsafe() {
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public native long allocateMemory(long bytes);
|
||||
|
||||
public native void setMemory(long address, long count, byte value);
|
||||
|
||||
public native void freeMemory(long address);
|
||||
|
||||
public native byte getByte(long address);
|
||||
|
||||
public native void putByte(long address, byte x);
|
||||
|
||||
public native short getShort(long address);
|
||||
|
||||
public native void putShort(long address, short x);
|
||||
|
||||
public native char getChar(long address);
|
||||
|
||||
public native void putChar(long address, char x);
|
||||
|
||||
public native int getInt(long address);
|
||||
|
||||
public native void putInt(long address, int x);
|
||||
|
||||
public native long getLong(long address);
|
||||
|
||||
public native void putLong(long address, long x);
|
||||
|
||||
public native float getFloat(long address);
|
||||
|
||||
public native void putFloat(long address, float x);
|
||||
|
||||
public native double getDouble(long address);
|
||||
|
||||
public native void putDouble(long address, double x);
|
||||
|
||||
public native long getAddress(long address);
|
||||
|
||||
public native void putAddress(long address, long x);
|
||||
}
|
Reference in New Issue
Block a user