Skip to content

Documentation improvements for native stack switching functions#11059

Merged
xavierleroy merged 4 commits intoocaml:trunkfrom
ctk21:improve_fiber_comments
Feb 28, 2022
Merged

Documentation improvements for native stack switching functions#11059
xavierleroy merged 4 commits intoocaml:trunkfrom
ctk21:improve_fiber_comments

Conversation

@ctk21
Copy link
Copy Markdown
Contributor

@ctk21 ctk21 commented Feb 25, 2022

This PR adds comments to fiber.h for the native code specifications of caml_runstack, caml_perform, caml_reperform, caml_resume.

The PR also adds more comments for the data structures (struct stack_info, struct stack_handler) representing an OCaml stack.

I decided the stack switching documentation belongs in fiber.h alongside the data structures because a reader of the assembly files will need to see both of these. However I'm open to other locations for the documentation.

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

The additional documentation definitely helps. Thanks! Very minor remarks below.

Comment on lines +112 to +115
* In native compilation the stack switching primitives Prunstack,
* Pperform, Preperform and Presume make use of corresponding functions
* implemented in the assembly files for an architecture (such as
* runtime/amd64.S).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For completeness, you could mention what happens in bytecode? I.e. that these primitives are mapped to instructions of the abstract machine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, good idea.

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

Thanks a lot for all the information. Let's merge!

@xavierleroy xavierleroy merged commit be2db8e into ocaml:trunk Feb 28, 2022
EduardoRFS pushed a commit to esy-ocaml/ocaml that referenced this pull request Mar 1, 2022
…l#11059)

* Remove struct caml_context to avoid confusion

* fibers: Improve comments for struct stack_handler & struct stack_info; remove spurious HEADER WORD in the stack diagram; move NUM_STACK_SIZE_CLASSES to where it is used

* Document the functionality of the caml_{runstack,perform,reperform,resume} assembly stubs

* Addition of documentation for the bytecode implementation of stack switching
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