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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user