1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-28 06:07:43 +00:00

Add quick asm for adding apply and error to the stl.

This commit is contained in:
bakpakin
2018-01-21 16:41:15 -05:00
parent 911b0b15e8
commit 42a88de9e7
5 changed files with 37 additions and 25 deletions

View File

@@ -243,3 +243,17 @@ DstFunction *dst_function(DstFuncDef *def, DstFunction *parent) {
}
return func;
}
/* Utility for inline assembly */
DstFunction *dst_quick_asm(int32_t arity, int varargs, int32_t slots, const uint32_t *bytecode, size_t bytecode_size) {
DstFuncDef *def = dst_funcdef_alloc();
def->arity = arity;
def->flags = varargs ? DST_FUNCDEF_FLAG_VARARG : 0;
def->slotcount = slots;
def->bytecode = malloc(bytecode_size);
if (!def->bytecode) {
DST_OUT_OF_MEMORY;
}
memcpy(def->bytecode, bytecode, bytecode_size);
return dst_function(def, NULL);
}