Skip to content

Commit

Permalink
- call GC_init first thing in Main.mo
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17861 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 24, 2013
1 parent fc8fd75 commit 319ec57
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Compiler/Main/Main.mo
Expand Up @@ -1003,6 +1003,8 @@ algorithm
_ := matchcontinue args
case _
equation
// call GC_init() the first thing we do!
System.initGarbageCollector();
Global.initialize();
System.realtimeTick(GlobalScript.RT_CLOCK_SIMULATE_TOTAL);
args_1 = Flags.new(args);
Expand Down
4 changes: 4 additions & 0 deletions Compiler/Util/System.mo
Expand Up @@ -1019,4 +1019,8 @@ public function getMemorySize
external "C" memory=System_getMemorySize() annotation(Library = {"omcruntime"});
end getMemorySize;

public function initGarbageCollector "this needs to be called first in Main.mo"
external "C" System_initGarbageCollector() annotation(Library = {"omcruntime"});
end initGarbageCollector;

end System;
5 changes: 5 additions & 0 deletions Compiler/runtime/System_omc.c
Expand Up @@ -855,6 +855,11 @@ extern void* System_forkCall(int numThreads, void *dataLst, void (*fn)(void*))
}
#endif

void System_initGarbageCollector(void)
{
SystemImpl__initGarbageCollector();
}

#ifdef __cplusplus
}
#endif
7 changes: 7 additions & 0 deletions Compiler/runtime/System_rml.c
Expand Up @@ -1835,3 +1835,10 @@ RML_BEGIN_LABEL(System__getMemorySize)
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(System__initGarbageCollector)
{
SystemImpl__initGarbageCollector();
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL
5 changes: 5 additions & 0 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -2393,6 +2393,11 @@ int SystemImpl__fileIsNewerThan(const char *file1, const char *file2)
#endif
}

void SystemImpl__initGarbageCollector(void)
{
GC_init();
}

#ifdef __cplusplus
}
#endif
1 change: 1 addition & 0 deletions Compiler/runtime/systemimpl.h
Expand Up @@ -98,5 +98,6 @@ extern double SystemImpl__getCurrentTime(void);
extern int SystemImpl__unescapedStringLength(const char* str);
extern char* SystemImpl__iconv(const char * str, const char *from, const char *to, int printError);
extern char* SystemImpl__iconv__ascii(const char * str);
extern void SystemImpl__initGarbageCollector(void);

#endif //__SYSTEMIMPL_H

0 comments on commit 319ec57

Please sign in to comment.