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

WIP/NFC: create GC interface for third-party GCs #55256

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

d-netto
Copy link
Member

@d-netto d-netto commented Jul 25, 2024

Prelude to the MMTk integration.

Creates an interface header specifying the functions that a third-party GC must implement to plug into Julia, and also splits the stock Julia GC implementation into a separate file gc-stock.c.

In the future, we'll include a few pre-processor guards to ensure some of these files are not compiled if MMTk is enabled.

A WIP design document describing the rationale behind the interface and the plan for MMTk integration should be in this design document (feedback is welcome at this stage!).

TODO

  • Ensure functions in gc-interface.h are only declared in this header.
  • Add allocation fast-path & codegen write-barriers into the interface.

@d-netto d-netto added the GC Garbage collector label Jul 25, 2024
@d-netto d-netto force-pushed the dcn-gc-interface branch 2 times, most recently from bb47811 to a564641 Compare July 25, 2024 21:39
@d-netto d-netto marked this pull request as draft July 25, 2024 23:31
@d-netto d-netto force-pushed the dcn-gc-interface branch 17 times, most recently from d3e10d6 to 84ce9b5 Compare July 29, 2024 15:01
@d-netto d-netto marked this pull request as ready for review July 29, 2024 15:05
Copy link
Contributor

@kpamnany kpamnany left a comment

Choose a reason for hiding this comment

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

Nice work, good step towards modularizing the GC.

I'm not familiar enough with the LLVM side of things to review that part of the code, so need more reviews.

src/Makefile Show resolved Hide resolved
Comment on lines 1050 to 1054
JL_DLLEXPORT void jl_gc_add_finalizer(jl_value_t *v, jl_function_t *f) JL_NOTSAFEPOINT;
JL_DLLEXPORT void jl_gc_add_ptr_finalizer(jl_ptls_t ptls, jl_value_t *v, void *f) JL_NOTSAFEPOINT;
JL_DLLEXPORT void jl_gc_add_quiescent(jl_ptls_t ptls, void **v, void *f) JL_NOTSAFEPOINT;
JL_DLLEXPORT void jl_finalize(jl_value_t *o);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these also go into gc-interface.h?

Copy link
Member Author

Choose a reason for hiding this comment

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

No.

If they had to be moved somewhere, it would be to gc-common.h, though I'm not fully convinced of it since the MMTk binding is not using this code now IIRC.

Copy link
Member Author

Choose a reason for hiding this comment

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

My inclination is to keep them here for now.

src/gc-debug.c Show resolved Hide resolved
src/gc-stock.h Outdated Show resolved Hide resolved
src/julia_internal.h Show resolved Hide resolved
@d-netto d-netto force-pushed the dcn-gc-interface branch 3 times, most recently from 425fa38 to 038eac0 Compare July 31, 2024 15:11
@d-netto d-netto force-pushed the dcn-gc-interface branch 7 times, most recently from 3d6311f to f8ef014 Compare July 31, 2024 17:55
@d-netto d-netto merged commit 761a8cf into master Aug 1, 2024
7 checks passed
@d-netto d-netto deleted the dcn-gc-interface branch August 1, 2024 00:29
lazarusA pushed a commit to lazarusA/julia that referenced this pull request Aug 17, 2024
Prelude to the MMTk integration.

Creates an interface header specifying the functions that a third-party
GC must implement to plug into Julia, and also splits the stock Julia GC
implementation into a separate file `gc-stock.c`.

In the future, we'll include a few pre-processor guards to ensure some
of these files are not compiled if MMTk is enabled.

A WIP design document describing the rationale behind the interface and
the plan for MMTk integration should be in this [design
document](https://docs.google.com/document/d/1v0jtSrIpdEDNOxj5S9g1jPqSpuAkNWhr_T8ToFC9RLI/edit)
(feedback is welcome at this stage!).

## TODO
- [x] Ensure functions in `gc-interface.h` are only declared in this
header.
- [x] Add allocation fast-path & codegen write-barriers into the
interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants