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

Add global and generational roots #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

g2p
Copy link
Contributor

@g2p g2p commented Feb 19, 2021

This requires ocaml-sys 0.19.1, which exposes the required runtime API.

@g2p g2p force-pushed the global-roots branch 2 times, most recently from 8689470 to 37bd1b2 Compare February 19, 2021 16:13
@tizoc
Copy link
Owner

tizoc commented Feb 19, 2021

About this one, my intention is to introduce "BoxRoots" in the next version of ocaml-interop, which will serve as a faster replacement to global roots (and probably will also replace local roots). I think this new API is something you may find useful if you are using a high amount of global roots.

Work (for the generic implementation that is independent from ocaml-interop) is being done here right now in case you are interested in knowing more about it: https://gitlab.com/ocaml-rust/ocaml-boxroot/

@g2p
Copy link
Contributor Author

g2p commented Feb 19, 2021

Thanks for the pointer to boxroots, I had no idea you could hook into the GC like that.
I don't have so many global roots, but I imagine switching locals might improve performance.

@tizoc
Copy link
Owner

tizoc commented Mar 15, 2021

@g2p boxroots have been merged into master. I plan to do a new release (0.6.0) today, when I will go through your PRs.

Does this one still make sense? Global roots can do one thing that Boxroots cannot, and that is registering an arbitrary address as a root. But such functionality is not often needed, and for everything else Boxroots beat global roots.

Do you think this PR is still relevant?

@g2p
Copy link
Contributor Author

g2p commented Apr 16, 2021

Personally I would prefer to still have functionality that works without boxroots, because the deep integration of boxroots support with the OCaml runtime in the current implementation makes using Rust as an extension language for OCaml libraries (my use case, and one ocaml-rs targets) a bit visible (need for setup and teardown, likely interactions with Mirage and ocaml-freestanding) and not seamless.

Though that discussion is about scope, and goes beyond this PR.

@tizoc
Copy link
Owner

tizoc commented Apr 16, 2021

@g2p setup and teardown requirements are temporary, and will be removed from future releases (irrespectively of if boxroots get integrated into OCaml or not).

@tizoc
Copy link
Owner

tizoc commented Apr 16, 2021

Btw, here is the OCaml RFC for boxroots in case you are interested in following the discussion ocaml/RFCs#22

@g2p
Copy link
Contributor Author

g2p commented Apr 16, 2021

Okay; pardon the worry. I can table this for now, and wish the RFC well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants