Skip to content

Commit

Permalink
Improvements to fiber.c
Browse files Browse the repository at this point in the history
  • Loading branch information
kayceesrk committed Dec 13, 2021
1 parent 783c0fc commit a231166
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions runtime/fiber.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ alloc_size_class_stack_noexc(mlsize_t wosize, struct stack_info** size_bucket,
hand->parent = NULL;
stack->sp = (value*)hand;
stack->exception_ptr = NULL;
#ifdef DEBUG
stack->magic = 42;
#endif
CAMLassert(Stack_high(stack) - Stack_base(stack) == wosize ||
Stack_high(stack) - Stack_base(stack) == wosize + 1);
return stack;
Expand Down Expand Up @@ -277,9 +279,8 @@ CAMLprim value caml_alloc_stack(value hval, value hexn, value heff)
if (!stack) caml_raise_out_of_memory();

sp = Stack_high(stack);
// ?
sp -= 1;
sp[0] = Val_long(1); /* trapsp ?? */
sp[0] = Val_long(1);

stack->sp = sp;

Expand Down Expand Up @@ -320,7 +321,7 @@ void caml_scan_stack(scanning_action f, void* fdata,
/* Code pointers inside the stack are naked pointers.
We must avoid passing them to function [f]. */
value v = *sp;
if (Is_block(v) && caml_find_code_fragment_by_pc((char *) v) == NULL) {
if (is_block_and_not_code_frag(v)) {
f(fdata, v, sp);
}
}
Expand Down

0 comments on commit a231166

Please sign in to comment.