Lexical jumps

This commit is contained in:
2026-09-05 00:58:11 -07:00
parent 8024bcfee3
commit 956297335d
13 changed files with 164 additions and 49 deletions
+13
View File
@@ -3,6 +3,7 @@
#include "base.h"
#include <setjmp.h>
#include <stdnoreturn.h>
enum StackFrameKind {
@@ -11,6 +12,7 @@ enum StackFrameKind {
STACK_FRAME_UNWIND_PROTECT,
STACK_FRAME_HANDLER_BIND,
STACK_FRAME_DYNAMIC_BINDING,
STACK_FRAME_BLOCK,
};
#define LISP_STACK_MAX_DEPTH 4096
@@ -58,6 +60,12 @@ struct _StackFrame {
LispVal *symbol;
LispVal *old_value;
} dynamic_binding;
struct {
LispVal *tag;
jmp_buf *target;
LispVal *volatile *value_ptr;
StackFrame *unwind_to;
} block;
};
};
@@ -139,11 +147,16 @@ static ALWAYS_INLINE LispVal *UNWIND_AND_RETURN(StackFrame *frame,
noreturn void lisp_signal(LispVal *name, LispVal *data);
DECLARE_FUNCTION(block, (LispVal * name, LispVal *body));
DECLARE_FUNCTION(return_from, (LispVal * name, LispVal *value));
/**
* Backtraces have the form (name fobj evaled? args)
*/
DECLARE_FUNCTION(backtrace, (void) );
DECLARE_SYMBOL(no_such_block_error);
MAKE_CONDITION_CLASS(no_such_block_error);
DECLARE_SYMBOL(excessive_lisp_nesting_error);
MAKE_CONDITION_CLASS(excessive_lisp_nesting_error);