mirror of
https://github.com/janet-lang/janet
synced 2025-07-07 20:42:54 +00:00
Add some debug information to more builtin functions.
This commit is contained in:
parent
2a87dada47
commit
f0f5af24c2
@ -1016,8 +1016,9 @@ onvalue."
|
|||||||
} :in st]
|
} :in st]
|
||||||
(file.write stdout " in")
|
(file.write stdout " in")
|
||||||
(when c (file.write stdout " cfunction"))
|
(when c (file.write stdout " cfunction"))
|
||||||
(when name (file.write stdout (string " " name)))
|
(if name
|
||||||
(when func (file.write stdout (string " " func)))
|
(file.write stdout (string " " name))
|
||||||
|
(when func (file.write stdout (string " " func))))
|
||||||
(when pc (file.write stdout (string " (pc=" pc ")")))
|
(when pc (file.write stdout (string " (pc=" pc ")")))
|
||||||
(when tail (file.write stdout " (tailcall)"))
|
(when tail (file.write stdout " (tailcall)"))
|
||||||
(file.write stdout "\n"))))
|
(file.write stdout "\n"))))
|
||||||
|
@ -983,6 +983,7 @@ DstCompileResult dst_compile(Dst source, DstTable *env, int flags) {
|
|||||||
|
|
||||||
if (c.result.status == DST_COMPILE_OK) {
|
if (c.result.status == DST_COMPILE_OK) {
|
||||||
DstFuncDef *def = dstc_pop_funcdef(&c);
|
DstFuncDef *def = dstc_pop_funcdef(&c);
|
||||||
|
def->name = dst_cstring("[thunk]");
|
||||||
c.result.funcdef = def;
|
c.result.funcdef = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ static const DstReg cfuns[] = {
|
|||||||
|
|
||||||
/* Utility for inline assembly */
|
/* Utility for inline assembly */
|
||||||
static DstFunction *dst_quick_asm(
|
static DstFunction *dst_quick_asm(
|
||||||
|
const char *name,
|
||||||
int32_t arity,
|
int32_t arity,
|
||||||
int varargs,
|
int varargs,
|
||||||
int32_t slots,
|
int32_t slots,
|
||||||
@ -71,6 +72,7 @@ static DstFunction *dst_quick_asm(
|
|||||||
def->slotcount = slots;
|
def->slotcount = slots;
|
||||||
def->bytecode = malloc(bytecode_size);
|
def->bytecode = malloc(bytecode_size);
|
||||||
def->bytecode_length = bytecode_size / sizeof(uint32_t);
|
def->bytecode_length = bytecode_size / sizeof(uint32_t);
|
||||||
|
def->name = dst_cstring(name);
|
||||||
if (!def->bytecode) {
|
if (!def->bytecode) {
|
||||||
DST_OUT_OF_MEMORY;
|
DST_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -105,11 +107,11 @@ DstTable *dst_stl_env(int flags) {
|
|||||||
/* Load main functions */
|
/* Load main functions */
|
||||||
dst_env_cfuns(env, cfuns);
|
dst_env_cfuns(env, cfuns);
|
||||||
|
|
||||||
dst_env_def(env, "debug", dst_wrap_function(dst_quick_asm(0, 0, 1, debug_asm, sizeof(debug_asm))));
|
dst_env_def(env, "debug", dst_wrap_function(dst_quick_asm("debug", 0, 0, 1, debug_asm, sizeof(debug_asm))));
|
||||||
dst_env_def(env, "error", dst_wrap_function(dst_quick_asm(1, 0, 1, error_asm, sizeof(error_asm))));
|
dst_env_def(env, "error", dst_wrap_function(dst_quick_asm("error", 1, 0, 1, error_asm, sizeof(error_asm))));
|
||||||
dst_env_def(env, "apply1", dst_wrap_function(dst_quick_asm(2, 0, 2, apply_asm, sizeof(apply_asm))));
|
dst_env_def(env, "apply1", dst_wrap_function(dst_quick_asm("apply1", 2, 0, 2, apply_asm, sizeof(apply_asm))));
|
||||||
dst_env_def(env, "yield", dst_wrap_function(dst_quick_asm(1, 0, 2, yield_asm, sizeof(yield_asm))));
|
dst_env_def(env, "yield", dst_wrap_function(dst_quick_asm("yield", 1, 0, 2, yield_asm, sizeof(yield_asm))));
|
||||||
dst_env_def(env, "resume", dst_wrap_function(dst_quick_asm(2, 0, 2, resume_asm, sizeof(resume_asm))));
|
dst_env_def(env, "resume", dst_wrap_function(dst_quick_asm("resume", 2, 0, 2, resume_asm, sizeof(resume_asm))));
|
||||||
|
|
||||||
dst_env_def(env, "VERSION", dst_cstringv(DST_VERSION));
|
dst_env_def(env, "VERSION", dst_cstringv(DST_VERSION));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user