Skip to content

Commit

Permalink
Fixes for ticket:3955
Browse files Browse the repository at this point in the history
- enable GC parallel marking in Windows (Makefile.omdev.mingw)
- enable parallel parsing in Windows (Compiler/FrontEnd/ClassLoader.mo)
- give parallel parsing thread 2MB stack (Compiler/runtime/System_omc.c)
  • Loading branch information
adrpo authored and OpenModelica-Hudson committed Jun 8, 2016
1 parent f5d4c26 commit f45c1dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/ClassLoader.mo
Expand Up @@ -201,10 +201,11 @@ algorithm
encodingfile = stringAppendList({path,pd,name,pd,"package.encoding"});
encoding = System.trimChar(System.trimChar(if System.regularFileExists(encodingfile) then System.readFile(encodingfile) else Util.getOptionOrDefault(optEncoding,"UTF-8"),"\n")," ");

if Config.getRunningTestsuiteFile()<>"" or Config.noProc()==1 or (System.os() == "Windows_NT") then
if Config.getRunningTestsuiteFile()<>"" or Config.noProc()==1 then
strategy = STRATEGY_ON_DEMAND(encoding);
else
filenames = getAllFilesFromDirectory(path + pd + name);
// print("Files load in parallel:\n" + stringDelimitList(filenames, "\n") + "\n");
strategy = STRATEGY_HASHTABLE(Parser.parallelParseFiles(filenames, encoding));
end if;
cl = loadCompletePackageFromMp(id, name, path, strategy, Absyn.TOP(), Error.getNumErrorMessages());
Expand Down
12 changes: 12 additions & 0 deletions Compiler/runtime/System_omc.c
Expand Up @@ -796,6 +796,14 @@ extern void* System_launchParallelTasks(threadData_t *threadData, int numThreads
void *status[len];
int ids[len];
pthread_t th[numThreads];

#if defined(__MINGW32__)
/* adrpo: set thread stack size on Windows to 2MB */
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 2097152);
#endif

#else
void **commands = (void**) omc_alloc_interface.malloc(sizeof(void*)*len);
void **status = (void**) omc_alloc_interface.malloc(sizeof(void*)*len);
Expand All @@ -821,7 +829,11 @@ extern void* System_launchParallelTasks(threadData_t *threadData, int numThreads
}
numThreads = numThreads > len ? len : numThreads;
for (i=0; i<numThreads; i++) {
#if defined(__MINGW32__)
GC_pthread_create(&th[i],&attr,System_launchParallelTasksThread,&data);
#else
GC_pthread_create(&th[i],NULL,System_launchParallelTasksThread,&data);
#endif
}
for (i=0; i<numThreads; i++) {
GC_pthread_join(th[i], NULL);
Expand Down
2 changes: 1 addition & 1 deletion Makefile.omdev.mingw
Expand Up @@ -51,7 +51,7 @@ LINK = cp -rl
AR = ar
# LIBGC configuration is different for Windows (this file) and Linux (Makefile.in)
MINGW_EXTRA_LIBS=lpsolve sundials
LIBGC_EXTRA_CONFIGURATION=--enable-threads=posix --enable-munmap=1 --disable-parallel-mark
LIBGC_EXTRA_CONFIGURATION=--enable-threads=posix --enable-munmap=1 #--disable-parallel-mark
MSL321_CONFIG_EXTRA_FLAGS=--enable-static --disable-shared
LIBFMILIB=libfmilib.a
LIBCMINPACKLIB=libcminpack.a
Expand Down

0 comments on commit f45c1dd

Please sign in to comment.