Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix domain.c bad merges #2941

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 6 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 @@ -1687,6 +1671,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 +1783,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
Loading