Skip to content

Commit

Permalink
JavaScript performance - less setjmp (limited max number of setjmp al…
Browse files Browse the repository at this point in the history
…lowed in emscripten)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19253 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 22, 2014
1 parent 455c848 commit b958f61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenC.tpl
Expand Up @@ -4403,7 +4403,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
DLLEXT=<%makefileParams.dllext%>
CFLAGS_BASED_ON_INIT_FILE=<%extraCflags%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then '<%s.cflags%> ' /* From the simulate() command */%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc/c" -I. <%makefileParams.includes ; separator=" "%> <% if not stringEq(Config.simCodeTarget(),"JavaScript") then "-DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME"%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc/c" -I. <%makefileParams.includes ; separator=" "%> <% if not stringEq(Config.simCodeTarget(),"JavaScript") then "-DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME" else "-DOMC_EMCC"%>
LDFLAGS=<%dirExtra%> <%
if stringEq(Config.simCodeTarget(),"JavaScript") then <<-L'<%makefileParams.omhome%>/lib/omc/emcc' -lblas -llapack -lexpat -lSimulationRuntimeC -lf2c --llvm-lto 2 -s TOTAL_MEMORY=268435456 -s MAX_SETJMPS=2000 -s OUTLINING_LIMIT=20000 --pre-js <%makefileParams.omhome%>/lib/omc/emcc/pre.js>>
else <<-L"<%makefileParams.omhome%>/lib/omc" -L"<%makefileParams.omhome%>/lib" -Wl,<% if stringEq(makefileParams.platform, "win32") then "--stack,0x2000000,"%>-rpath,"<%makefileParams.omhome%>/lib/omc" -Wl,-rpath,"<%makefileParams.omhome%>/lib" <%ParModelicaLibs%> <%makefileParams.ldflags%> <%makefileParams.runtimelibs%>>>
Expand Down
4 changes: 4 additions & 0 deletions SimulationRuntime/c/simulation/solver/dassl.c
Expand Up @@ -492,7 +492,9 @@ int functionODE_residual(double *t, double *y, double *yd, double *delta,
data->threadData->currentErrorStage = ERROR_INTEGRATOR;

/* try */
#if !defined(OMC_EMCC)
MMC_TRY_INTERNAL(simulationJumpBuffer)
#endif
data->callback->functionODE(data);

/* get the difference between the temp_xd(=localData->statesDerivatives)
Expand All @@ -501,7 +503,9 @@ int functionODE_residual(double *t, double *y, double *yd, double *delta,
delta[i] = data->localData[0]->realVars[data->modelData.nStates + i] - yd[i];
}
success = 1;
#if !defined(OMC_EMCC)
MMC_CATCH_INTERNAL(simulationJumpBuffer)
#endif

if (!success) {
*ires = -1;
Expand Down
4 changes: 4 additions & 0 deletions SimulationRuntime/c/simulation/solver/perform_simulation.c
Expand Up @@ -117,7 +117,9 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)

threadData->currentErrorStage = ERROR_SIMULATION;
/* try */
#if !defined(OMC_EMCC)
MMC_TRY_INTERNAL(simulationJumpBuffer)
#endif
{
if(measure_time_flag)
{
Expand Down Expand Up @@ -318,7 +320,9 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)
}
success = 1;
}
#if !defined(OMC_EMCC)
MMC_CATCH_INTERNAL(simulationJumpBuffer)
#endif
if (!success) { /* catch */
if(!retry)
{
Expand Down

0 comments on commit b958f61

Please sign in to comment.