Of course, the best solution is if you can avoid Unsafe completely ( - but there are lots of competing ideals, and we're unlikely to optimize them all.

> (you are the boss, after all)

Technically, I'm just filling in for a while... :)

> Could you tell me more about using it?

Sure.  Avian supports two types of external functions: Java_ methods (jni) and Avian_ methods (avian-specific, referred to as the "fast" path in the code).  Java_ methods should be compatible with every other jvm implementation (if they're not, it's a bug).  They take arguments as normal C arguments.  Avian_ methods take arguments in a single uintptr_t* array - which allows us to bypass a lot of platform-specific native code.  The first argument will be at index 0 in that array, and so on.

The key with Avian_ methods in this context is that there's the unwritten assumption that, since they're already using avian-specific code, they might as well dig further into the internals.  That gives us license to use byteArrayBody, an avian-specific utility method for retrieving a reference to an element in a Java-level byte array.  Thus, we can ask for the zeroth element and take the address to yield a pointer directly to the buffer.