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

Resource-management for resumptions #3

Open
gadmm opened this issue Jan 9, 2022 · 5 comments
Open

Resource-management for resumptions #3

gadmm opened this issue Jan 9, 2022 · 5 comments

Comments

@gadmm
Copy link

gadmm commented Jan 9, 2022

As a follow-up to the discussion at https://discuss.ocaml.org/t/multi-shot-continuations-gone-forever/9072/13, I think the usual resource-management issues inside resumptions apply to resumptions themselves: currently they have to be dropped manually, which prevents us from referring to them inside other resumptions since it becomes impossible to track when they should be freed.

As suggested in the discussion, one solution is to make resumptions purely GC-managed values. To do so, one can represent a resumption either as a heap value obtained by copying a fiber, or as a fiber which is only discontinued by the GC using a finaliser and which is never reinstated/converted back to a continuation. The interface gets simplified by removal of demote, drop and Resumption_already_dropped.

The distinction between linear continuations, which are allowed to own resources, and multi-shot continuations, which are not, could be explained in the documentation, to underline the issues arising from promoting arbitrary continuations.

(cc @gasche)

@gasche
Copy link

gasche commented Jan 9, 2022

I agree, and/but I suspect that sending a PR to propose the new implementation may be more effective, in case @dhil rather prefers to keep this as a low-effort project on the side.

@gadmm
Copy link
Author

gadmm commented Jan 9, 2022

Let me know what you think @dhil!

@dhil
Copy link
Owner

dhil commented Jan 9, 2022

I think it is a good idea! I am interested in exploring such designs. My initial plan was just to replicate clone_continuation, such that I can continue working on my research software which is written in an older version of Multicore OCaml.

@dhil
Copy link
Owner

dhil commented Jan 12, 2022

@gadmm I have managed to get byte code compilation going now. I will look into experimenting with GC'ed resumptions next.

@dhil
Copy link
Owner

dhil commented Jan 16, 2022

Commits 2ac6158 and 1f7fc26 add initial support for experimenting with GC managed resumptions/continuations.

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

No branches or pull requests

3 participants