Skip to content

Commit

Permalink
Fixes to domain.c bad merges
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell committed Aug 14, 2024
1 parent 27b330d commit ace16c4
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions ocaml/runtime/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ static void domain_create(uintnat initial_minor_heap_wsize,
caml_state = domain_state;

domain_state->young_limit = 0;

domain_state->id = d->id;
domain_state->unique_id = s->unique_id;

/* Synchronized with [caml_interrupt_all_signal_safe], so that the
initializing write of young_limit happens before any
interrupt. */
Expand All @@ -639,26 +643,6 @@ static void domain_create(uintnat initial_minor_heap_wsize,
goto init_memprof_failure;
}

/* Set domain_self if we have successfully allocated the
* caml_domain_state. Otherwise domain_self will be NULL and it's up
* to the caller to deal with that. */

domain_self = d;
caml_state = domain_state;

domain_state->young_limit = 0;

domain_state->id = d->id;
domain_state->unique_id = s->unique_id;

/* Tell memprof system about the new domain before either (a) new
* domain can allocate anything or (b) parent domain can go away. */
CAMLassert(domain_state->memprof == NULL);
caml_memprof_new_domain(parent, domain_state);
if (!domain_state->memprof) {
goto init_memprof_failure;
}

CAMLassert(!s->interrupt_pending);

domain_state->extra_heap_resources = 0.0;
Expand Down Expand Up @@ -770,6 +754,7 @@ static void domain_create(uintnat initial_minor_heap_wsize,
domain_state->trap_barrier_block = -1;
#endif

caml_reset_young_limit(domain_state);
add_next_to_stw_domains();
goto domain_init_complete;

Expand Down Expand Up @@ -1687,6 +1672,8 @@ void caml_reset_young_limit(caml_domain_state * dom_st)
(uintnat)dom_st->memprof_young_trigger);
CAMLassert ((uintnat)dom_st->young_ptr >=
(uintnat)dom_st->young_trigger);
/* An interrupt might have been queued in the meanwhile; this
achieves the proper synchronisation. */
atomic_exchange(&dom_st->young_limit, (uintnat)trigger);

/* For non-delayable asynchronous actions, we immediately interrupt
Expand Down Expand Up @@ -1797,11 +1784,6 @@ void caml_poll_gc_work(void)
}

caml_reset_young_limit(d);

if (atomic_load_acquire(&d->requested_external_interrupt)) {
/* This function might allocate (e.g. upon a systhreads yield). */
caml_domain_external_interrupt_hook();
}
}

void caml_handle_gc_interrupt(void)
Expand Down

0 comments on commit ace16c4

Please sign in to comment.