Update function call stuff
This commit is contained in:
+27
-7
@@ -81,10 +81,23 @@ struct LispStack {
|
||||
size_t depth;
|
||||
StackFrame *frames;
|
||||
|
||||
LispVal *nogc_retval;
|
||||
struct UnwindInformation unwind_info;
|
||||
};
|
||||
|
||||
// ONLY APPLIES TO THE CALLING THREAD
|
||||
static ALWAYS_INLINE StackFrame *OBJECT_LOWEST_LOCAL_REFERENCE(LispVal *val) {
|
||||
assert(OBJECTP(val));
|
||||
LispObject *obj = val;
|
||||
return tss_get(obj->gc.lowest_local_ref);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void SET_OBJECT_LOWEST_LOCAL_REFERENCE(LispVal *val,
|
||||
StackFrame *frame) {
|
||||
assert(OBJECTP(val));
|
||||
LispObject *obj = val;
|
||||
tss_set(obj->gc.lowest_local_ref, frame);
|
||||
}
|
||||
|
||||
extern struct LispStack the_stack;
|
||||
|
||||
void lisp_init_stack(void);
|
||||
@@ -96,14 +109,13 @@ static ALWAYS_INLINE StackFrame *LISP_STACK_REF(void) {
|
||||
}
|
||||
return &the_stack.frames[the_stack.depth - 1];
|
||||
}
|
||||
void unwind_to(StackFrame *frame);
|
||||
noreturn void continue_unwinding(void);
|
||||
|
||||
// functions
|
||||
void push_call_frame(LispVal *name, LispVal *fobj, LispVal *args);
|
||||
void push_call_frame(LispVal *name, LispVal *args);
|
||||
// replace the args in the top stack frame with ARGS and mark them as evaluated
|
||||
// (this is for backtraces)
|
||||
void set_stack_evaluated_args(StackFrame *restrict ref, LispVal *args);
|
||||
void set_stack_evaluated_args(StackFrame *restrict ref, LispVal *fobj,
|
||||
LispVal *args);
|
||||
|
||||
// unwind protect
|
||||
void push_unwind_protect_frame(jmp_buf *buf);
|
||||
@@ -131,8 +143,16 @@ static ALWAYS_INLINE void push_copy_lexenv(void) {
|
||||
void set_lexical_variable(LispVal *name, LispVal *value);
|
||||
// Just add a new lexical variable without any checking
|
||||
static inline void new_lexical_variable(LispVal *name, LispVal *value) {
|
||||
LispSymbol *lexenv = (LispSymbol *) Qlexical_environment;
|
||||
lexenv->value = CONS(name, CONS(value, lexenv->value));
|
||||
Vlexical_environment = CONS(name, CONS(value, Vlexical_environment));
|
||||
}
|
||||
|
||||
void unwind_to(StackFrame *frame);
|
||||
static ALWAYS_INLINE LispVal *UNWIND_AND_RETURN(StackFrame *frame,
|
||||
LispVal *val) {
|
||||
add_local_reference(frame, val);
|
||||
unwind_to(frame);
|
||||
return val;
|
||||
}
|
||||
noreturn void continue_unwinding(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user