mmtk / mmtk-julia

Julia binding for MMTk
13 stars 9 forks source link

Conservative stack scanning #157

Closed qinsoon closed 2 months ago

qinsoon commented 4 months ago

This uses conservative stack scanning to find object references from the execution stack, and pins those values. The changes in the PR include:

qinsoon commented 3 months ago

This PR passed tests with https://github.com/mmtk/julia/pull/63. However, if we turn on stress copying in Immix, it segfaults in the building process. I am still looking into this.

qinsoon commented 2 months ago

This PR passed tests with mmtk/julia#63. However, if we turn on stress copying in Immix, it segfaults in the building process. I am still looking into this.

The problem is now solved. We further pin julia values in julia_to_scm_.

qinsoon commented 2 months ago

This PR may show slowdown from previous moving plans:

  1. the conservative stack scanning is unoptimized -- we conservatively scan the entire stack range and the entire machine context range (which includes registers), rather than only scan the active range.
  2. The object references found on the stack are saved to a global var with locking. This could cause contention.
  3. Some stacks are scanned multiple times. ptls->root_task, ptls->current_task, ptls->next_task, ptls->previous_task may point to the same task, the task's stack will be scanned multiple times.

I plan to focus on correctness and allowing more objects to be moved first, and do optimization in future PRs. Now we still want to remove the TPin for the global roots table. However, if requested, I can work on the performance right now within this PR.