Skip to content

WIP: Remove finalizers for keeping track of shared nodes

Clean Importer requested to merge no-finalizers into master

We need some way to know which nodes are shared with the host, because on an interpreter GC the references need to be updated. Previously, we stored all references as finalizers and had the interpreter GC go through the finalizer list.

That is ugly, so this MR implements a way that does not pass through the finalizer list but uses a separate table in the interpretation environment. The drawback is that we need to find holes in that table, and for this we need finalizers. So this MR uses more memory, and is slightly slower to create new shared nodes (because it needs to find an empty space in the table).

This is only useful if the linked application already uses finalizers. In this situation interpreter GC can become slow because it needs to scan the whole finalizer list, and using a dedicated table is faster.

However, since almost no-one uses finalizers I put this MR on hold for now as it has only aesthetic advantages.

  • If this ever gets merged, the garbage collector still needs to be adapted to use the dedicated table instead of the finalizer list.
Edited by Clean Importer

Merge request reports