How's the progress in garbage-collecting unused functions?

We have a lot of places that are essentially:

world = current_task->world
if code_instance->min_world <= world &&
   code_instance->max_world > world

If you put it in a mutable struct then it’s three additional memory dereferences on a very hot part of the code. (We also need to allocate 16byte per world, but that’s fine since they will need to be globally uniqued.)

Not insurmountable and if we really need/want code GC we can do it, but also not something that is completely free.

Also the GC tracking is weirdly inverted. Right now we have

CodeInstance -> World

But what we really want is:

World -> CodeInstance

so that when World becomes disconnected in the object-graph all the information that is only valid in this world become disconnected as well. Add to that we normally use WorldRange which is a set of worlds… That makes the tracing part even weirder. Maybe we would need to ensure that World’s are allocated sequentially in memory and we could use the pointer directly to perform range queries.

Anyway pure speculation at this point.

6 Likes