Commit 38e21d38 authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

mac processor dependencies

parent d0aaaff4
......@@ -23,9 +23,10 @@ import PmFileInfo
import PmDirCache
import interrupt,Platform
from Directory import :: DateTime(..), :: Date`(..), :: Time`(..)
from Directory import :: Date`(..), :: Time`(..)
//from dodebug import trace_n`
import dodebug
trace_n _ g :== g
//--
......@@ -71,7 +72,9 @@ System :== "_system"
// Compile /Check Syntax of the designated module
CompileProjectModule :: !CompileOrCheckSyntax !Pathname !Project !SetMadeProjectFun !*(PSt General) -> *(PSt General)
CompileProjectModule compilerOrCheckSyntax path project setproject ps
#! (_,ps) = ClearCompilerCache ps
# (ccstring,ps) = getCurrentComp ps
# (startupdir,ps) = getStup ps
#! (_,ps) = ClearCompilerCache ccstring startupdir ps
# (syspaths,ps) = getCurrentPaths ps
# prjpaths = PR_GetPaths project
# srcpaths = AppendLists prjpaths syspaths
......@@ -89,7 +92,9 @@ CompileProjectModule compilerOrCheckSyntax path project setproject ps
GenAsmProjectModule :: !.Pathname !Project !SetMadeProjectFun !*(PSt General) -> *(PSt *General)
GenAsmProjectModule path project setproject ps
#! (_,ps) = ClearCompilerCache ps
# (ccstring,ps) = getCurrentComp ps
# (startupdir,ps) = getStup ps
#! (_,ps) = ClearCompilerCache ccstring startupdir ps
# (syspaths,ps) = getCurrentPaths ps
# prjpaths = PR_GetPaths project
# srcpaths = AppendLists prjpaths syspaths
......@@ -123,7 +128,9 @@ BringProjectUptoDate force continuation ps
# ps = PrecompileFase project ps
# ps = showInfo (Level1 "Bring up to date...") ps
#! (_,ps) = ClearCompilerCache ps
# (ccstring,ps) = getCurrentComp ps
# (startupdir,ps) = getStup ps
#! (_,ps) = ClearCompilerCache ccstring startupdir ps
#! (intr_info,ps) = getInterrupt ps
// (interact,ps) = getInteract ps
......@@ -152,7 +159,9 @@ where
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
# (_,ps) = ClearCompilerCache ps
# (ccstring,ps) = getCurrentComp ps
# (startupdir,ps) = getStup ps
#! (_,ps) = ClearCompilerCache ccstring startupdir ps
= MakeTheProject False fileinfo libsinfo abccache project cleanup` ps
# ps = PostlinkFase project ps
......@@ -203,21 +212,11 @@ MakeTheProject force fileinfo libsinfo abccache project continue ps
# (method,ps) = getCurrentMeth ps
# compinfo = case method of
CompileSync -> Sync
// (CompileAsync cmax) -> PlatformDependant
// (AsyncWin cmax []) // win
// (Async [] cmax 0 NoUnknownFinishedProcessors) // mac
(CompileAsync cmax) -> PlatformDependant
(AsyncWin cmax []) // win
(Async [] cmax 0 NoUnknownFinishedProcessors) // mac
CompilePers -> Pers InitCompilingInfo
# ds =
{ project = project
, continue = continue
, fileinfo = fileinfo
, abccache = abccache
, libsinfo = libsinfo
, ok = True
, newpaths = False
, modpaths = inidone
}
= step False (DComp force dircache compinfo rest ds) ps
= step False (DComp force inidone compinfo rest fileinfo dircache abccache libsinfo project False continue) ps
where
check_exists [] ps = (Nothing,ps)
check_exists [file:rest] ps
......@@ -247,123 +246,178 @@ stop (ls,ps)
step :: !Bool !*DriverState !*(PSt General) -> (!*DriverState,!*(PSt General))
step intr (DInit force project setproject) ps
// # ps = showInfo (Level1 "Make the project...") ps
# ps = showInfo (Level1 "Make the project...") ps
# libsinfo = PR_GetStaticLibsInfo project
# (abccache,ps) = getABCCache ps
# (fileinfo,ps) = getFICache` ps
= MakeTheProject force fileinfo libsinfo abccache project setproject ps
step True (DComp force dircache (Pers inf) rest ds) ps
# ds = {ds & ok = False}
# (paths,ds) = ds!modpaths
step True (DComp force done (Pers inf) rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
// compile phase finished: kill clean compiler
# (_,ps) = ExitCleanCompiler (inf,ps)
= step True (DGene paths SyncCodeGeneration ds) ps
= step True (DGene False newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject) ps
step True (DComp force dircache compinfo rest ds) ps
step True (DComp force done compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
// need async cocl shootdown as well..
# ds = {ds & ok = False}
# (paths,ds) = ds!modpaths
= step True (DGene paths SyncCodeGeneration ds) ps
= step True (DGene False newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject) ps
step intr (DComp force dircache Sync Nil ds) ps
step intr (DComp force done Sync Nil fileinfo dircache abccache libsinfo project newpaths setproject) ps
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
# project = PR_SetBuilt done project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod 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 (DGene True newpaths fileinfo libsinfo modpaths modpaths SyncCodeGeneration abccache project setproject) ps
step intr (DComp force dircache Sync (next :! rest) ds) ps
step intr (DComp force done compinfo=:Sync (next :! rest) fileinfo dircache abccache libsinfo project newpaths setproject) ps
// compile phase: check module 'next'
| StringOccurs next ds.modpaths
| StringOccurs next done
// if already done then skip
= step intr (DComp force dircache Sync rest ds) ps
= step intr (DComp force done compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# modname = GetModuleName next
| isProjLibraryModule modname 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,_)
= UpdateDependencies force next rest Sync dircache ds ps
# ds = {ds & newpaths = ds.newpaths || newpaths`, ok = ok}
| isProjLibraryModule modname libsinfo
// kan ipv dit hier te testen deze ook meteen in done zetten?! ruzie met rest admi...
= step intr (DComp force done compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# (ps,fileinfo,dircache,abccache,project,ok,newpaths`,rest,compinfo,done,_)
= UpdateDependencies force next done rest compinfo fileinfo dircache abccache libsinfo project ps
# newpaths = newpaths || newpaths`
| not ok
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
# ds = {ds & modpaths = next :! ds.modpaths}
= cont (DComp force dircache compinfo rest ds,ps)
//XXX = step intr (DGene ok newpaths fileinfo libsinfo done done abccache project setproject) ps
= step intr (DGene ok newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject) ps
= cont (DComp force (next :! done) compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject,ps)
step intr (DComp force dircache (Pers inf) Nil ds) ps
step intr (DComp force done (Pers inf) Nil fileinfo dircache abccache libsinfo project newpaths setproject) 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
# project = PR_SetBuilt done project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# ds = {ds & modpaths = modpaths, project = project}
# ps = showInfo (Level1 "Generating...") ps
//XXX = step intr (DGene True newpaths fileinfo libsinfo modpaths modpaths abccache project setproject) ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
= step intr (DGene True newpaths fileinfo libsinfo modpaths modpaths SyncCodeGeneration abccache project setproject) ps
step intr (DComp force dircache compinfo=:(Pers _) (next :! rest) ds) ps
step intr (DComp force done compinfo=:(Pers inf) (next :! rest) fileinfo dircache abccache libsinfo project newpaths setproject) ps
// compile phase: check module 'next'
# ps = trace_n ("comp step",next) ps
| StringOccurs next ds.modpaths
| StringOccurs next done
// if already done then skip
= step intr (DComp force dircache compinfo rest ds) ps
= step intr (DComp force done compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= step intr (DComp force dircache Sync rest ds) ps
# ps = trace_n ("update",next) ps
# (ps,dircache,ok,newpaths`,rest,compinfo,ds,_)
= UpdateDependencies force next rest compinfo dircache ds ps
# ds = {ds & newpaths = ds.newpaths || newpaths`, ok = ok}
| isProjLibraryModule modname libsinfo
// kan ipv dit hier te testen deze ook meteen in done zetten?! ruzie met rest admi...
= step intr (DComp force done compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# (ps,fileinfo,dircache,abccache,project,ok,newpaths`,rest,compinfo,done,_)
= UpdateDependencies force next done rest compinfo fileinfo dircache abccache libsinfo project ps
# newpaths = newpaths || newpaths`
| not ok
# (Pers inf) = compinfo
# (_,ps) = trace_n "exit compiler!" ExitCleanCompiler (inf,ps)
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
# ds = {ds & modpaths = next :! ds.modpaths}
= cont (DComp force dircache compinfo rest ds,ps)
/*
step intr (DComp force dircache (Async [] max_n_processes n_used_processors NoUnknownFinishedProcessors) Nil 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
# ds = {ds & modpaths = modpaths, project = project}
# (os_error,ps) = ClearCompilerCaches n_used_processors ps;
# ps = showInfo (Level1 "Generating...") ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths (ASyncCodeGeneration [] max_n_processes NoUnknownFinishedProcessors) ds) ps
step intr (DComp force dircache (AsyncWin _ []) Nil ds) ps
//XXX = step intr (DGene ok newpaths fileinfo libsinfo done done abccache project setproject) ps
= step intr (DGene ok newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject) ps
= cont (DComp force (next :! done) compinfo rest fileinfo dircache abccache libsinfo project newpaths setproject,ps)
/* DEBUG...
step intr (DComp force done current todo fileinfo dircache abccache libsinfo project newpaths setproject) ps
# ((abccache,fileinfo,modinfo),ps)= FI_GetFileInfo CurrentProcessor "C:\\Clean\\StdEnv\\StdTuple.icl" abccache fileinfo ps
# ps = showInfo (Level3 ["step <>"+++toString modinfo.abcdate+++" <-> "+++toString modinfo.objdate]) ps // DEBUG
# state = (DComp force done current todo fileinfo dircache abccache libsinfo project newpaths setproject)
...DEBUG */
//XXX step intr state=:(DComp force done (Async _ []) Nil fileinfo _ abccache libsinfo project newpaths setproject) ps
step intr (DComp force done (Async [] max_n_processes n_used_processors NoUnknownFinishedProcessors) Nil fileinfo dircache abccache libsinfo project newpaths setproject) ps
// compile phase finished: remove all modules not (indirectly) imported by main module
# project = PR_SetBuilt ds.modpaths ds.project // removes unused modules
// (DComp force done (Async cmax current) todo fileinfo dircache abccache libsinfo project newpaths setproject)
// # state = (DGene ok newpaths fileinfo libsinfo done done abccache project setproject, ps)
// = cont (state, ps)
# project = PR_SetBuilt done project // removes unused modules
# (modpaths,project) = PR_GetModulenames True IclMod project
# ds = {ds & modpaths = modpaths, project = project}
// # (os_error,ps) = ClearCompilerCaches n_used_processors ps;
//YYY
# (os_error,ps) = ClearCompilerCaches n_used_processors ps;
# ps = showInfo (Level1 "Generating...") ps
# (paths,ds) = ds!modpaths
= step intr (DGene paths SyncCodeGeneration ds) ps
//XXX = step intr (DGene True newpaths fileinfo libsinfo modpaths modpaths abccache project setproject) ps
= step intr (DGene True newpaths fileinfo libsinfo modpaths modpaths (ASyncCodeGeneration [] max_n_processes NoUnknownFinishedProcessors) abccache project setproject) ps
step intr state=:(DComp force dircache compinfo=:(Async _ _ _ _) rest ds) ps
//XXX step intr state=:(DComp force _ (Async _ _) _ fileinfo _ _ _ _ _ _) ps
step intr state=:(DComp force _ (Async _ _ _ _) _ fileinfo _ _ _ _ _ _) ps
# ps = traceInfo (Level3 ["check_completed..."]) ps
# (state, ps) = check_completed state ps
# ps = traceInfo (Level3 ["start_compilations..."]) ps
# (state, ps) = start_compilations state ps
= cont (state, ps)
where
/*XXX
check_completed :: !*DriverState !*(PSt General) -> !(!*DriverState,!*PSt General)
check_completed state=:(DComp _ _ (Async current=:[_:_] cmax _ _) _ _) ps
check_completed state=:(DComp force _ (Async cmax current=:[_:_]) _ _ _ _ _ _ _ _) ps
= case (CompilePollCompleted ps) of
(Nothing, ps)
-> (state, ps)
(Just (completedSlot,exitcode), ps)
#! (state,ps) = process_completed completedSlot exitcode state ps
-> check_completed state ps
check_completed state ps
= (state, ps)
process_completed :: !Int !Int !*DriverState !*(PSt General) -> !(!*DriverState,!*PSt General)
process_completed completedSlot exitcode (DComp force done (Async cmax current) todo fileinfo dircache abccache libsinfo project newpaths setproject) ps
# (completed, current) = removeFromCurrent completedSlot current
# (startupdir,ps) = getStup ps
typewin = updateTypeWindow (GetModuleName completed.iclModule) [typeWinKeyboard, typeWinMouse]
# ccstring = "dummy ccstring for now.."
# (ps,abcpath,res) = CompileHandleExitCode exitcode ccstring startupdir completedSlot updateErrorWindow typewin
completed.iclModule completed.options.listTypes ps // types param
# (ps,fileinfo,dircache,abccache,project,ok,newpaths`,_,deps)
= ProcessCompilerMsg Compilation completed.options completed.iclModule abcpath res fileinfo dircache abccache project ps
# newpaths = newpaths || newpaths`
| ok
= (DComp force (completed.iclModule :! done) (Async cmax current) (Concat deps todo) fileinfo dircache abccache libsinfo project newpaths setproject, ps)
// not ok
= (DGene ok newpaths fileinfo libsinfo done done abccache project setproject, ps)
where
removeFromCurrent :: Int [CurrentlyCompiled] -> (CurrentlyCompiled, [CurrentlyCompiled])
removeFromCurrent _ []
= abort "driver.icl: unknown threadId"
removeFromCurrent completedSlot [current=:{slot} : rest]
| completedSlot == slot
= (current, rest)
// otherwise
# (completed, rest) = removeFromCurrent completedSlot rest
= (completed, [current : rest])
start_compilations :: !*DriverState !*(PSt General) -> (!*DriverState,!*PSt General)
start_compilations state=:(DComp force done (Async cmax current) (next :! rest) fileinfo dircache abccache libsinfo project newpaths setproject) ps
// # (prefs,ps) = getPrefs ps
// | length current >= prefs.number_of_processes
| length current >= cmax
# ps = traceInfo (Level3 ["start_compilations druk druk druk..." : [c.iclModule +++ " " +++ toString c.slot \\ c <- current]]) ps
= (state, ps)
// compile phase: check module 'next'
| StringOccurs next done || currently_compiled next current
# ps = traceInfo (Level3 ["start_compilations " +++ (if (StringOccurs next done) "al gedaan: " "mee bezig: ") +++ next]) ps
= start_compilations (DComp force done (Async cmax current) rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# modname = GetModuleName next
# ps = traceInfo (Level3 [("start_compilations next... "
+++ toString (LLength done)+++ " "
+++ toString (length current)+++ " "
+++ toString (LLength rest))]) ps
| isProjLibraryModule modname libsinfo
// kan ipv dit hier te testen deze ook meteen in done zetten!
= (DComp force done (Async cmax current) rest fileinfo dircache abccache libsinfo project newpaths setproject, ps)
# (ps,fileinfo,dircache,abccache,project,ok,_,rest,current,done,_)
= UpdateDependencies force next done rest (Async cmax current) fileinfo dircache abccache libsinfo project ps
| not ok
= (DGene ok newpaths fileinfo libsinfo done done abccache project setproject, ps)
= start_compilations (DComp force done current rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
start_compilations state ps
# ps = traceInfo (Level3 ["start_compilations no next..."]) ps
= (state, ps)
*/
check_completed :: !*DriverState !*(PSt General) -> (!*DriverState,!*PSt General)
check_completed state=:(DComp force _ (Async current=:[_:_] cmax _ _) _ _ _ _ _ _ _ _) ps
= case (CompilePollCompleted ps) of
(NoFinishedCompiler,ps)
-> check_unknow_processors_are_known state ps
(UnknownFinishedCompiler,ps)
-> case state of
DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) todo ds
DComp force done (Async current cmax n_used_processors unknown_finished_processors) todo fileinfo dircache abccache libsinfo project newpaths setproject
# unknown_finished_processors = add_unknown_finished_processor unknown_finished_processors
# state = DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) todo ds
# state = DComp force done (Async current cmax n_used_processors unknown_finished_processors) todo fileinfo dircache abccache libsinfo project newpaths setproject
-> check_completed state ps
(FinishedCompiler completedSlot exitcode,ps)
# ps = traceInfo (Level3 ["process_completed...",toString completedSlot,toString exitcode]) ps
......@@ -372,9 +426,9 @@ step intr state=:(DComp force dircache compinfo=:(Async _ _ _ _) rest ds) ps
check_completed state ps
= check_unknow_processors_are_known state ps
check_unknow_processors_are_known (DComp force dircache (Async current cmax n_used_processors (UnknownFinishedProcessors n_unknown_finished_processors known_finished_processors)) todo ds) ps
check_unknow_processors_are_known (DComp force done (Async current cmax n_used_processors (UnknownFinishedProcessors n_unknown_finished_processors known_finished_processors)) todo fileinfo dircache abccache libsinfo project newpaths setproject) ps
| n_unknown_finished_processors+length known_finished_processors>=cmax
# state = DComp force dircache (Async current cmax n_used_processors NoUnknownFinishedProcessors) todo ds
# state = DComp force done (Async current cmax n_used_processors NoUnknownFinishedProcessors) todo fileinfo dircache abccache libsinfo project newpaths setproject
# (state,ps) = handle_completed_processes 0 state ps
with
handle_completed_processes process_n state ps
......@@ -393,25 +447,23 @@ step intr state=:(DComp force dircache compinfo=:(Async _ _ _ _) rest ds) ps
check_unknow_processors_are_known state ps
= (state, ps)
process_completed :: !Int !Int !*DriverState !*(PSt General) -> !(!*DriverState,!*PSt General)
process_completed completedSlot exitcode (DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) todo ds) ps
# (completed, current) = removeFromCurrent completedSlot current
# unknown_finished_processors = remove_from_unknown_finished_processors completedSlot unknown_finished_processors
# (startupdir,ps) = getStup ps
typewin = updateTypeWindow (GetModuleName completed.iclModule) [typeWinKeyboard, typeWinMouse]
# ccstring = "dummy ccstring for now.."
# (ps,abcpath,res) = CompileHandleExitCode exitcode ccstring startupdir completedSlot updateErrorWindow typewin
completed.iclModule completed.options.listTypes ps // types param
process_completed :: !Int !Int !*DriverState !*(PSt General) -> (!*DriverState,!*PSt General)
process_completed completedSlot exitcode (DComp force done (Async current cmax n_used_processors unknown_finished_processors) todo fileinfo dircache abccache libsinfo project newpaths setproject) ps
# (completed, current) = removeFromCurrent completedSlot current
# unknown_finished_processors = remove_from_unknown_finished_processors completedSlot unknown_finished_processors
# (startupdir,ps) = getStup ps
typewin = updateTypeWindow True (GetModuleName completed.iclModule) [typeWinKeyboard, typeWinMouse]
# ccstring = "dummy ccstring for now.."
# (ps,abcpath,res) = CompileHandleExitCode exitcode ccstring startupdir completedSlot updateErrorWindow typewin
completed.iclModule completed.options.listTypes ps // types param
# (ps,fileinfo,dircache,abccache,project,ok,newpaths`,_,deps)
= ProcessCompilerMsg 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}
= ProcessCompilerMsg Compilation completed.options completed.iclModule abcpath res fileinfo dircache abccache project ps
# newpaths = newpaths || newpaths`
| ok
# ds = {ds & modpaths = completed.iclModule :! ds.modpaths}
= (DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) (Concat deps todo) ds, ps)
= (DComp force (completed.iclModule :! done) (Async current cmax n_used_processors unknown_finished_processors) (Concat deps todo) fileinfo dircache abccache libsinfo project newpaths setproject, ps)
// not ok
# (os_error,ps) = ClearCompilerCaches n_used_processors ps;
# (paths,ds) = ds!modpaths
= (DGene paths SyncCodeGeneration ds, ps)
= (DGene ok newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject, ps)
where
removeFromCurrent :: Int [CurrentlyCompiled] -> (CurrentlyCompiled, [CurrentlyCompiled])
removeFromCurrent _ []
......@@ -424,25 +476,22 @@ step intr state=:(DComp force dircache compinfo=:(Async _ _ _ _) rest ds) ps
= (completed, [current : rest])
start_compilations :: !*DriverState !*(PSt General) -> (!*DriverState,!*PSt General)
start_compilations state=:(DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) (next :! rest) ds) ps
// all threads used?
start_compilations state=:(DComp force done (Async current cmax n_used_processors unknown_finished_processors) (next :! rest) fileinfo dircache abccache libsinfo project newpaths setproject) ps
| length current >= cmax
= (state, ps)
// compile phase: check module 'next'
| StringOccurs next ds.modpaths || currently_compiled next current
= start_compilations (DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) rest ds) ps
// compile phase: check module 'next'
| StringOccurs next done || currently_compiled next current
= start_compilations (DComp force done (Async current cmax n_used_processors unknown_finished_processors) rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
# modname = GetModuleName next
| isProjLibraryModule modname ds.libsinfo
// instead of testing explicitly put libmodules in done <= conflicts with other administration
= (DComp force dircache (Async current cmax n_used_processors unknown_finished_processors) rest ds, ps)
# (ps,dircache,ok,_,rest,compinfo,ds,_)
= UpdateDependencies force next rest (Async current cmax n_used_processors unknown_finished_processors) dircache ds ps
# ds = {ds & ok = ok}
| isProjLibraryModule modname libsinfo
// kan ipv dit hier te testen deze ook meteen in done zetten!
= (DComp force done (Async current cmax n_used_processors unknown_finished_processors) rest fileinfo dircache abccache libsinfo project newpaths setproject, ps)
# (ps,fileinfo,dircache,abccache,project,ok,_,rest,current,done,_)
= UpdateDependencies force next done rest (Async current cmax n_used_processors unknown_finished_processors) fileinfo dircache abccache libsinfo project ps
| not ok
# (os_error,ps) = ClearCompilerCaches n_used_processors ps;
#! (paths,ds) = ds!modpaths
= (DGene paths SyncCodeGeneration ds, ps)
= start_compilations (DComp force dircache compinfo rest ds) ps
= (DGene ok newpaths fileinfo libsinfo done done SyncCodeGeneration abccache project setproject, ps)
= start_compilations (DComp force done current rest fileinfo dircache abccache libsinfo project newpaths setproject) ps
start_compilations state ps
// # ps = traceInfo (Level3 ["start_compilations no next..."]) ps
= (state, ps)
......@@ -451,6 +500,7 @@ step intr state=:(DComp force dircache compinfo=:(Async _ _ _ _) rest ds) ps
currently_compiled next current
= or [c.iclModule == next \\ c <- current]
/*XXX
step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
# ps = traceInfo (Level3 ["check_completed..."]) ps
# (state, ps) = check_completed state ps
......@@ -459,7 +509,7 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
= cont (state, ps)
where
check_completed :: !*DriverState !*(PSt General) -> !(!*DriverState,!*PSt General)
check_completed state=:(DComp _ _ (AsyncWin cmax current=:[_:_]) _ _) ps
check_completed state=:(DComp force _ _ (AsyncWin cmax current=:[_:_]) _ _) ps
= case (CompilePollCompleted ps) of
(NoFinishedCompiler, ps)
-> (state, ps)
......@@ -524,28 +574,25 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
currently_compiled next current
= or [c.iclModule == next \\ c <- current]
*/
step intr (DGene Nil SyncCodeGeneration ds) ps
step intr (DGene ok newpaths fileinfo libsinfo Nil modpaths SyncCodeGeneration abccache project setproject) ps
#! ps = showInfo (Level1 "Linking...") ps
= step intr (DLink ds) ps
/*
step intr (DGene Nil (ASyncCodeGeneration [] _ NoUnknownFinishedProcessors) ds) ps
= step intr (DLink ok newpaths fileinfo libsinfo modpaths abccache project setproject) ps
step intr (DGene ok newpaths fileinfo libsinfo Nil modpaths (ASyncCodeGeneration [] _ NoUnknownFinishedProcessors) abccache project setproject) ps
#! ps = showInfo (Level1 "Linking...") ps
= step intr (DLink ds) ps
*/
step intr (DGene (path:!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
# ds = {ds & abccache = abccache, fileinfo = fileinfo, project = project, ok = ok}
= step intr (DLink ok newpaths fileinfo libsinfo modpaths abccache project setproject) ps
step intr (DGene ok newpaths fileinfo libsinfo (path:!rest) modpaths SyncCodeGeneration abccache project setproject) ps
| not ok || intr
= step intr (DLink False newpaths fileinfo libsinfo modpaths abccache project setproject) ps
# (ps,abccache,fileinfo,gen,abcpath) = CheckABCOutOfDate False path abccache fileinfo project ps
# (ps,abccache,fileinfo,project,ok,_) = GenCodeTheProjectModule gen False CodeGeneration abcpath abccache fileinfo project ps
| not ok
= step intr (DLink ds) ps
= cont (DGene rest SyncCodeGeneration ds, ps)
/*
step intr (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) ds) ps
# (ok,busy_processes,unknown_finished_processors,project,fileinfo,ps)
= handle_finished_code_generators busy_processes unknown_finished_processors ds.project ds.fileinfo ps
= step intr (DLink ok newpaths fileinfo libsinfo modpaths abccache project setproject) ps
= cont (DGene True newpaths fileinfo libsinfo rest modpaths SyncCodeGeneration abccache project setproject, ps)
step intr (DGene no_errors newpaths fileinfo libsinfo paths modpaths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) abccache project setproject) ps
# (ok,busy_processes,unknown_finished_processors,project,fileinfo,ps) = handle_finished_code_generators busy_processes unknown_finished_processors project fileinfo ps
with
handle_finished_code_generators busy_processes=:[_:_] unknown_finished_processors project fileinfo ps
= case (CompilePollCompleted ps) of
......@@ -559,14 +606,14 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unkno
// # 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 busy_processes
# (abc_path,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 [busy_process=:(slot,abc_path,obj_path) : rest]
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 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 []
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
......@@ -588,14 +635,14 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unkno
# (_,ps) = SendRepeatResult process_n 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 busy_processes
# (abc_path,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 [busy_process=:(slot,abc_path,obj_path) : rest]
get_paths_and_remove_process_from_list finished_cg_slot_n [busy_process=:(slot,abc_path,obj_path) : rest]
| process_n==slot
= (abc_path,obj_path,rest)
# (abc_path,obj_path,rest) = get_paths_and_remove_process_from_list 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 []
get_paths_and_remove_process_from_list finished_cg_slot_n []
= abort "driver.icl: unknown code generator id"
# (fileinfo,ps) = accFiles (FI_UpdateObjDate abc_path obj_path fileinfo) ps
# project = PR_SetCodeGenerated (GetModuleName abc_path) project
......@@ -604,24 +651,22 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unkno
= (True,busy_processes,NoUnknownFinishedProcessors,project,fileinfo,ps)
check_unknow_processors_are_known busy_processes unknown_finished_processors project fileinfo ps
= (True,busy_processes,unknown_finished_processors,project,fileinfo,ps)
# ds = {ds & fileinfo = fileinfo, project = project, ok = ds.ok && ok && not intr}
| not ds.ok
= cont (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) ds,ps)
| not no_errors || intr || not ok
= cont (DGene False newpaths fileinfo libsinfo paths modpaths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) abccache project setproject,ps)
| length busy_processes>=max_n_processes || (case paths of Nil -> True ; _ -> False)
= cont (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) ds,ps)
# (ok,paths,busy_processes,fileinfo,abccache,ps) = start_code_generators paths busy_processes ds.fileinfo ds.abccache ps
= cont (DGene ok newpaths fileinfo libsinfo paths modpaths (ASyncCodeGeneration busy_processes max_n_processes unknown_finished_processors) abccache project setproject,ps)
# (ok,paths,busy_processes,fileinfo,abccache,ps) = start_code_generators paths busy_processes fileinfo abccache ps
with
start_code_generators paths=:(path :! rest) busy_processes fileinfo abccache ps
| length busy_processes>=max_n_processes
= (True,paths,busy_processes,fileinfo,abccache,ps)
# (ps,abccache,fileinfo,gen,abc_path)
= CheckABCOutOfDate False path abccache fileinfo project ps
# cgo = PR_GetCodeGenOptions project
# ((abccache,fileinfo,info), ps)
= FI_GetFileInfo cgo.tp abc_path abccache fileinfo ps
# (ps,abccache,fileinfo,gen,abc_path) = CheckABCOutOfDate False path abccache fileinfo project ps
# cgo = PR_GetCodeGenOptions project
# ((abccache,fileinfo,info), ps) = FI_GetFileInfo cgo.tp abc_path abccache fileinfo ps
| not gen
= start_code_generators rest busy_processes fileinfo abccache ps
# ps = showInfo (Level2 (
# ps = showInfo (Level2 (
// "Generating code for " +++ RemovePath abc_path
(foldl (+++) ("Generating code for "
+++ RemovePath abc_path) [" "+++RemovePath abc_path \\ (_,abc_path,_)<-busy_processes])
)) ps
......@@ -640,20 +685,19 @@ step intr (DGene paths (ASyncCodeGeneration busy_processes max_n_processes unkno
// # ps = trace ("code generator started "+++toString free_slot+++"\n") ps
// # ps = trace ("s "+++toString free_slot+++" ") ps
# (res,obj_path,ps) = StartCodeGenerator cgen updateErrorWindow CodeGeneration abc_path free_slot tp cgo ao startupdir ps
# (res,obj_path,ps) = StartCodeGenerator cgen updateErrorWindow CodeGeneration abc_path free_slot tp cgo ao startupdir ps
| not res
= (False,rest,busy_processes,fileinfo,abccache,ps)
# busy_processes = [(free_slot,abc_path,obj_path):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)