Merge commit '1103b2dc782c5fc787a51ac53ae81f11fa50cc58'

This commit is contained in:
Benjamin Vedder 2023-12-22 16:40:38 +01:00
commit c45087eef2
3 changed files with 29 additions and 10 deletions

View File

@ -609,7 +609,7 @@ int main(int argc, char **argv) {
pthread_t lispbm_thd;
lbm_heap_state_t heap_state;
unsigned int heap_size = 2048;
unsigned int heap_size = 8192;//2048;
lbm_cons_t *heap_storage = NULL;
lbm_const_heap_t const_heap;

View File

@ -116,7 +116,6 @@ lbm_value lbm_env_set(lbm_value env, lbm_value key, lbm_value val) {
}
new_env = lbm_cons(keyval, env);
return new_env;
}

View File

@ -2527,8 +2527,11 @@ static void apply_merge(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
if (len == 2) {
par1 = get_car(cl[CLO_PARAMS]);
par2 = get_car(get_cdr(cl[CLO_PARAMS]));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par1, lbm_car(a_1)));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par2, lbm_car(b_1)));
lbm_value new_env0;
lbm_value new_env;
WITH_GC(new_env0, lbm_env_set(cmp_env, par1, lbm_car(a_1)));
WITH_GC_RMBR_1(new_env, lbm_env_set(new_env0, par2, lbm_car(b_1)),new_env0);
cmp_env = new_env;
} else {
error_at_ctx(ENC_SYM_TERROR, args[0]);
}
@ -2587,8 +2590,11 @@ static void apply_sort(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
if (cl_len == 2) {
par1 = get_car(cl[CLO_PARAMS]);
par2 = get_car(get_cdr(cl[CLO_PARAMS]));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par2, lbm_car(b)));
lbm_value new_env0;
lbm_value new_env;
WITH_GC(new_env0, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC_RMBR_1(new_env, lbm_env_set(new_env0, par2, lbm_car(b)), new_env0);
cmp_env = new_env;
} else {
error_at_ctx(ENC_SYM_TERROR, args[0]);
}
@ -3077,8 +3083,15 @@ static void cont_merge_rest(eval_context_t *ctx) {
lbm_value par2 = sptr[8];
lbm_value cmp_body = sptr[5];
lbm_value cmp_env = sptr[6];
WITH_GC(cmp_env, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par2, lbm_car(b)));
// Environment should be preallocated already at this point
// and the operations below should never need GC.
// maybe rewrite this as a more efficient update and
// a fatal error if that is not possible.
lbm_value new_env0;
lbm_value new_env;
WITH_GC(new_env0, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC_RMBR_1(new_env, lbm_env_set(new_env0, par2, lbm_car(b)), new_env0);
cmp_env = new_env;
stack_push(&ctx->K, MERGE_REST);
ctx->curr_exp = cmp_body;
@ -3182,8 +3195,15 @@ static void cont_merge_layer(eval_context_t *ctx) {
lbm_value cmp_env = sptr[1];
lbm_value par1 = sptr[2];
lbm_value par2 = sptr[3];
WITH_GC(cmp_env, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC(cmp_env, lbm_env_set(cmp_env, par2, lbm_car(b)));
// Environment should be preallocated already at this point
// and the operations below should never need GC.
// maybe rewrite this as a more efficient update and
// a fatal error if that is not possible.
lbm_value new_env0;
lbm_value new_env;
WITH_GC(new_env0, lbm_env_set(cmp_env, par1, lbm_car(a)));
WITH_GC_RMBR_1(new_env, lbm_env_set(new_env0, par2, lbm_car(b)), new_env0);
cmp_env = new_env;
lbm_uint *merge_cont = stack_reserve(ctx, 11);
merge_cont[0] = MERGE_LAYER;