Skip to content

Add global and generational roots#25

Open
g2p wants to merge 2 commits into
tizoc:masterfrom
g2p:global-roots
Open

Add global and generational roots#25
g2p wants to merge 2 commits into
tizoc:masterfrom
g2p:global-roots

Conversation

@g2p

@g2p g2p commented Feb 19, 2021

Copy link
Copy Markdown
Contributor

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

tizoc commented Feb 19, 2021

Copy link
Copy Markdown
Owner

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

g2p commented Feb 19, 2021

Copy link
Copy Markdown
Contributor Author

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

tizoc commented Mar 15, 2021

Copy link
Copy Markdown
Owner

@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

g2p commented Apr 16, 2021

Copy link
Copy Markdown
Contributor Author

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

tizoc commented Apr 16, 2021

Copy link
Copy Markdown
Owner

@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

tizoc commented Apr 16, 2021

Copy link
Copy Markdown
Owner

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

@g2p

g2p commented Apr 16, 2021

Copy link
Copy Markdown
Contributor Author

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