Skip to content

Commit

Permalink
Avoid an indirection by using exception_ptr for the stack cache linke…
Browse files Browse the repository at this point in the history
…d list
  • Loading branch information
ctk21 committed Nov 19, 2020
1 parent 2fc9f73 commit ad332fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/fiber.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static struct stack_info* alloc_size_class_stack_noexc(mlsize_t wosize, intnat s
if (size_class >= 0 && Caml_state->stack_cache[size_class] != NULL) {
stack = Caml_state->stack_cache[size_class];
CAMLassert(stack->size_class == size_class);
Caml_state->stack_cache[size_class] = stack->handler->parent;
Caml_state->stack_cache[size_class] = (struct stack_info*)stack->exception_ptr;
hand = stack->handler;
} else {
/* couldn't get a cached stack, so have to create one */
Expand Down Expand Up @@ -422,7 +422,7 @@ void caml_free_stack (struct stack_info* stack)
memset(stack, 0x42, (char*)stack->handler - (char*)stack);
#endif
if (stack->size_class != -1) {
stack->handler->parent = Caml_state->stack_cache[stack->size_class];
stack->exception_ptr = (void*)Caml_state->stack_cache[stack->size_class];
Caml_state->stack_cache[stack->size_class] = stack;
} else {
caml_stat_free(stack);
Expand Down

0 comments on commit ad332fd

Please sign in to comment.