Sorry, no, but you can see examples in src/builtin.cpp,
src/classpath-openjdk.cpp, etc.. Every function starting with
"Avian_" uses the "fast" calling convention. For example:
extern "C" AVIAN_EXPORT void JNICALL
Avian_sun_misc_Unsafe_putByteVolatile(Thread*, object, uintptr_t* arguments)
{
object o = reinterpret_cast<object>(arguments[1]);
int64_t offset;
memcpy(&offset, arguments + 2, 8);
int8_t value = arguments[4];
storeStoreMemoryBarrier();
fieldAtOffset<int8_t>(o, offset) = value;
storeLoadMemoryBarrier();
}
Every function using this convention takes three arguments (Thread*
thread, object method, uintptr_t* javaArguments) and returns either
void or int64_t. The `Thread* thread` parameter is basically a
JNIEnv* pointer, but one that also exposes the VM internals. The
`object method` parameter is a avian.VMMethod reference corresponding
to the native method being invoked. The `uintptr_t* javaArguments`
parameter is an array of primitives and/or references which are the
arguments passed from Java code.
In the example above, the Java method signature is
sun.misc.Unsafe.putByteVolatile(Object target, long offset, byte
value). Note that long values always occupy two elements of the
arguments array, even on 64-bit platforms.
Note that functions using this convention are assumed not to block for
significant amounts of time since that will prevent garbage collection
and eventually halt all threads. Also, these functions cannot call
back into the VM without using the PROTECT macro with all object
references to tell the VM about GC roots on the stack. If you forget
to do this, your program will crash unpredictably.