Add eval
This commit is contained in:
13
src/stack.c
13
src/stack.c
@ -45,13 +45,15 @@ static void reset_local_refs(struct LocalReferences *refs) {
|
||||
for (size_t i = 0; i < num_full_blocks; ++i) {
|
||||
for (size_t j = 0; j < LOCAL_REFERENCES_BLOCK_LENGTH; ++j) {
|
||||
assert(OBJECTP(refs->blocks[i]->refs[j]));
|
||||
--((LispObject *) refs->blocks[i]->refs[j])->gc.local_ref_count;
|
||||
// TODO recurse into object
|
||||
SET_OBJECT_HAS_LOCAL_REFERENCE(refs->blocks[i]->refs[j], false);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < last_block_size; ++i) {
|
||||
assert(OBJECTP(refs->blocks[num_full_blocks]->refs[i]));
|
||||
--((LispObject *) refs->blocks[num_full_blocks]->refs[i])
|
||||
->gc.local_ref_count;
|
||||
// TODO recurse into object
|
||||
SET_OBJECT_HAS_LOCAL_REFERENCE(refs->blocks[num_full_blocks]->refs[i],
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,10 +86,11 @@ static bool store_local_reference_in_frame(struct StackFrame *frame,
|
||||
|
||||
void add_local_reference(LispVal *obj) {
|
||||
assert(the_stack.depth > 0);
|
||||
if (OBJECTP(obj)) {
|
||||
if (OBJECTP(obj) && OBJECT_HAS_LOCAL_REFERENCE_P(obj)) {
|
||||
if (store_local_reference_in_frame(LISP_STACK_TOP(), obj)) {
|
||||
the_stack.first_clear_local_refs = the_stack.depth;
|
||||
}
|
||||
++((LispObject *) obj)->gc.local_ref_count;
|
||||
// TODO recurse into object
|
||||
SET_OBJECT_HAS_LOCAL_REFERENCE(obj, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user