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

Julia assumes perm alloc won't trigger GC #172

Open
qinsoon opened this issue Sep 5, 2024 · 1 comment
Open

Julia assumes perm alloc won't trigger GC #172

qinsoon opened this issue Sep 5, 2024 · 1 comment

Comments

@qinsoon
Copy link
Member

qinsoon commented Sep 5, 2024

The function mk_symbol is marked as JL_NOTSAFEPOINT, and it calls perm_alloc inside. The function with JL_NOTSAFEPOINT may not have its local variables not pushed to the shadow stack.
https://github.com/mmtk/julia/blob/f5f8510c016b40cb82f7445338bf9ef084704174/src/symbol.c#L34

We use MMTk for perm alloc, which may trigger GC. This will cause a correctness issue for us.

@qinsoon
Copy link
Member Author

qinsoon commented Oct 11, 2024

We disable GC before jl_get_layout which calls mk_symbol. I am not sure if this is necessary, but it complies with Julia's assumption.

qinsoon added a commit to mmtk/julia that referenced this issue Oct 11, 2024
This PR adds a few more pining for types in the native heap, and exposes globally rooted symbols so we can trace them in the MMTk binding. With this PR, we can run moving Immix without transitively pinning `global_roots_table`. See mmtk/mmtk-julia#170.
* Add `jl_gc_pin`
* Use `jl_gc_pin` to pin `BigFloat` for MPFR
* Rename `PTR_PIN` to `OBJ_PIN`. Additionally add `PTR_PIN` which handles cases for internal pointers.
* Pin objects that are used as key in `jl_codectx_t.global_targets`
* Pin objects that are stored in `jl_codectx_t.PhiNodes`
* Pin objects that are referred to by `jl_cgval_t`
* Disable GC before doing perm alloc in `jl_get_layout` (see mmtk/mmtk-julia#172)
* Pin weak references and the referee (see mmtk/mmtk-julia#176)
* Pin objects that are used in `libuv`'s handle.
* Pin `jl_task_t.completion_future` (see mmtk/mmtk-julia#179)
* Pin all `jl_codeinst_t` objects.
* Pin all `jl_method_instance_t` objects.
* Pin all `jl_module_t` objects.
* Pin all `jl_task_t` objects.
* Expose some `JL_GLOBALLY_ROOTED` symbols, such as `newly_inferred`, `task_done_hook_func`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant