Commit 3f65e074 authored by John van Groningen's avatar John van Groningen

If an error occurs during async compilation on windows (with more than one compiler),

wait for the other compilers to finish, before sending quit messages
parent 540b2796
......@@ -124,6 +124,7 @@ GenAsmProjectModule path project setproject ps
= DInit !Bool !Project !MTPContinuation
| DComp !Bool !*DirCache !DriverCompilingInfo !(List String) !DriverStateRecord
| DGene !(List String) !DriverCodeGenerationInfo !DriverStateRecord
| DQuitCompilers !(List String) !DriverCompilingInfo !DriverStateRecord
| DLink !DriverStateRecord
| DDone
......@@ -450,16 +451,6 @@ step intr state=:(DComp force _ (Async _ _) _ _) ps
# (os_error,ps) = ClearCompilerCaches compiler_process_ids ps;
# (paths,ds) = ds!modpaths
= (DGene paths SyncCodeGeneration ds, 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 !*GeneralSt -> (!*DriverState,!*GeneralSt)
start_compilations state=:(DComp force dircache (Async current {max_n_processes,compiler_process_ids,unknown_finished_processors}) (next :! rest) ds) ps
......@@ -531,18 +522,7 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
= (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)
// not ok
# (paths,ds) = ds!modpaths
# ps = app_world_instead_of_ps (QuitCleanCompiler True win_compiler_process_ids) ps;
= (DGene paths SyncCodeGeneration ds, 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])
= (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
......@@ -562,8 +542,7 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
# ds = {ds & ok = ok}
| not ok
#! (paths,ds) = ds!modpaths
# ps = app_world_instead_of_ps (QuitCleanCompiler True win_compiler_process_ids) ps;
= (DGene paths SyncCodeGeneration ds, ps)
= (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
= (state, ps)
......@@ -575,6 +554,19 @@ step intr state=:(DComp force dircache compinfo=:(AsyncWin _ _) rest ds) ps
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
step intr state=:(DQuitCompilers modpaths (AsyncWin current async_win_compiling_info=:{win_compiler_process_ids}) ds) ps
= case (CompilePollCompleted win_compiler_process_ids ps) of
(NoFinishedCompiler, ps)
-> cont (state, ps)
(FinishedCompiler completedSlot exitcode, ps)
# (completed, current) = removeFromCurrent completedSlot current
-> cont (DQuitCompilers modpaths (AsyncWin current async_win_compiling_info) ds, ps)
(UnknownFinishedCompiler,ps)
-> cont (state, ps) // -> doesn't occur on win
step intr (DGene Nil SyncCodeGeneration ds) ps
#! ps = showInfo (Level1 "Linking...") ps
= step intr (DLink ds) ps
......@@ -974,6 +966,16 @@ where
step intr DDone ps
= stop (DDone,ps)
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])
dcl_to_icl_file_name file_name
# s = size file_name;
| s>4 && file_name.[s-4]=='.' && file_name.[s-4]=='.' && file_name.[s-3]=='d' && file_name.[s-2]=='c' && file_name.[s-1]=='l'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment