Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit c077711

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Keep loaded libraries after buildModel failure
We automatically load libraries from uses-annotations; this keeps the libraries in memory even if translation fails. We now also record frontend/etc timings for failed simulations. Some code for handling normal simulations, FMUs, and XML export were merged in order to avoid having mostly duplicate code lying around (this code tends to get out of synch). This fixes ticket:4255. Belonging to [master]: - #2106 - OpenModelica/OpenModelica-testsuite#820
1 parent e46b837 commit c077711

File tree

6 files changed

+385
-681
lines changed

6 files changed

+385
-681
lines changed

Compiler/FrontEnd/Absyn.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ uniontype FunctionArgs "The FunctionArgs uniontype consists of a list of positio
901901

902902
end FunctionArgs;
903903

904+
constant FunctionArgs emptyFunctionArgs = FUNCTIONARGS({},{});
905+
904906
uniontype ReductionIterType
905907
record COMBINE "Reductions are by default calculated as all combinations of the iterators"
906908
end COMBINE;

Compiler/Main/Main.mo

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ algorithm
507507
execStat("Parsed file");
508508

509509
// Instantiate the program.
510-
(cache, env, d, cname) = instantiate(p);
510+
(p, cache, env, d, cname) = instantiate(p);
511511

512512
d = if Flags.isSet(Flags.TRANSFORMS_BEFORE_DUMP) then DAEUtil.transformationsBeforeBackend(cache,env,d) else d;
513513

@@ -588,7 +588,7 @@ protected function instantiate
588588
"Translates the Absyn.Program to SCode and instantiates either a given class
589589
specified by the +i flag on the command line, or the last class in the
590590
program if no class was specified."
591-
input Absyn.Program program;
591+
input output Absyn.Program program;
592592
output FCore.Cache cache;
593593
output FCore.Graph env;
594594
output DAE.DAElist dae;
@@ -602,7 +602,8 @@ algorithm
602602
// program. Otherwise, instantiate the given class name.
603603
cname := if stringEmpty(cls) then Absyn.lastClassname(program) else Absyn.stringPath(cls);
604604
st := GlobalScriptUtil.setSymbolTableAST(GlobalScript.emptySymboltable, program);
605-
(cache, env, dae) := CevalScriptBackend.runFrontEnd(FCore.emptyCache(), FGraph.empty(), cname, st, true);
605+
(cache, env, SOME(dae), st) := CevalScriptBackend.runFrontEnd(FCore.emptyCache(), FGraph.empty(), cname, st, true);
606+
program := st.ast;
606607
end instantiate;
607608

608609
protected function optimizeDae

0 commit comments

Comments
 (0)