Commit dc9fa67f authored by John van Groningen's avatar John van Groningen

add CompilerProcessIds parameters, only used for ASync compiling on the Mac

parent 29ec39bb
......@@ -402,7 +402,7 @@ step intr state=:(DComp force _ (Async _ _ _ _) _ _) ps
# (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
# (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
......@@ -644,7 +644,7 @@ 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 timeprofile cgo proc ao startupdir ps
# (res,obj_path,_,ps) = StartCodeGenerator cgen updateErrorWindow CodeGeneration abc_path free_slot timeprofile cgo proc ao startupdir NoCompilerProcessIds ps
| not res
= (False,rest,busy_processes,fileinfo,abccache,ps)
# busy_processes = [(free_slot,abc_path,obj_path):busy_processes]
......@@ -935,7 +935,7 @@ remove_from_unknown_finished_processors completedSlot unknown_finished_processor
:: *DriverCompilingInfo
= Sync
| AsyncWin !Int ![CurrentlyCompiled]
| Async ![CurrentlyCompiled] !Int !Int !UnknownFinishedProcessors // busy_processors max_n_processes n_used_processors unknown_finished_processors
| Async ![CurrentlyCompiled] !Int !CompilerProcessIds !UnknownFinishedProcessors // busy_processors max_n_processes n_used_processors unknown_finished_processors
| Pers !*CompilingInfo
compiling_info :: !DriverCompilingInfo -> (String,DriverCompilingInfo)
......@@ -1122,7 +1122,7 @@ UpdateAsyncDependencies (Async current cmax n_used_processors unknown_finished_p
= CompileTheProjectModuleStart Compilation impname free_slot ds.fileinfo dircache ds.abccache ds.project ps
# ds = {ds & fileinfo = fileinfo, abccache = abccache}
| compileStarted
# n_used_processors = if (free_slot>=n_used_processors) (free_slot+1) n_used_processors
// # n_used_processors = if (free_slot>=n_used_processors) (free_slot+1) n_used_processors
# current = [{iclModule = impname, options = co, slot = free_slot} : current]
# cinf = compiling_info_async current
# ps = showInfo (Level2 cinf) ps
......@@ -1165,7 +1165,7 @@ CompileTheProjectModule outofdate compileOrCheckSyntax path fileinfo dircache ab
= ShowInfoAndCompile compileOrCheckSyntax path fileinfo abccache project ps
| not ok
= (ps,fileinfo,dircache,abccache,project,False,False,"",Nil)
# (ps,abcpath,res) = Compile ccstring write_module_times errwin typwin compileOrCheckSyntax path srcpaths mp tp eod co startupdir ps
# (abcpath,res,_,ps) = Compile ccstring False write_module_times errwin typwin compileOrCheckSyntax path srcpaths mp tp eod co startupdir NoCompilerProcessIds ps
# (_,res) = ProcessCompilerMsg Nothing compileOrCheckSyntax co path abcpath res fileinfo dircache abccache project ps
= res
......@@ -1177,7 +1177,7 @@ CompileTheProjectModuleStart compileOrCheckSyntax path slot fileinfo dircache ab
= CTPMcommon /*compileOrCheckSyntax*/ path mn fileinfo abccache project ps
| not ok
= (False, fileinfo, dircache, abccache, ps)
# (compileStarted,ps) = CompileStartCommand ccstring write_module_times errwin compileOrCheckSyntax path srcpaths slot mp tp eod co startupdir ps
# (compileStarted,_,ps) = CompileStartCommand ccstring write_module_times errwin compileOrCheckSyntax path srcpaths slot mp tp eod co startupdir NoCompilerProcessIds ps
= (compileStarted, fileinfo, dircache, abccache, ps)
PersistentCompile :: !*CompilingInfo !CompileOrCheckSyntax !Pathname !FileInfoCache !*DirCache !*ABCCache !Project !*(PSt *General)
......@@ -1407,7 +1407,7 @@ GenCodeTheProjectModule outofdate sys genAsmOrCode abc_path abccache fileinfo pr
# (startupdir,ps) = getStup ps
# (cgen,ps) = getCurrentCgen ps
# (ps, objpath,res) = CodeGen cgen updateErrorWindow genAsmOrCode abc_path timeprofile cgo proc ao startupdir ps
# (objpath,res,_,ps) = CodeGen cgen False updateErrorWindow genAsmOrCode abc_path timeprofile cgo proc ao startupdir NoCompilerProcessIds ps
| genAsmOrCode == CodeGeneration && res
# (fileinfo,ps) = accFiles (FI_UpdateObjDate abc_path objpath fileinfo) ps
# project = if sys
......
......@@ -13,8 +13,13 @@ standardObjectFiles :: !Bool !Bool !Processor -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
:: CompilerProcessIds
NoCompilerProcessIds :: CompilerProcessIds
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
QuitCleanCompiler :: !*(IOSt .l) -> *(IOSt .l)
ClearCompilerCaches :: !CompilerProcessIds !.a -> (!Int,!.a)
QuitCleanCompiler :: !Bool !CompilerProcessIds !*(IOSt .l) -> *(IOSt .l)
//:: CompileClearCache = ClearCache | Don`tClearCache
//instance == CompileClearCache
......@@ -37,6 +42,7 @@ Compile :: // Compiles the given file:
!String // compiler exe name and options
// !! should be full path so that cocl generates diagnostics in logical place...
// should be quoted if required
!Bool
!Bool // write module times to abc file
!(WindowFun *env) // error display fun
!(WindowFun *env) // types display fun
......@@ -48,20 +54,23 @@ Compile :: // Compiles the given file:
!Bool // project eager or dynamic linking?
!CompilerOptions // compiler options
!Pathname // startup directory
!CompilerProcessIds
!*env // state
->
(!*env, // state
!Pathname // .abc pathname of generated code
(!Pathname // .abc pathname of generated code
// Note: on the macintosh the .abc file is generated in the standard Clean System
// Files Folder. On Unix, however, the location of the .abc depends on the user
// settings.
,!CompilerMsg // indication whether compilation was successfull
,!CompilerProcessIds
,!*env // state
) | FileEnv env
CodeGen :: // Generates code for the given file:
!String // generator exe name and options
// !! should be full path so that cg generates diagnostics in logical place...
// should be quoted if required
!Bool
!(WindowFun *(PSt .l)) // error display fun
!CodeGenerateAsmOrCode // generate assembly only?
!Pathname // full .abc pathname of module to be compiled
......@@ -70,14 +79,16 @@ CodeGen :: // Generates code for the given file:
!Processor // target processor
!ApplicationOptions // application options
!Pathname // startup directory
!CompilerProcessIds
!*(PSt .l) // state
->
( !*(PSt .l) // state
, !Pathname // full pathname of generated object file
( !Pathname // full pathname of generated object file
// Note: on the macintosh the .o file is generated in the standard Clean System
// Files Folder. On Unix, however, the location of the .o depends on the user
// settings.
, !Bool // success status
, !CompilerProcessIds
, !*(PSt .l) // state
)
Link :: // Links the given file:
......@@ -139,10 +150,11 @@ CompileStartCommand ::
!Bool
!CompilerOptions
!Pathname
!CompilerProcessIds
!*env
-> (!Bool, !*env) | FileEnv env
-> (!Bool,!CompilerProcessIds,!*env) | FileEnv env
CompileHandleExitCode :: !Int !String !String !Int !(WindowFun *env) !(WindowFun *env) !Pathname
!ListTypes !*env -> (!*env,!Pathname,!CompilerMsg) | FileEnv env
!ListTypes !*env -> (!Pathname,!CompilerMsg,!*env) | FileEnv env
/* old
CompilePollCompleted :: !*env -> (Maybe !(!Int,!Int), !*env) | FileEnv env
......@@ -175,6 +187,5 @@ CompilePersistent ::
-> (!*CompilingInfo,!(!*env, !Pathname, !CompilerMsg))
| FileEnv env
ClearCompilerCaches :: !Int !.a -> (!Int,!.a)
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !*(PSt .l) -> (!Bool,!Pathname,!*(PSt .l))
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !CompilerProcessIds !*(PSt .l) -> (!Bool,!Pathname,!CompilerProcessIds,!*(PSt .l))
SendRepeatResult :: !Int !.a -> (!Int,!.a)
......@@ -62,15 +62,19 @@ getLib lib files
# slibs = map RemoveSuffix slibs
= (errs,slibs,files)
:: CompilerProcessIds :== [Int] // not used for windows, always []
//--
NoCompilerProcessIds :: CompilerProcessIds
NoCompilerProcessIds = []
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
ClearCompilerCache _ _ ps = (0,ps)
QuitCleanCompiler :: !*(IOSt .l) -> *(IOSt .l)
QuitCleanCompiler io = io
ClearCompilerCaches :: !CompilerProcessIds !.a -> (!Int,!.a)
ClearCompilerCaches _ ps = (0,ps)
QuitCleanCompiler :: !Bool !CompilerProcessIds !*(IOSt .l) -> *(IOSt .l)
QuitCleanCompiler _ _ io = io
ExitCleanCompiler :: !*(!*CompilingInfo,*env) -> *(!*CompilingInfo,*env)
ExitCleanCompiler prog=:(CompilingInfo (CompilerProcess compiler_thread_id compiler_thread_handle compiler_process_handle), ps)
......@@ -137,17 +141,17 @@ where
//-- Synchronous compilation stuff...
Compile ::
!String !Bool !(WindowFun *env) !(WindowFun *env) !CompileOrCheckSyntax !Pathname
!(List Pathname) !Bool !Bool !Bool !CompilerOptions !Pathname !*env
-> (!*env,!Pathname,!CompilerMsg)
!String !Bool !Bool !(WindowFun *env) !(WindowFun *env) !CompileOrCheckSyntax !Pathname
!(List Pathname) !Bool !Bool !Bool !CompilerOptions !Pathname !CompilerProcessIds !*env
-> (!Pathname,!CompilerMsg,!CompilerProcessIds,!*env)
| FileEnv env
Compile
cocl` write_module_times errwin typewin compileOrCheckSyntax path paths projectMemoryProfiling
cocl` use_compiler_process_ids write_module_times errwin typewin compileOrCheckSyntax path paths projectMemoryProfiling
projectTimeProfiling projectEagerOrDynamic co=:{CompilerOptions | listTypes}
startupdir ps
startupdir compiler_process_ids ps
| not cocl_ok
# ps = errwin [cocl] ps
= (ps,"",SyntaxError)
= ("",SyntaxError,compiler_process_ids,ps)
# out_file_name = out_file_path tooltempdir dummy_slot
errors_file_name = errors_file_path tooltempdir dummy_slot
# command = cocl +++ write_module_times_string +++ CompileBuildCommand
......@@ -157,8 +161,9 @@ Compile
diditall = if (os4 == 99) didit didit
| not diditall
# ps = errwin (["Error: Unable to run compiler: "+++cocl +++ " :"+++toString exitcode]) ps
= (ps,"",SyntaxError)
= CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes ps
= ("",SyntaxError,compiler_process_ids,ps)
# (path,mess,env) = CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes ps
= (path,mess,compiler_process_ids,env)
where
dummy_slot = 0
write_module_times_string = if write_module_times " -wmt " " "
......@@ -194,12 +199,12 @@ mangleCompiler2 ccstring` startupdir
:== Int
CompileStartCommand :: !String !Bool !(WindowFun *env) !CompileOrCheckSyntax !Pathname !(List Pathname) !Int !Bool !Bool !Bool
!CompilerOptions !Pathname !*env -> (!Bool, !*env) | FileEnv env
!CompilerOptions !Pathname !CompilerProcessIds !*env -> (!Bool,!CompilerProcessIds,!*env) | FileEnv env
CompileStartCommand cocl` write_module_times errwin compileOrCheckSyntax path paths slot projectMemoryProfiling projectTimeProfiling projectEagerOrDynamic
co startupdir ps
co startupdir compiler_process_ids ps
| not cocl_ok
# ps = errwin [cocl] ps
= (False,ps)
= (False,compiler_process_ids,ps)
# out_file_name = out_file_path tooltempdir slot
errors_file_name = errors_file_path tooltempdir slot
# command
......@@ -208,9 +213,9 @@ CompileStartCommand cocl` write_module_times errwin compileOrCheckSyntax path pa
(didit, os4) = AsyncCallProcess (command +++ "\0") slot 99
diditall = if (os4 == 99) didit didit
| not diditall
= (False, errwin ["Error: Unable to run compiler: "+++cocl] ps)
= (False,compiler_process_ids,errwin ["Error: Unable to run compiler: "+++cocl] ps)
// otherwise
= (True, ps)
= (True,compiler_process_ids,ps)
where
write_module_times_string = if write_module_times " -wmt " " "
(cocl_ok,cocl,cocldir) = mangleCompiler cocl` startupdir // platform dependant mangling...
......@@ -255,7 +260,7 @@ CompilePersistent
| not compile_ok
# env = errwin ["Error: Unable to run compiler: "+++cocl +++ " :"+++toString exitcode] env
= (cstate,(env,"",SyntaxError))
# (env,path,mess) = CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes env
# (path,mess,env) = CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes env
= (cstate,(env,path,mess))
where
dummy_slot = 0
......@@ -279,7 +284,7 @@ CompileBuildCommand out_file_name errors_file_name compileOrCheckSyntax path pat
+++ " -RO "+++ quoted_string out_file_name;
CompileHandleExitCode :: !Int !String !String !Int !(WindowFun *env) !(WindowFun *env) !Pathname
!ListTypes !*env -> (!*env,!Pathname,!CompilerMsg) | FileEnv env
!ListTypes !*env -> (!Pathname,!CompilerMsg,!*env) | FileEnv env
CompileHandleExitCode exitcode cocl tooltempdir slot errwin typewin path
listTypes ps
# out_file_name = out_file_path tooltempdir 0
......@@ -289,11 +294,11 @@ CompileHandleExitCode exitcode cocl tooltempdir slot errwin typewin path
((errors,errors_and_messages_not_empty,errors_and_messages),ps)
= accFiles (ReadErrorsAndWarnings errors_file_name) ps
| exitcode <> 0 && not errors_and_messages_not_empty = // werkt dit ook voor persistent versie?
( errwin ( [ "Error: Compiler crashed: "+++cocl
( ""
, SyntaxError
, errwin ( [ "Error: Compiler crashed: "+++cocl
: if (errors == CompilerOK) ["Unable to open Errors file"] []
]) ps
, ""
,SyntaxError
)
# abcpath = MakeABCSystemPathname path
ps = (if type_text_not_empty (typewin (StrictListToList type_text)) id) ps
......@@ -301,7 +306,7 @@ CompileHandleExitCode exitcode cocl tooltempdir slot errwin typewin path
errors = case exitcode of
0 -> CompilerOK
_ -> errors
= (ps,abcpath,errors)
= (abcpath,errors,ps)
out_file_path :: String Int -> String
out_file_path tooltempdir slot
......@@ -468,14 +473,14 @@ where
= escape_specials (i+2) (string % (0,i-1)+++"\\"+++string % (i,dec (size string)))
= escape_specials (inc i) string
CodeGen :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Bool
!CodeGenOptions !Processor !ApplicationOptions !Pathname !*(PSt .l)
-> (!*(PSt .l), !Pathname, !Bool)
CodeGen cgen` wf genAsmOrCode path timeprofile cgo tp ao startupdir ps
CodeGen :: !String !Bool !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Bool
!CodeGenOptions !Processor !ApplicationOptions !Pathname !CompilerProcessIds !*(PSt .l)
-> (!Pathname,!Bool,!CompilerProcessIds,!*(PSt .l))
CodeGen cgen` used_compiler_process_ids wf genAsmOrCode path timeprofile cgo tp ao startupdir compiler_process_ids ps
# (cgen_ok,cgen,cgendir) = mangleGenerator cgen` startupdir
| not cgen_ok
# ps = wf [cgen] ps
= (ps, "", False)
= ("",False,compiler_process_ids,ps)
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
......@@ -486,12 +491,10 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo tp ao startupdir ps
errorsfilename = tooltempdir +++ toString dirseparator +++ "errors"
(didit,exit_code,_) = trace_n errorsfilename CallProcess command [] cgendir "" "" errorsfilename 99
| not didit
= ( wf ( [ "Error: Unable to run code generator: "+++cgen
// , command
// , startupdir
]) ps
, objpath
, False
= (objpath,False,compiler_process_ids,wf [ "Error: Unable to run code generator: "+++cgen
// , command
// , startupdir
] ps
)
# ((_, errors_not_empty, error_text),ps) = accFiles (ReadErrorsAndWarnings errorsfilename) ps
ps = (if errors_not_empty
......@@ -501,7 +504,7 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo tp ao startupdir ps
id
)
) ps
= (ps,objpath,exit_code==0)
= (objpath,exit_code==0,compiler_process_ids,ps)
mangleGenerator cgen` startupdir
# (cgen`,opts) = splitOptions cgen`
......@@ -766,11 +769,8 @@ compile_with_cache2 path directory arguments compiler_thread_id compiler_thread_
= trace_n ("E") (False,s)
= (True,s)
ClearCompilerCaches :: !Int !.a -> (!Int,!.a)
ClearCompilerCaches _ _ = undef
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !*(PSt .l) -> (!Bool,!Pathname,!*(PSt .l))
StartCodeGenerator _ _ _ _ _ _ _ _ _ _ _ = undef
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !CompilerProcessIds !*(PSt .l) -> (!Bool,!Pathname,!CompilerProcessIds,!*(PSt .l))
StartCodeGenerator _ _ _ _ _ _ _ _ _ _ _ _ = undef
SendRepeatResult :: !Int !.a -> (!Int,!.a)
SendRepeatResult _ _ = undef
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