Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

First pass to improve the diff to startup code#694

Merged
ctk21 merged 3 commits intoocaml-multicore:5.00from
abbysmal:improve_diff_startup_code
Oct 19, 2021
Merged

First pass to improve the diff to startup code#694
ctk21 merged 3 commits intoocaml-multicore:5.00from
abbysmal:improve_diff_startup_code

Conversation

@abbysmal
Copy link
Copy Markdown
Collaborator

This PR attempts to improve the diff in the startup code on trunk and Multicore.

This actually does not quite improve the diff heavily, but it make sure to be more consistent with the changes introduced by Multicore when it comes to runparams and command line arguments (given to ocamlrun).

I also made sure to check that we did not drop any newer options from the list.

Side notes:

  • As mentioned, Multicore handles such parameters within a dedicated struct (caml_params) that is read-only outside of startup_aux. This means that after startup, these parameters cannot be tempered with. In the Multicore setting, no other runtime code ever modify these fields after startup. This implies some amount of code motion versus trunk.
  • In Multicore, there is still a few runparams disabled:
    • a (setting the allocation policy, ie best_fit, first_fit or next_fit.).
    • H (allocating pages using mmap/mmunmap)
    • w (the initial size of the major heap window)
  • In Multicore, the atom table is handled differently, so the diffing here cannot really be worked around.

The last commit included in this PR also fixes what seems like an omission to me: if backtraced are enabled, it seems like we do not currently enable it for any other domains than the main one.
I moved the backtrace enabling behavior to create_domain, relying on caml_params to check if it needs to be enabled.

@abbysmal
Copy link
Copy Markdown
Collaborator Author

(also introduced in this PR, dubious decision on the coding style of domain.c to make check-typo happy, bikeshedding is allowed.)

Copy link
Copy Markdown
Collaborator

@ctk21 ctk21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR does what it intends and makes us a bit closer to all the options that ocaml/ocaml supports on startup.

Comment thread runtime/domain.c
domain_state->backtrace_last_exn = Val_unit;
caml_register_generational_global_root(&domain_state->backtrace_last_exn);

if (caml_params->backtrace_enabled) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a good spot. In the old code we were only initializing the backtraces on the startup domain.

@ctk21 ctk21 force-pushed the improve_diff_startup_code branch from 463525e to 8d2661e Compare October 19, 2021 15:03
@ctk21
Copy link
Copy Markdown
Collaborator

ctk21 commented Oct 19, 2021

I rebased this as there were conflicts on domain.c.
Will wait for CI to green then merge

@ctk21 ctk21 merged commit dc86494 into ocaml-multicore:5.00 Oct 19, 2021
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Jan 10, 2022
…rove_diff_startup_code

First pass to improve the diff to startup code
ctk21 added a commit to ctk21/ocaml that referenced this pull request Jan 11, 2022
…rove_diff_startup_code

First pass to improve the diff to startup code
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants