Commit 23e66381 authored by John van Groningen's avatar John van Groningen
Browse files

use type ModuleDirAndName instead of type String

parent 6868ed0a
implementation module PmDriver
import StdArray,StdBool,StdList,StdMisc,StdEnum,StdStrictLists
from StdOverloadedList import Foldr,++|,Hd,Any
import UtilNewlinesFile, UtilIO
import IdeState
......@@ -57,11 +57,12 @@ System :== "_system"
// Compile /Check Syntax of the designated module
CompileProjectModule :: !CompileOrCheckSyntax !Pathname !Project !SetMadeProjectFun !*GeneralSt -> *GeneralSt
CompileProjectModule compilerOrCheckSyntax path project setproject ps
CompileProjectModule compilerOrCheckSyntax imp_pathname project setproject ps
# ps = ClearCompilerCache` ps
# (syspaths,ps) = getCurrentPaths ps
# prjpaths = PR_GetPaths project
# srcpaths = AppendLists prjpaths syspaths
# (mdn,imp_pathname) = determine_dir_and_filename imp_pathname srcpaths
#! (abccache,ps) = getABCCache ps
#! (fileinfo,ps) = getFICache` ps
#! ((errs,warns,dircache),ps)
......@@ -69,17 +70,18 @@ CompileProjectModule compilerOrCheckSyntax path project setproject ps
# ({be_verbose},ps) = getPrefs ps
#! ps = HandleDCErrors be_verbose errs warns ps
#! (ps,fileinfo,_,abccache,project,ok,newpaths,_,_)
= CompileTheProjectModule compilerOrCheckSyntax path fileinfo dircache abccache project ps
= CompileTheProjectModule compilerOrCheckSyntax mdn imp_pathname fileinfo dircache abccache project ps
# ps = setABCCache abccache ps
# ps = setFICache fileinfo ps
= setproject ok newpaths project ps
GenAsmProjectModule :: !.Pathname !Project !SetMadeProjectFun !*GeneralSt -> *GeneralSt
GenAsmProjectModule path project setproject ps
GenAsmProjectModule imp_pathname project setproject ps
# ps = ClearCompilerCache` ps
# (syspaths,ps) = getCurrentPaths ps
# prjpaths = PR_GetPaths project
# srcpaths = AppendLists prjpaths syspaths
# (mdn,imp_pathname) = determine_dir_and_filename imp_pathname srcpaths
# (abccache,ps) = getABCCache ps
#! (fileinfo,ps) = getFICache` ps
# ((errs,warns,dircache),ps)
......@@ -87,13 +89,13 @@ GenAsmProjectModule path project setproject ps
# ({be_verbose},ps) = getPrefs ps
# ps = HandleDCErrors be_verbose errs warns ps
# (ps,fileinfo,_,abccache,project,ok,newpaths,abcpath,_)
= CompileTheProjectModule Compilation path fileinfo dircache abccache project ps
= CompileTheProjectModule Compilation mdn imp_pathname fileinfo dircache abccache project ps
| not ok || newpaths
# ps = setABCCache abccache ps
# ps = setFICache fileinfo ps
= setproject True False project ps
# (ps,abccache,fileinfo,project,ok,_)
= GenCodeTheProjectModule True False AsmGeneration abcpath abccache fileinfo project ps
= GenCodeTheProjectModule True False AsmGeneration mdn abcpath abccache fileinfo project ps
# ps = setABCCache abccache ps
# ps = setFICache fileinfo ps
= setproject True ok project ps
......@@ -119,9 +121,9 @@ GenAsmProjectModule path project setproject ps
:: *DriverState
= DInit !Bool !Project !MTPContinuation
| DComp !Bool !*DirCache !DriverCompilingInfo !(List String) !DriverStateRecord
| DGene !(List String) !DriverCodeGenerationInfo !DriverStateRecord
| DQuitCompilers !(List String) !DriverCompilingInfo !DriverStateRecord
| DComp !Bool !*DirCache !DriverCompilingInfo ![!ModuleDirAndName] !DriverStateRecord
| DGene ![!ModuleDirAndName] !DriverCodeGenerationInfo !DriverStateRecord
| DQuitCompilers ![!ModuleDirAndName] !DriverCompilingInfo !DriverStateRecord
| DLink !DriverStateRecord
| DDone
......@@ -133,7 +135,7 @@ GenAsmProjectModule path project setproject ps
, libsinfo :: !StaticLibInfo
, ok :: !Bool
, newpaths :: !Bool
, modpaths :: !List String
, modpaths :: ![!ModuleDirAndName]
}
BringProjectUptoDate :: !Bool CleanupCont !*GeneralSt -> *GeneralSt
......@@ -171,7 +173,7 @@ where
= ps
= ps
cleanup :: !Bool !Bool !Bool !FileInfoCache !StaticLibInfo !(List Modulename) !Project !Bool (!*ABCCache,!GeneralSt) -> *(!*DriverState,!*GeneralSt)
cleanup :: !Bool !Bool !Bool !FileInfoCache !StaticLibInfo ![!ModuleDirAndName] !Project !Bool (!*ABCCache,!GeneralSt) -> *(!*DriverState,!*GeneralSt)
cleanup ok newpaths linked fileinfo libsinfo modpaths project intr (abccache,ps)
| newpaths && not intr // if paths have changed -> try again
# ps = showInfo (Level1 "Paths have changed: remaking.") ps
......@@ -193,7 +195,7 @@ where
//-- Private stuff
:: MTPContinuation :== Bool Bool Bool FileInfoCache StaticLibInfo (List Modulename) Project Bool *(*ABCCache,GeneralSt) -> *(*DriverState,*GeneralSt)
:: MTPContinuation :== Bool Bool Bool FileInfoCache StaticLibInfo [!ModuleDirAndName] Project Bool *(*ABCCache,GeneralSt) -> *(*DriverState,*GeneralSt)
MakeTheProject :: !Bool !FileInfoCache !StaticLibInfo !*ABCCache !Project !MTPContinuation !GeneralSt -> (!*DriverState,!*GeneralSt)
MakeTheProject force fileinfo libsinfo abccache project continue ps
......@@ -206,23 +208,23 @@ MakeTheProject force fileinfo libsinfo abccache project continue ps
# ps = HandleDCErrors be_verbose errs warns ps
# (root,project) = PR_GetRootPathName project
# root = MakeDefPathname root // avoid double compilation...
# inidone = Nil
# (root_mdn,project) = PR_GetRootModuleDirAndName project
# (env_static_libs,ps) = getCurrentSlibs ps
# sfiles = (StrictListToList(Concat (SL_Libs libsinfo) env_static_libs))
# (err,ps) = check_exists sfiles ps
| isJust err
# line = Level3 ["Error: Unable to find static library: '" +++ fromJust err +++ "'."]
# ps = showInfo line ps
= continue False False False fileinfo libsinfo Nil project False (abccache, ps)
= continue False False False fileinfo libsinfo [!] project False (abccache, ps)
# ((errs,slibs),ps) = accFiles (getLibs sfiles) ps
| not (isEmpty errs)
# line = Level3 ["Error: Failed reading static libraries: '" :errs]
# ps = showInfo line ps
= continue False False False fileinfo libsinfo Nil project False (abccache, ps)
= continue False False False fileinfo libsinfo [!] project False (abccache, ps)
# slibs = ListToStrictList slibs
# libsinfo = SL_SetDcls slibs libsinfo
# ps = showInfo (Level1 "Compiling...") ps
# rest = root :! Nil
# rest = [!root_mdn]
# (method,ps) = getCurrentMeth ps
# (compinfo,ps) = case method of
CompileSync -> (Sync,ps)
......@@ -240,7 +242,7 @@ MakeTheProject force fileinfo libsinfo abccache project continue ps
, libsinfo = libsinfo
, ok = True
, newpaths = False
, modpaths = inidone
, modpaths = [!]
}
= step False (DComp force dircache compinfo rest ds) ps
where
......@@ -251,14 +253,14 @@ where
= (Just file,ps)
:: CurrentlyCompiled =
{ iclModule :: !String
{ iclModule :: !ModuleDirAndName
, options :: CompilerOptions
, slot :: !Int
}
:: *DriverCodeGenerationInfo
= SyncCodeGeneration
| ASyncCodeGeneration ![(Int,String,String)] !AsyncCompilingInfo // [(busy_process_number,abc_path,obj_path)]
| ASyncCodeGeneration ![CodeGeneratorProcessNAndPaths] !AsyncCompilingInfo
| ASyncCodeGenerationWin ![WinCodeGeneratorProcess] /*max_n_processes*/!Int
:: CodeGeneratorProcessNAndPaths
......@@ -269,10 +271,13 @@ where
wcgp_process_handle :: !Int,
wcgp_scg :: !StartedCodeGenerator,
wcgp_module_name :: !Modulename,
wcgp_abc_path :: !Pathname,
wcgp_obj_path :: !Pathname
}
module_occurs :: !String ![!ModuleDirAndName] -> Bool
module_occurs s [|x:xs] = x.mdn_name == s || module_occurs s xs
module_occurs s [!] = False
get_neverTimeProfile_option :: !{#Char} Project !*GeneralSt -> (!Bool,!*GeneralSt)
get_neverTimeProfile_option module_name project ps
= case (PR_GetModuleInfo module_name project) of
......@@ -308,22 +313,21 @@ step True (DComp force dircache compinfo rest ds) ps
// need async cocl shootdown as well..
-> step True ds ps
step intr (DComp force dircache Sync Nil ds) ps
step intr (DComp force dircache Sync [!] ds) ps
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# (modpaths,project) = PR_GetDirAndModulenames project
# ds = {ds & modpaths = modpaths, project = project}
# ps = showInfo (Level1 "Generating...") ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
step intr (DComp force dircache Sync (next :! rest) ds) ps
step intr (DComp force dircache Sync [!next : rest] ds) ps
// compile phase: check module 'next'
| StringOccurs next ds.modpaths
| module_occurs next.mdn_name ds.modpaths
// if already done then skip
= step intr (DComp force dircache Sync rest ds) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
| isProjLibraryModule next.mdn_name ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= step intr (DComp force dircache Sync rest ds) ps
# (ps,dircache,ok,newpaths`,rest,compinfo,ds,_)
......@@ -332,27 +336,26 @@ step intr (DComp force dircache Sync (next :! rest) ds) ps
| not ok
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
# ds = {ds & modpaths = next :! ds.modpaths}
# ds & modpaths = [!next : ds.modpaths]
= cont (DComp force dircache compinfo rest ds,ps)
step intr (DComp force dircache (Pers inf) Nil ds) ps
step intr (DComp force dircache (Pers inf) [!] ds) ps
// compile phase finished: kill clean compiler
# (_,ps) = ExitCleanCompiler (inf,ps)
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# (modpaths,project) = PR_GetDirAndModulenames project
# ds = {ds & modpaths = modpaths, project = project}
# ps = showInfo (Level1 "Generating...") ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
step intr (DComp force dircache compinfo=:(Pers _) (next :! rest) ds) ps
step intr (DComp force dircache compinfo=:(Pers _) [!next:rest] ds) ps
// compile phase: check module 'next'
| StringOccurs next ds.modpaths
| module_occurs next.mdn_name ds.modpaths
// if already done then skip
= step intr (DComp force dircache compinfo rest ds) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
| isProjLibraryModule next.mdn_name ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= step intr (DComp force dircache compinfo rest ds) ps
# (ps,dircache,ok,newpaths`,rest,compinfo,ds,_)
......@@ -363,23 +366,23 @@ step intr (DComp force dircache compinfo=:(Pers _) (next :! rest) ds) ps
# (_,ps) = ExitCleanCompiler (inf,ps)
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
# ds = {ds & modpaths = next :! ds.modpaths}
# ds & modpaths = [!next : ds.modpaths]
= cont (DComp force dircache compinfo rest ds,ps)
step intr (DComp force dircache (Async [] async_compiling_info=:{max_n_processes,compiler_process_ids,unknown_finished_processors=NoUnknownFinishedProcessors}) Nil ds) ps
step intr (DComp force dircache (Async [] async_compiling_info=:{max_n_processes,compiler_process_ids,unknown_finished_processors=NoUnknownFinishedProcessors}) [!] ds) ps
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# (modpaths,project) = PR_GetDirAndModulenames project
# ds = {ds & modpaths = modpaths, project = project}
# (os_error,ps) = ClearCompilerCaches compiler_process_ids ps;
# ps = showInfo (Level1 "Generating...") ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths (ASyncCodeGeneration [] async_compiling_info) ds) ps
step intr (DComp force dircache (AsyncWin [] {win_compiler_process_ids,win_max_n_processes}) Nil ds) ps
step intr (DComp force dircache (AsyncWin [] {win_compiler_process_ids,win_max_n_processes}) [!] ds) ps
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# (modpaths,project) = PR_GetDirAndModulenames project
# ds = {ds & modpaths = modpaths, project = project}
# ps = app_world_instead_of_ps (QuitCleanCompiler True win_compiler_process_ids) ps;
# ps = showInfo (Level1 "Generating...") ps
......@@ -434,33 +437,32 @@ step intr state=:(DComp force _ (Async _ _) _ _) ps
# unknown_finished_processors = remove_from_unknown_finished_processors completedSlot unknown_finished_processors
# (startupdir,ps) = getStup ps
# (interact, ps) = getInteract ps
# typewin = update_type_window interact (GetModuleName completed.iclModule)
# typewin = update_type_window interact completed.iclModule.mdn_name
# ccstring = "dummy ccstring for now.."
# (abcpath,res,ps) = CompileHandleExitCode exitcode ccstring startupdir completedSlot updateErrorWindow typewin
completed.iclModule completed.options.listTypes ps // types param
# (_,(ps,fileinfo,dircache,abccache,project,ok,newpaths`,_,deps))
= ProcessCompilerMsg Nothing Compilation completed.options completed.iclModule abcpath res ds.fileinfo dircache ds.abccache ds.project ps
# ds = {ds & newpaths = ds.newpaths || newpaths`, fileinfo = fileinfo, abccache = abccache, project = project, ok = ok}
| ok
# ds = {ds & modpaths = icl_to_dcl_file_name completed.iclModule :! ds.modpaths}
= (DComp force dircache (Async current {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) (Concat deps todo) ds, ps)
| ok
# ds & modpaths = [!completed.iclModule : ds.modpaths]
todo = deps++|todo
= (DComp force dircache (Async current {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) todo ds, ps)
// not ok
# (os_error,ps) = ClearCompilerCaches compiler_process_ids ps;
# (paths,ds) = ds!modpaths
= (DGene paths SyncCodeGeneration ds, ps)
start_compilations :: !*DriverState !*GeneralSt -> (!*DriverState,!*GeneralSt)
start_compilations state=:(DComp force dircache (Async current {max_n_processes,compiler_process_ids,unknown_finished_processors}) (next :! rest) ds) ps
start_compilations state=:(DComp force dircache (Async current {max_n_processes,compiler_process_ids,unknown_finished_processors}) [!next : rest] ds) ps
// all threads used?
| length current >= max_n_processes
# ps = DelayEventLoop ps;
= (state, ps)
// compile phase: check module 'next'
# next_icl = dcl_to_icl_file_name next;
| StringOccurs next ds.modpaths || currently_compiled next_icl current
| module_occurs next.mdn_name ds.modpaths || currently_compiled next.mdn_name current
= start_compilations (DComp force dircache (Async current {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) rest ds) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
| isProjLibraryModule next.mdn_name ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= (DComp force dircache (Async current {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) rest ds, ps)
# (ps,dircache,ok,_,rest,compinfo,ds,_)
......@@ -475,10 +477,6 @@ step intr state=:(DComp force _ (Async _ _) _ _) ps
# ps = DelayEventLoop ps
= (state, ps)
currently_compiled :: String [CurrentlyCompiled] -> Bool
currently_compiled next current
= or [c.iclModule == next \\ c <- current]
step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
# (state, ps) = check_completed state ps
# (state, ps) = start_compilations state ps
......@@ -504,7 +502,7 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
# (completed, current) = removeFromCurrent completedSlot current
# (startupdir,ps) = getStup ps
# (interact, ps) = getInteract ps
# typewin = update_type_window interact (GetModuleName completed.iclModule)
# typewin = update_type_window interact completed.iclModule.mdn_name
# ccstring = "dummy ccstring for now.."
# (abcpath,res,ps) = CompileHandleExitCode exitcode ccstring startupdir completedSlot updateErrorWindow typewin
completed.iclModule completed.options.listTypes ps // types param
......@@ -512,23 +510,22 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
= ProcessCompilerMsg Nothing Compilation completed.options completed.iclModule abcpath res ds.fileinfo dircache ds.abccache ds.project ps
# ds = {ds & newpaths = ds.newpaths || newpaths`, fileinfo = fileinfo, abccache = abccache, project = project, ok = ok}
| ok
# ds = {ds & modpaths = icl_to_dcl_file_name completed.iclModule :! ds.modpaths}
= (DComp force dircache (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) (Concat deps todo) ds, ps)
# ds & modpaths = [!completed.iclModule : ds.modpaths]
todo = deps++|todo
= (DComp force dircache (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) todo ds, ps)
// not ok
# (paths,ds) = ds!modpaths
= (DQuitCompilers paths (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) ds,ps)
start_compilations :: !*DriverState !*GeneralSt -> (!*DriverState,!*GeneralSt)
start_compilations state=:(DComp force dircache (AsyncWin current {win_max_n_processes,win_compiler_process_ids}) (next :! rest) ds) ps
start_compilations state=:(DComp force dircache (AsyncWin current {win_max_n_processes,win_compiler_process_ids}) [!next : rest] ds) ps
| length current >= win_max_n_processes
# ps = DelayEventLoop ps;
= (state, ps)
// compile phase: check module 'next'
# next_icl = dcl_to_icl_file_name next;
| StringOccurs next ds.modpaths || currently_compiled next_icl current
// compile phase: check module 'next'
| module_occurs next.mdn_name ds.modpaths || currently_compiled next.mdn_name current
= start_compilations (DComp force dircache (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) rest ds) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
| isProjLibraryModule next.mdn_name ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= (DComp force dircache (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) rest ds, ps)
# (ps,dircache,ok,_,rest,compinfo,ds,_)
......@@ -538,16 +535,12 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
#! (paths,ds) = ds!modpaths
= (DQuitCompilers paths (AsyncWin current {win_max_n_processes=win_max_n_processes,win_compiler_process_ids=win_compiler_process_ids}) ds,ps)
= start_compilations (DComp force dircache compinfo rest ds) ps
start_compilations state=:(DComp force dircache (AsyncWin [] _) Nil ds) ps
start_compilations state=:(DComp force dircache (AsyncWin [] _) [!] ds) ps
= (state, ps)
start_compilations state ps
# ps = DelayEventLoop ps;
= (state, ps)
currently_compiled :: String [CurrentlyCompiled] -> Bool
currently_compiled next current
= or [c.iclModule == next \\ c <- current]
step intr (DQuitCompilers modpaths (AsyncWin [] {win_compiler_process_ids}) ds) ps
# ps = app_world_instead_of_ps (QuitCleanCompiler True win_compiler_process_ids) ps
= step intr (DGene modpaths SyncCodeGeneration ds) ps
......@@ -561,25 +554,25 @@ step intr state=:(DQuitCompilers modpaths (AsyncWin current async_win_compiling_
(UnknownFinishedCompiler,ps)
-> cont (state, ps) // -> doesn't occur on win
step intr (DGene Nil SyncCodeGeneration ds) ps
step intr (DGene [!] SyncCodeGeneration ds) ps
#! ps = showInfo (Level1 "Linking...") ps
= step intr (DLink ds) ps
step intr (DGene Nil (ASyncCodeGeneration [] {unknown_finished_processors=NoUnknownFinishedProcessors,compiler_process_ids}) 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
step intr (DGene Nil (ASyncCodeGenerationWin [] _) ds) ps
step intr (DGene [!] (ASyncCodeGenerationWin [] _) ds) ps
#! ps = showInfo (Level1 "Linking...") ps
= step intr (DLink ds) ps
step intr (DGene (path:!rest) SyncCodeGeneration ds) ps
step intr (DGene [!mdn:rest] SyncCodeGeneration ds) ps
| not ds.ok || intr
# ds = {ds & ok = False}
= step intr (DLink ds) ps
# (ps,abccache,fileinfo,gen,abcpath) = CheckABCOutOfDate False path ds.abccache ds.fileinfo ds.project ps
# (ps,abccache,fileinfo,project,ok,_) = GenCodeTheProjectModule gen False CodeGeneration abcpath abccache fileinfo ds.project ps
# (ps,abccache,fileinfo,gen,abcpath) = CheckABCOutOfDate False mdn 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
......@@ -601,18 +594,18 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes,comp
// # ps = trace ("f "+++toString finished_cg_slot_n+++" "+++toString exit_code+++" ") ps
# unknown_finished_processors = remove_from_unknown_finished_processors finished_cg_slot_n unknown_finished_processors
# (abc_path,obj_path,busy_processes) = get_paths_and_remove_process_from_list finished_cg_slot_n busy_processes
# (module_name,obj_path,busy_processes) = get_paths_and_remove_process_from_list finished_cg_slot_n busy_processes
with
get_paths_and_remove_process_from_list finished_cg_slot_n [busy_process=:(slot,abc_path,obj_path) : rest]
| finished_cg_slot_n==slot
= (abc_path,obj_path,rest)
# (abc_path,obj_path,rest) = get_paths_and_remove_process_from_list finished_cg_slot_n rest
= (abc_path,obj_path,[busy_process:rest])
get_paths_and_remove_process_from_list finished_cg_slot_n [busy_process=:{cgp_process_n,cgp_module_name,cgp_obj_path} : rest]
| finished_cg_slot_n==cgp_process_n
= (cgp_module_name,cgp_obj_path,rest)
# (module_name,obj_path,rest) = get_paths_and_remove_process_from_list finished_cg_slot_n rest
= (module_name,obj_path,[busy_process:rest])
get_paths_and_remove_process_from_list finished_cg_slot_n []
= abort "driver.icl: unknown code generator id"
| exit_code==0
# (fileinfo,ps) = accFiles (FI_UpdateObjDate abc_path obj_path fileinfo) ps
# project = PR_SetCodeGenerated (GetModuleName abc_path) project
# (fileinfo,ps) = accFiles (FI_UpdateObjDate module_name obj_path fileinfo) ps
# project = PR_SetCodeGenerated module_name project
-> handle_finished_code_generators busy_processes unknown_finished_processors project fileinfo ps
-> (False,busy_processes,unknown_finished_processors,project,fileinfo,ps)
handle_finished_code_generators [] unknown_finished_processors project fileinfo ps
......@@ -649,27 +642,28 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes,comp
# ds = {ds & fileinfo = fileinfo, project = project, ok = ds.ok && ok && not intr}
| not ds.ok
= cont (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) ds,ps)
| (length busy_processes>=max_n_processes || (case paths of Nil -> True ; _ -> False))
| (length busy_processes>=max_n_processes || (case paths of [!] -> True ; _ -> False))
# ps = DelayEventLoop ps
= cont (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) ds,ps)
# (ok,paths,busy_processes,fileinfo,abccache,ps) = start_code_generators paths busy_processes ds.fileinfo ds.abccache ps
with
start_code_generators :: (List {#Char}) [(Int,{#Char},{#Char})] FileInfoCache *ABCCache !*GeneralSt -> *(.Bool,(List {#Char}),[(Int,{#Char},{#Char})],FileInfoCache,*ABCCache,!*GeneralSt)
start_code_generators paths=:(path :! rest) busy_processes fileinfo abccache ps
start_code_generators :: [!ModuleDirAndName] [CodeGeneratorProcessNAndPaths] FileInfoCache *ABCCache !*GeneralSt -> *(.Bool,[!ModuleDirAndName],[CodeGeneratorProcessNAndPaths],FileInfoCache,*ABCCache,!*GeneralSt)
start_code_generators paths=:[!mdn : rest] busy_processes fileinfo abccache ps
| length busy_processes>=max_n_processes
# ps = DelayEventLoop ps
= (True,paths,busy_processes,fileinfo,abccache,ps)
# (ps,abccache,fileinfo,gen,abc_path)
= CheckABCOutOfDate False path abccache fileinfo project ps
= CheckABCOutOfDate False mdn abccache fileinfo project ps
# cgo = PR_GetCodeGenOptions project
# (proc,ps) = getCurrentProc ps
# ((abccache,fileinfo,info), ps)
= FI_GetFileInfo proc abc_path abccache fileinfo ps
= FI_GetFileInfo proc mdn abccache fileinfo ps
| not gen
= start_code_generators rest busy_processes fileinfo abccache ps
# module_name = mdn.mdn_name
# ps = showInfo (Level2 (
(foldl (+++) ("Generating code for "
+++ RemovePath abc_path) [" "+++RemovePath abc_path \\ (_,abc_path,_)<-busy_processes])
+++ module_name) [" "+++cgp_module_name \\ {cgp_module_name}<-busy_processes])
)) ps
# (startupdir,ps) = getStup ps
# (cgen,ps) = getCurrentCgen ps
......@@ -681,16 +675,16 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes,comp
Just modinfo -> modinfo.compilerOptions
_ -> defaultCO
# timeprofile = ao.profiling && (not co.neverTimeProfile)
# free_slot = hd (removeMembers [0..max_n_processes-1] [slot \\ (slot,_,_) <- busy_processes])
# free_slot = hd (removeMembers [0..max_n_processes-1] [cgp_process_n \\ {cgp_process_n} <- busy_processes])
# (res,obj_path,compiler_process_ids,ps) = StartCodeGenerator cgen updateErrorWindow CodeGeneration abc_path free_slot timeprofile cgo proc ao startupdir compiler_process_ids ps
| not res
= (False,rest,busy_processes,fileinfo,abccache,ps)
# busy_processes = [(free_slot,abc_path,obj_path):busy_processes]
# busy_processes = [{cgp_process_n=free_slot,cgp_module_name=module_name,cgp_obj_path=obj_path}:busy_processes]
= start_code_generators rest busy_processes fileinfo abccache ps
start_code_generators Nil busy_processes fileinfo abccache ps
start_code_generators [!] busy_processes fileinfo abccache ps
# ps = DelayEventLoop ps
= (True,Nil,busy_processes,fileinfo,abccache,ps)
= (True,[!],busy_processes,fileinfo,abccache,ps)
# ds = {ds & fileinfo = fileinfo, abccache = abccache, ok = ok}
= cont (DGene paths (ASyncCodeGeneration busy_processes {max_n_processes=max_n_processes,compiler_process_ids=compiler_process_ids,unknown_finished_processors=unknown_finished_processors}) ds, ps)
......@@ -714,8 +708,7 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
| ok
# module_name = finished_process.wcgp_module_name
obj_path = finished_process.wcgp_obj_path
abc_path = finished_process.wcgp_abc_path
# (fileinfo,ps) = accFiles (FI_UpdateObjDate abc_path obj_path fileinfo) ps
# (fileinfo,ps) = accFiles (FI_UpdateObjDate module_name obj_path fileinfo) ps
# project = PR_SetCodeGenerated module_name project
= (True,busy_processes,project,fileinfo,ps)
= (False,busy_processes,project,fileinfo,ps)
......@@ -724,13 +717,13 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
# ds = {ds & fileinfo = fileinfo, project = project, ok = ds.ok && ok && not intr}
| not ds.ok
= cont (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processes) ds,ps)
| length busy_processes>=win_max_n_processes || (case paths of Nil -> True ; _ -> False)
| length busy_processes>=win_max_n_processes || (case paths of [!] -> True ; _ -> False)
= cont (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processes) ds,ps)
# (ok,paths,busy_processes,fileinfo,abccache,ps) = start_code_generators paths busy_processes ds.fileinfo ds.abccache ps
with
start_code_generators :: (List {#Char}) [WinCodeGeneratorProcess] FileInfoCache *ABCCache !*GeneralSt
-> *(Bool,(List {#Char}),[WinCodeGeneratorProcess],FileInfoCache,*ABCCache,!*GeneralSt )
start_code_generators paths=:(mdn:!rest) busy_processes fileinfo abccache ps
start_code_generators :: [!ModuleDirAndName] [WinCodeGeneratorProcess] FileInfoCache *ABCCache !*GeneralSt
-> *(Bool,[!ModuleDirAndName],[WinCodeGeneratorProcess],FileInfoCache,*ABCCache,!*GeneralSt )
start_code_generators paths=:[!mdn:rest] busy_processes fileinfo abccache ps
| length busy_processes>=win_max_n_processes
= (True,paths,busy_processes,fileinfo,abccache,ps)
# (ps,abccache,fileinfo,gen,abc_path)
......@@ -739,7 +732,7 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
# ((abccache,fileinfo,_), ps) = FI_GetFileInfo proc mdn abccache fileinfo ps
| not gen
= start_code_generators rest busy_processes fileinfo abccache ps
# module_name = GetModuleName mdn
# module_name = mdn.mdn_name
# ps = showInfo (Level2 (
(foldl (+++) ("Generating code for "+++ module_name)
[" "+++wcgp_module_name \\ {wcgp_module_name}<-busy_processes])
......@@ -756,13 +749,13 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
= start_code_generator cgen updateErrorWindow abc_path free_slot timeprofile cgo proc startupdir ps
| not res
= (False,rest,busy_processes,fileinfo,abccache,ps)
# obj_path = MakeObjSystemPathname proc mdn
# abc_path = MakeABCSystemPathname mdn
# new_process = {wcgp_process_n=free_slot,wcgp_process_handle=process_handle,wcgp_scg=scg,wcgp_module_name=module_name,wcgp_obj_path=obj_path,wcgp_abc_path=abc_path}
# obj_path = ModuleDirAndNameToObjSystemPathname proc mdn
# abc_path = ModuleDirAndNameToABCSystemPathname mdn
# new_process = {wcgp_process_n=free_slot,wcgp_process_handle=process_handle,wcgp_scg=scg,wcgp_module_name=module_name,wcgp_obj_path=obj_path}
# busy_processes = [new_process:busy_processes]
= start_code_generators rest busy_processes fileinfo abccache ps
start_code_generators Nil busy_processes fileinfo abccache ps
= (True,Nil,busy_processes,fileinfo,abccache,ps)
start_code_generators [!] busy_processes fileinfo abccache ps
= (True,[!],busy_processes,fileinfo,abccache,ps)
# ds = {ds & fileinfo = fileinfo, abccache = abccache, ok = ok}
= cont (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processes) ds, ps)
......@@ -785,14 +778,14 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
# ps = HandleDCErrors be_verbose errs warns ps
# (ok,full_sys0,_,abcPathsCache) = DC_Search (MakeABCPathname System) abcPathsCache
# full_sys = full_sys0 +++ DirSeparatorString +++ (MakeABCPathname System)
# full_sys` = MakeImpPathname full_sys
# system_mdn = {mdn_dir=full_sys0,mdn_name=System}