http://mail.openjdk.java.net/pipermail/panama-dev/2015-December/000225.html
A user has to provide (1) machine code snippet; and (2) method type:
MethodHandle jdk.internal.panama.CodeSnippet.make(
String name,
MethodType type,
boolean isSupported,
int... code)
Пример
256-bit memory-to-memory move with double-register addressing mode:
MethodHandle mov256MH = CodeSnippet.make("move256",
MethodType.methodType(void.class, // return type
Object.class /*rdi*/, // src
long.class /*rsi*/, // offset
Object.class /*rdx*/, // dst
long.class /*rcx*/), // offset
CPUID.has(AVX),
0xC4, 0xE1, 0x7E, 0x6F, 0x04, 0x37, // vmovdqu ymm0,[rsi+rdi]
0xC4, 0xE1, 0x7E, 0x7F, 0x04, 0x0A); // vmovdqu [rdx+rcx],ymm0
static void move256(Object src, long off1, Object dst, long off2) {
try {
mov256MH.invokeExact(src, off1, dst, off2);
} catch (Throwable e) {
throw new Error(e);
}
}
byte[] src = ...; long off1 = ...;
byte[] dst = ...; long off2 = ...;
move256(src, off1, dst, off2);