forked from Mirror/wren
I've got some ideas on how to tweak the embedding API, but I want to see what performance impact they have first, so this adds a little benchmark that just calls a foreign method a ton of times.
25 lines
464 B
C
25 lines
464 B
C
#include <string.h>
|
|
|
|
#include "value.h"
|
|
|
|
static WrenValue* value;
|
|
|
|
static void setValue(WrenVM* vm)
|
|
{
|
|
value = wrenGetArgumentValue(vm, 1);
|
|
}
|
|
|
|
static void getValue(WrenVM* vm)
|
|
{
|
|
wrenReturnValue(vm, value);
|
|
wrenReleaseValue(vm, value);
|
|
}
|
|
|
|
WrenForeignMethodFn valueBindMethod(const char* signature)
|
|
{
|
|
if (strcmp(signature, "static Value.value=(_)") == 0) return setValue;
|
|
if (strcmp(signature, "static Value.value") == 0) return getValue;
|
|
|
|
return NULL;
|
|
}
|