Each used unit is checked if it is already loaded. If it is not, it needs to be found and checked if recompilation is needed. When used unit needs recompilation the current processed unit (symbol tables and compilar data) need to be pushed to the heap to make room for a new unit.
Once the used unit is recompiled the original unit can be restored from the heap.