threading: fix race conditions when interrupted while pushing in the stack

We have to make sure that the stack pointers always point to a
    valid object. This means that we have to increase env->stack_top
    before we change things in the stack.
This commit is contained in:
Marius Gerbershagen 2018-02-04 21:53:45 +01:00
parent 276f4c79ff
commit 3ec7c3b749
2 changed files with 3 additions and 3 deletions

View file

@ -124,8 +124,8 @@ ecl_stack_frame_push(cl_object f, cl_object o)
if (top >= env->stack_limit) {
top = ecl_stack_grow(env);
}
*top = o;
env->stack_top = ++top;
*(top-1) = o;
f->frame.base = top - (++(f->frame.size));
f->frame.stack = env->stack;
}

View file

@ -334,8 +334,8 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(register cl_env_ptr, register cl_obje
if (ecl_unlikely(__new_top >= __env->stack_limit)) { \
__new_top = ecl_stack_grow(__env); \
} \
*__new_top = (o); \
__env->stack_top = __new_top+1; } while (0)
__env->stack_top = __new_top+1; \
*__new_top = (o); } while (0)
#define ECL_STACK_POP_UNSAFE(env) *(--((env)->stack_top))