IMO, every module is semchecked separately hence I disagree. Modules are 
written in this fashion, imports are generally at the top:
    
    
    import a1, a2,a3  # spawn thread tasks
    import a4,a5      # spawn thread tasks
    import ar         # spawn thread tasks
    
    
    # wait here on the first AST node that needs import to complete
    type
       XXX
    
    proc myproc(x: int): int =
      ....
    
    
    Run

General idea is process AST nodes in sempass as we currently do but imports 
spawns background tasks. We keep on processing nodes of kinds nkStmtList, 
nkImport, nkComment, nkEmpty until we hit first AST node of different kind 
where we wait until imports are complete. This should give us enough 
parallelism to work with.

Bigger problems: VM is a singleton. We can put a global lock on VM for now. 
ConfigRef is written too often by modules, code should be changed to rely on 
per module's PContext more.

Reply via email to