Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,6 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)

jl_ptls_t ptls = jl_init_threadtls(0);

#ifdef MMTK_GC
mmtk_initialize_collection((void *)ptls);
#endif

#pragma GCC diagnostic push
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12
#pragma GCC diagnostic ignored "-Wdangling-pointer"
Expand All @@ -811,6 +807,10 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)
#pragma GCC diagnostic pop
JL_GC_PROMISE_ROOTED(ct);
_finish_julia_init(rel, ptls, ct);

#ifdef MMTK_GC
mmtk_initialize_collection((void *)ptls);
#endif
Copy link

Choose a reason for hiding this comment

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

That makes sense, but it seems like GC is only enabled in here:

jl_gc_enable(1);

Should we move the MMTk initialization to right before that point instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried this, but I got segfault for the following command line: /home/yilin/Code/julia_workspace/julia/julia-mmtk-immix-non_moving-release/usr/bin/julia -J /home/yilin/Code/julia_workspace/raicode/rai-server/lib/sys.so.

The segfault is fixed if we put mmtk_initialize_collection after _finish_julia_init (as in the PR). I didn't look further into this.

Copy link

@udesou udesou Feb 28, 2024

Choose a reason for hiding this comment

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

Hmmm, that's odd. Happy to approve it then.

Copy link
Member Author

Choose a reason for hiding this comment

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

@udesou I am reconsidering this. It seems we have to call initialize_collection before enabling GC. Otherwise, we have a situation that Julia thinks the GC is enabled, but MMTk is not able to do a GC.

Copy link

@udesou udesou Mar 24, 2024

Choose a reason for hiding this comment

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

Then, I still don't understand why you'd get a segfault if you call initialize_collection at that point, right before enabling GC. Is it because you need to wait for GC to be fully initialized, somehow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then, I still don't understand why you'd get a segfault if you call initialize_collection at that point, right before enabling GC. Is it because you need to wait for GC to be fully initialized, somehow?

I am not sure. I saw the segfault when I tried it for this PR. But I am not seeing the segfault right now. I am running it a few times and see if it is non deterministic.

}

void jl_init_heartbeat(void);
Expand Down