From 5fbd5168832e85590cf2382b8f65a7e325835fe0 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 9 May 2019 10:51:02 +0200 Subject: [PATCH] Create separate stages for optimising ABC and generating bytecode, so that the timestamps of these files differ for large projects --- Pm/PmDriver.icl | 52 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/Pm/PmDriver.icl b/Pm/PmDriver.icl index e333869..e39427e 100644 --- a/Pm/PmDriver.icl +++ b/Pm/PmDriver.icl @@ -117,6 +117,8 @@ GenAsmProjectModule imp_pathname project setproject ps | DComp !Bool !*DirCache !DriverCompilingInfo ![!ModuleDirAndName] !DriverStateRecord | DQuitCompilers ![!ModuleDirAndName] !DriverCompilingInfo !DriverStateRecord | DGene ![!ModuleDirAndName] !DriverCodeGenerationInfo !DriverStateRecord + | DOptimiseABC ![!ModuleDirAndName] !DriverStateRecord + | DGenerateByteCode ![!ModuleDirAndName] !DriverStateRecord | DLink !DriverStateRecord | DDone @@ -550,27 +552,29 @@ step intr state=:(DQuitCompilers modpaths (AsyncWin current async_win_compiling_ -> cont (state, ps) // -> doesn't occur on win step intr (DGene [!] SyncCodeGeneration ds) ps - #! ps = showInfo (Level1 "Linking...") ps - = step intr (DLink ds) ps + # (paths,ds) = ds!modpaths + = step intr (DOptimiseABC paths ds) ps step intr (DGene [!] (ASyncCodeGeneration [] {unknown_finished_processors=NoUnknownFinishedProcessors,compiler_process_ids}) ds) ps # ps = setCompilerProcessIds compiler_process_ids ps - #! ps = showInfo (Level1 "Linking...") ps - = step intr (DLink ds) ps + # (paths,ds) = ds!modpaths + = step intr (DOptimiseABC paths ds) ps step intr (DGene [!] (ASyncCodeGenerationWin [] _) ds) ps - #! ps = showInfo (Level1 "Linking...") ps - = step intr (DLink ds) ps + # (paths,ds) = ds!modpaths + = step intr (DOptimiseABC paths ds) ps step intr (DGene [!mdn:rest] SyncCodeGeneration ds) ps | not ds.ok || intr # ds = {ds & ok = False} - = step intr (DLink ds) ps + # (paths,ds) = ds!modpaths + = step intr (DOptimiseABC paths ds) ps # (abccache,fileinfo,gen,abcpath,ps) = check_object_file_out_of_date mdn False ds.abccache ds.fileinfo ds.project ps # (ps,abccache,fileinfo,project,ok,_) = GenCodeTheProjectModule gen False CodeGeneration mdn abcpath abccache fileinfo ds.project ps # ds = {ds & abccache = abccache, fileinfo = fileinfo, project = project, ok = ok} | not ok - = step intr (DLink ds) ps + # (paths,ds) = ds!modpaths + = step intr (DOptimiseABC paths ds) ps = cont (DGene rest SyncCodeGeneration ds, ps) step intr (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes,compiler_process_ids,unknown_finished_processors}) ds) ps @@ -748,6 +752,34 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe # ds = {ds & fileinfo = fileinfo, abccache = abccache, ok = ok} = cont (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processes) ds, ps) +step intr (DOptimiseABC [!mdn:rest] ds) ps + # cgo = PR_GetCodeGenOptions ds.project + | not cgo.optimise_abc + # (paths,ds) = ds!modpaths + = step intr (DGenerateByteCode paths ds) ps + # (tp,ps) = getCurrentProc ps + # ((modinfo,abccache,fileinfo),ps) = FI_GetFileInfo tp mdn ds.abccache ds.fileinfo ps + # (ok,ps) = OptimiseABC mdn modinfo.abcpath modinfo.abcdate ps + # ds & abccache=abccache, fileinfo=fileinfo, ok=ok + = cont (DOptimiseABC rest ds, ps) +step intr (DOptimiseABC [!] ds) ps + # (paths,ds) = ds!modpaths + = step intr (DGenerateByteCode paths ds) ps + +step intr (DGenerateByteCode [!mdn:rest] ds) ps + # cgo = PR_GetCodeGenOptions ds.project + | not cgo.generate_bytecode + #! ps = showInfo (Level1 "Linking...") ps + = step intr (DLink ds) ps + # (tp,ps) = getCurrentProc ps + # ((modinfo,abccache,fileinfo),ps) = FI_GetFileInfo tp mdn ds.abccache ds.fileinfo ps + # (ok,ps) = ByteCodeGen cgo.optimise_abc mdn modinfo.abcpath ps + # ds & abccache=abccache, fileinfo=fileinfo, ok=ok + = cont (DGenerateByteCode rest ds,ps) +step intr (DGenerateByteCode [!] ds) ps + #! ps = showInfo (Level1 "Linking...") ps + = step intr (DLink ds) ps + step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, project, continue}) ps // Check whether executable is out of date and relink it if required. | intr || not ok @@ -1474,10 +1506,6 @@ GenCodeTheProjectModule outofdate sys genAsmOrCode mdn abc_path abccache fileinf # (proc,ps) = getCurrentProc ps # cgo = PR_GetCodeGenOptions project # ((info,abccache,fileinfo), ps) = FI_GetFileInfo proc mdn abccache fileinfo ps - # (ok,ps) = if cgo.optimise_abc (OptimiseABC mdn abc_path info.abcdate ps) (True,ps) - | not ok = (ps, abccache, fileinfo, project, ok, info.objpath) - # (ok,ps) = if cgo.generate_bytecode (ByteCodeGen cgo.optimise_abc mdn abc_path ps) (True,ps) - | not ok = (ps, abccache, fileinfo, project, ok, info.objpath) | not outofdate = (ps,abccache,fileinfo,project,True,info.objpath) # ps = showInfo (Level2 ("Generating code for '" +++ module_name +++ "'.")) ps -- GitLab